# nodes

node_type: n8n-nodes-base.Plivo
name: Plivo
package_name: n8n-nodes-base
display_name: Plivo
description: Send SMS/MMS messages or make phone calls
code_hash: 59e0f9f644243d74ed88941e6038e4e863bd1fdf3166997922be2484773ead0c
source_location: node_modules/n8n-nodes-base/dist/nodes/Plivo/Plivo.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Plivo = void 0;
  const SmsDescription_1 = require("./SmsDescription");
  const MmsDescription_1 = require("./MmsDescription");
  const CallDescription_1 = require("./CallDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Plivo {
      constructor() {
          this.description = {
              displayName: 'Plivo',
              name: 'plivo',
              icon: 'file:plivo.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Send SMS/MMS messages or make phone calls',
              defaults: {
                  name: 'Plivo',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'plivoApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Call',
                              value: 'call',
                          },
                          {
                              name: 'MMS',
                              value: 'mms',
                          },
                          {
                              name: 'SMS',
                              value: 'sms',
                          },
                      ],
                      default: 'sms',
                      required: true,
                  },
                  ...SmsDescription_1.smsOperations,
                  ...SmsDescription_1.smsFields,
                  ...MmsDescription_1.mmsOperations,
                  ...MmsDescription_1.mmsFields,
                  ...CallDescription_1.callOperations,
                  ...CallDescription_1.callFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              let responseData;
              if (resource === 'sms') {
                  if (operation === 'send') {
                      const body = {
                          src: this.getNodeParameter('from', i),
                          dst: this.getNodeParameter('to', i),
                          text: this.getNodeParameter('message', i),
                      };
                      responseData = await GenericFunctions_1.plivoApiRequest.call(this, 'POST', '/Message', body);
                  }
              }
              else if (resource === 'call') {
                  if (operation === 'make') {
                      const body = {
                          from: this.getNodeParameter('from', i),
                          to: this.getNodeParameter('to', i),
                          answer_url: this.getNodeParameter('answer_url', i),
                          answer_method: this.getNodeParameter('answer_method', i),
                      };
                      responseData = await GenericFunctions_1.plivoApiRequest.call(this, 'POST', '/Call', body);
                  }
              }
              else if (resource === 'mms') {
                  if (operation === 'send') {
                      const body = {
                          src: this.getNodeParameter('from', i),
                          dst: this.getNodeParameter('to', i),
                          text: this.getNodeParameter('message', i),
                          type: 'mms',
                          media_urls: this.getNodeParameter('media_urls', i),
                      };
                      responseData = await GenericFunctions_1.plivoApiRequest.call(this, 'POST', '/Message', body);
                  }
              }
              Array.isArray(responseData)
                  ? returnData.push(...responseData)
                  : returnData.push(responseData);
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Plivo = Plivo;
  //# sourceMappingURL=Plivo.node.js.map

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


node_type: n8n-nodes-base.PostBin
name: PostBin
package_name: n8n-nodes-base
display_name: PostBin
description: Consume PostBin API
code_hash: d01bdc82f547c37c7bfdb49f1c686731effa08a49d92aef848e18de371f08995
source_location: node_modules/n8n-nodes-base/dist/nodes/PostBin/PostBin.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.PostBin = void 0;
  const BinDescription_1 = require("./BinDescription");
  const RequestDescription_1 = require("./RequestDescription");
  class PostBin {
      constructor() {
          this.description = {
              displayName: 'PostBin',
              name: 'postBin',
              icon: 'file:postbin.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
              description: 'Consume PostBin API',
              defaults: {
                  name: 'PostBin',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [],
              requestDefaults: {
                  baseURL: 'https://www.toptal.com',
              },
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Bin',
                              value: 'bin',
                          },
                          {
                              name: 'Request',
                              value: 'request',
                          },
                      ],
                      default: 'bin',
                      required: true,
                  },
                  ...BinDescription_1.binOperations,
                  ...BinDescription_1.binFields,
                  ...RequestDescription_1.requestOperations,
                  ...RequestDescription_1.requestFields,
              ],
          };
      }
  }
  exports.PostBin = PostBin;
  //# sourceMappingURL=PostBin.node.js.map

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


node_type: n8n-nodes-base.PostHog
name: PostHog
package_name: n8n-nodes-base
display_name: PostHog
description: Consume PostHog API
code_hash: ab084fdded448bc9cbe6673f2443a4b06bd38e4ef43646e6448998cdf46905d1
source_location: node_modules/n8n-nodes-base/dist/nodes/PostHog/PostHog.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.PostHog = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const AliasDescription_1 = require("./AliasDescription");
  const EventDescription_1 = require("./EventDescription");
  const TrackDescription_1 = require("./TrackDescription");
  const IdentityDescription_1 = require("./IdentityDescription");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class PostHog {
      constructor() {
          this.description = {
              displayName: 'PostHog',
              name: 'postHog',
              icon: 'file:postHog.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume PostHog API',
              defaults: {
                  name: 'PostHog',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'postHogApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Alias',
                              value: 'alias',
                          },
                          {
                              name: 'Event',
                              value: 'event',
                          },
                          {
                              name: 'Identity',
                              value: 'identity',
                          },
                          {
                              name: 'Track',
                              value: 'track',
                          },
                      ],
                      default: 'event',
                  },
                  ...AliasDescription_1.aliasOperations,
                  ...AliasDescription_1.aliasFields,
                  ...EventDescription_1.eventOperations,
                  ...EventDescription_1.eventFields,
                  ...IdentityDescription_1.identityOperations,
                  ...IdentityDescription_1.identityFields,
                  ...TrackDescription_1.trackOperations,
                  ...TrackDescription_1.trackFields,
              ],
          };
      }
      async execute() {
          var _a, _b, _c, _d, _e;
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'alias') {
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const distinctId = this.getNodeParameter('distinctId', i);
                          const alias = this.getNodeParameter('alias', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const context = ((_a = additionalFields.contextUi) === null || _a === void 0 ? void 0 : _a.contextValues) || [];
                          const event = {
                              type: 'alias',
                              event: '$create_alias',
                              context: context.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}),
                              properties: {
                                  distinct_id: distinctId,
                                  alias,
                              },
                          };
                          Object.assign(event, additionalFields);
                          if (additionalFields.timestamp) {
                              additionalFields.timestamp = (0, moment_timezone_1.default)(additionalFields.timestamp).toISOString();
                          }
                          responseData = await GenericFunctions_1.posthogApiRequest.call(this, 'POST', '/batch', event);
                          returnData.push(responseData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              returnData.push({ error: error.message });
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          if (resource === 'event') {
              if (operation === 'create') {
                  try {
                      const events = [];
                      for (let i = 0; i < length; i++) {
                          const eventName = this.getNodeParameter('eventName', i);
                          const distinctId = this.getNodeParameter('distinctId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const properties = ((_b = additionalFields.propertiesUi) === null || _b === void 0 ? void 0 : _b.propertyValues) ||
                              [];
                          const event = {
                              event: eventName,
                              properties: properties.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}),
                          };
                          event.properties.distinct_id = distinctId;
                          Object.assign(event, additionalFields);
                          if (additionalFields.timestamp) {
                              additionalFields.timestamp = (0, moment_timezone_1.default)(additionalFields.timestamp).toISOString();
                          }
                          delete event.propertiesUi;
                          events.push(event);
                      }
                      responseData = await GenericFunctions_1.posthogApiRequest.call(this, 'POST', '/capture', { batch: events });
                      returnData.push(responseData);
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          returnData.push({ error: error.message });
                      }
                      else {
                          throw error;
                      }
                  }
              }
          }
          if (resource === 'identity') {
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const distinctId = this.getNodeParameter('distinctId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const properties = ((_c = additionalFields.propertiesUi) === null || _c === void 0 ? void 0 : _c.propertyValues) ||
                              [];
                          const event = {
                              event: '$identify',
                              properties: properties.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}),
                              distinct_id: distinctId,
                          };
                          Object.assign(event, additionalFields);
                          if (additionalFields.timestamp) {
                              additionalFields.timestamp = (0, moment_timezone_1.default)(additionalFields.timestamp).toISOString();
                          }
                          delete event.propertiesUi;
                          responseData = await GenericFunctions_1.posthogApiRequest.call(this, 'POST', '/batch', event);
                          returnData.push(responseData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              returnData.push({ error: error.message });
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          if (resource === 'track') {
              if (operation === 'page' || operation === 'screen') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const distinctId = this.getNodeParameter('distinctId', i);
                          const name = this.getNodeParameter('name', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const context = ((_d = additionalFields.contextUi) === null || _d === void 0 ? void 0 : _d.contextValues) || [];
                          const properties = ((_e = additionalFields.propertiesUi) === null || _e === void 0 ? void 0 : _e.propertyValues) ||
                              [];
                          const event = {
                              name,
                              type: operation,
                              event: `$${operation}`,
                              context: context.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}),
                              distinct_id: distinctId,
                              properties: properties.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}),
                          };
                          Object.assign(event, additionalFields);
                          if (additionalFields.timestamp) {
                              additionalFields.timestamp = (0, moment_timezone_1.default)(additionalFields.timestamp).toISOString();
                          }
                          delete event.propertiesUi;
                          responseData = await GenericFunctions_1.posthogApiRequest.call(this, 'POST', '/batch', event);
                          returnData.push(responseData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              returnData.push({ error: error.message });
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.PostHog = PostHog;
  //# sourceMappingURL=PostHog.node.js.map

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


node_type: n8n-nodes-base.Postgres
name: Postgres
package_name: n8n-nodes-base
display_name: Postgres
description: Get, add and update data in Postgres
code_hash: 6bdb276eca46056e106989dfd542127bc76e07d729529f072cb538f2e2e0d93f
source_location: node_modules/n8n-nodes-base/dist/nodes/Postgres/Postgres.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Postgres = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const PostgresV1_node_1 = require("./v1/PostgresV1.node");
  const PostgresV2_node_1 = require("./v2/PostgresV2.node");
  class Postgres extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Postgres',
              name: 'postgres',
              icon: 'file:postgres.svg',
              group: ['input'],
              defaultVersion: 2.3,
              description: 'Get, add and update data in Postgres',
          };
          const nodeVersions = {
              1: new PostgresV1_node_1.PostgresV1(baseDescription),
              2: new PostgresV2_node_1.PostgresV2(baseDescription),
              2.1: new PostgresV2_node_1.PostgresV2(baseDescription),
              2.2: new PostgresV2_node_1.PostgresV2(baseDescription),
              2.3: new PostgresV2_node_1.PostgresV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Postgres = Postgres;
  //# sourceMappingURL=Postgres.node.js.map

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


node_type: n8n-nodes-base.ProfitWell
name: ProfitWell
package_name: n8n-nodes-base
display_name: ProfitWell
description: Consume ProfitWell API
code_hash: 8d5fd3fd10d49adac3de5845568dad48b59fefc816b7de39f98c02e402fb38ae
source_location: node_modules/n8n-nodes-base/dist/nodes/ProfitWell/ProfitWell.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ProfitWell = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const CompanyDescription_1 = require("./CompanyDescription");
  const MetricDescription_1 = require("./MetricDescription");
  class ProfitWell {
      constructor() {
          this.description = {
              displayName: 'ProfitWell',
              name: 'profitWell',
              icon: 'file:profitwell.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume ProfitWell API',
              defaults: {
                  name: 'ProfitWell',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'profitWellApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Metric',
                              value: 'metric',
                          },
                      ],
                      default: 'metric',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...MetricDescription_1.metricOperations,
                  ...MetricDescription_1.metricFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getPlanIds() {
                      const returnData = [];
                      const planIds = await GenericFunctions_1.profitWellApiRequest.call(this, 'GET', '/metrics/plans');
                      for (const planId of planIds.plan_ids) {
                          returnData.push({
                              name: planId,
                              value: planId,
                          });
                      }
                      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 === 'company') {
                      if (operation === 'getSetting') {
                          responseData = await GenericFunctions_1.profitWellApiRequest.call(this, 'GET', '/company/settings/');
                      }
                  }
                  if (resource === 'metric') {
                      if (operation === 'get') {
                          const type = this.getNodeParameter('type', i);
                          const simple = this.getNodeParameter('simple', 0);
                          if (type === 'daily') {
                              qs.month = this.getNodeParameter('month', i);
                          }
                          const options = this.getNodeParameter('options', i);
                          Object.assign(qs, options);
                          if (qs.dailyMetrics) {
                              qs.metrics = qs.dailyMetrics.join(',');
                              delete qs.dailyMetrics;
                          }
                          if (qs.monthlyMetrics) {
                              qs.metrics = qs.monthlyMetrics.join(',');
                              delete qs.monthlyMetrics;
                          }
                          responseData = await GenericFunctions_1.profitWellApiRequest.call(this, 'GET', `/metrics/${type}`, {}, qs);
                          responseData = responseData.data;
                          if (simple) {
                              if (type === 'daily') {
                                  responseData = (0, GenericFunctions_1.simplifyDailyMetrics)(responseData);
                              }
                              else {
                                  responseData = (0, GenericFunctions_1.simplifyMontlyMetrics)(responseData);
                              }
                          }
                      }
                  }
                  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.ProfitWell = ProfitWell;
  //# sourceMappingURL=ProfitWell.node.js.map

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


node_type: n8n-nodes-base.Pushbullet
name: Pushbullet
package_name: n8n-nodes-base
display_name: Pushbullet
description: Consume Pushbullet API
code_hash: 6352a9ed63d4fb5cd185cf85a29778fb67757992f84c8013c03bf4eab023e94a
source_location: node_modules/n8n-nodes-base/dist/nodes/Pushbullet/Pushbullet.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.Pushbullet = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Pushbullet {
      constructor() {
          this.description = {
              displayName: 'Pushbullet',
              name: 'pushbullet',
              icon: 'file:pushbullet.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Pushbullet API',
              defaults: {
                  name: 'Pushbullet',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'pushbulletOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Push',
                              value: 'push',
                          },
                      ],
                      default: 'push',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a push',
                              action: 'Create a push',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a push',
                              action: 'Delete a push',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many pushes',
                              action: 'Get many pushes',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a push',
                              action: 'Update a push',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Type',
                      name: 'type',
                      type: 'options',
                      options: [
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Link',
                              value: 'link',
                          },
                          {
                              name: 'Note',
                              value: 'note',
                          },
                      ],
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                          },
                      },
                      default: 'note',
                  },
                  {
                      displayName: 'Title',
                      name: 'title',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                              type: ['note', 'link'],
                          },
                      },
                      default: '',
                      description: 'Title of the push',
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                              type: ['note', 'link', 'file'],
                          },
                      },
                      default: '',
                      description: 'Body of the push',
                  },
                  {
                      displayName: 'URL',
                      name: 'url',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                              type: ['link'],
                          },
                      },
                      default: '',
                      description: 'URL of the push',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                              type: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property which contains the data for the file to be created',
                  },
                  {
                      displayName: 'Target',
                      name: 'target',
                      type: 'options',
                      options: [
                          {
                              name: 'Channel Tag',
                              value: 'channel_tag',
                              description: 'Send the push to all subscribers to your channel that has this tag',
                          },
                          {
                              name: 'Default',
                              value: 'default',
                              description: "Broadcast it to all of the user's devices",
                          },
                          {
                              name: 'Device ID',
                              value: 'device_iden',
                              description: 'Send the push to a specific device',
                          },
                          {
                              name: 'Email',
                              value: 'email',
                              description: 'Send the push to this email address',
                          },
                      ],
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                          },
                      },
                      default: 'default',
                      description: 'Define the medium that will be used to send the push',
                  },
                  {
                      displayName: 'Value',
                      name: 'value',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                          },
                          hide: {
                              target: ['default', 'device_iden'],
                          },
                      },
                      default: '',
                      description: 'The value to be set depending on the target selected. For example, if the target selected is email then this field would take the email address of the person you are trying to send the push to.',
                  },
                  {
                      displayName: 'Value Name or ID',
                      name: 'value',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getDevices',
                      },
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['create'],
                              target: ['device_iden'],
                          },
                      },
                      default: '',
                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                  },
                  {
                      displayName: 'Push ID',
                      name: 'pushId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['push'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['push'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 500,
                      },
                      default: 100,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Active',
                              name: 'active',
                              type: 'boolean',
                              default: false,
                              description: "Don't return deleted pushes",
                          },
                          {
                              displayName: 'Modified After',
                              name: 'modified_after',
                              type: 'dateTime',
                              default: '',
                              description: 'Request pushes modified after this timestamp',
                          },
                      ],
                  },
                  {
                      displayName: 'Push ID',
                      name: 'pushId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Dismissed',
                      name: 'dismissed',
                      type: 'boolean',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['push'],
                              operation: ['update'],
                          },
                      },
                      default: false,
                      description: 'Whether to mark a push as having been dismissed by the user, will cause any notifications for the push to be hidden if possible',
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getDevices() {
                      const returnData = [];
                      const { devices } = await GenericFunctions_1.pushbulletApiRequest.call(this, 'GET', '/devices');
                      for (const device of devices) {
                          returnData.push({
                              name: device.nickname,
                              value: device.iden,
                          });
                      }
                      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 === 'push') {
                      if (operation === 'create') {
                          const type = this.getNodeParameter('type', i);
                          const message = this.getNodeParameter('body', i);
                          const target = this.getNodeParameter('target', i);
                          const body = {
                              type,
                              body: message,
                          };
                          if (target !== 'default') {
                              const value = this.getNodeParameter('value', i);
                              body[target] = value;
                          }
                          if (['note', 'link'].includes(type)) {
                              body.title = this.getNodeParameter('title', i);
                              if (type === 'link') {
                                  body.url = this.getNodeParameter('url', i);
                              }
                          }
                          if (type === 'file') {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              const { upload_url: uploadUrl, file_name, file_type, file_url, } = await GenericFunctions_1.pushbulletApiRequest.call(this, 'POST', '/upload-request', {
                                  file_name: binaryData.fileName,
                                  file_type: binaryData.mimeType,
                              });
                              await GenericFunctions_1.pushbulletApiRequest.call(this, 'POST', '', {}, {}, uploadUrl, {
                                  formData: {
                                      file: {
                                          value: dataBuffer,
                                          options: {
                                              filename: binaryData.fileName,
                                          },
                                      },
                                  },
                                  json: false,
                              });
                              body.file_name = file_name;
                              body.file_type = file_type;
                              body.file_url = file_url;
                          }
                          responseData = await GenericFunctions_1.pushbulletApiRequest.call(this, 'POST', '/pushes', body);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const filters = this.getNodeParameter('filters', i);
                          Object.assign(qs, filters);
                          if (qs.modified_after) {
                              qs.modified_after = (0, moment_timezone_1.default)(qs.modified_after).unix();
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.pushbulletApiRequestAllItems.call(this, 'pushes', 'GET', '/pushes', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.pushbulletApiRequest.call(this, 'GET', '/pushes', {}, qs);
                              responseData = responseData.pushes;
                          }
                      }
                      if (operation === 'delete') {
                          const pushId = this.getNodeParameter('pushId', i);
                          responseData = await GenericFunctions_1.pushbulletApiRequest.call(this, 'DELETE', `/pushes/${pushId}`);
                          responseData = { success: true };
                      }
                      if (operation === 'update') {
                          const pushId = this.getNodeParameter('pushId', i);
                          const dismissed = this.getNodeParameter('dismissed', i);
                          responseData = await GenericFunctions_1.pushbulletApiRequest.call(this, 'POST', `/pushes/${pushId}`, {
                              dismissed,
                          });
                      }
                  }
                  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.Pushbullet = Pushbullet;
  //# sourceMappingURL=Pushbullet.node.js.map

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


node_type: n8n-nodes-base.Pushcut
name: Pushcut
package_name: n8n-nodes-base
display_name: Pushcut
description: Consume Pushcut API
code_hash: 7b69beb7d523647571e05d593f709612aad72eb64f56b0f87ac030ea69eb03eb
source_location: node_modules/n8n-nodes-base/dist/nodes/Pushcut/Pushcut.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Pushcut = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Pushcut {
      constructor() {
          this.description = {
              displayName: 'Pushcut',
              name: 'pushcut',
              icon: 'file:pushcut.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Pushcut API',
              defaults: {
                  name: 'Pushcut',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'pushcutApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Notification',
                              value: 'notification',
                          },
                      ],
                      default: 'notification',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['notification'],
                          },
                      },
                      options: [
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Send a notification',
                              action: 'Send a notification',
                          },
                      ],
                      default: 'send',
                  },
                  {
                      displayName: 'Notification Name or ID',
                      name: 'notificationName',
                      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: 'getNotifications',
                      },
                      displayOptions: {
                          show: {
                              resource: ['notification'],
                              operation: ['send'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['notification'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Device Names or IDs',
                              name: 'devices',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getDevices',
                              },
                              default: [],
                              description: 'List of devices this notification is sent to. (default is all devices). Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Input',
                              name: 'input',
                              type: 'string',
                              default: '',
                              description: 'Value that is passed as input to the notification action',
                          },
                          {
                              displayName: 'Text',
                              name: 'text',
                              type: 'string',
                              default: '',
                              description: 'Text that is used instead of the one defined in the app',
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'Title that is used instead of the one defined in the app',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getDevices() {
                      const returnData = [];
                      const devices = await GenericFunctions_1.pushcutApiRequest.call(this, 'GET', '/devices');
                      for (const device of devices) {
                          returnData.push({
                              name: device.id,
                              value: device.id,
                          });
                      }
                      return returnData;
                  },
                  async getNotifications() {
                      const returnData = [];
                      const notifications = await GenericFunctions_1.pushcutApiRequest.call(this, 'GET', '/notifications');
                      for (const notification of notifications) {
                          returnData.push({
                              name: notification.title,
                              value: notification.id,
                          });
                      }
                      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++) {
              if (resource === 'notification') {
                  if (operation === 'send') {
                      const notificationName = this.getNodeParameter('notificationName', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {};
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.pushcutApiRequest.call(this, 'POST', `/notifications/${encodeURI(notificationName)}`, body);
                  }
              }
          }
          if (Array.isArray(responseData)) {
              returnData.push.apply(returnData, responseData);
          }
          else if (responseData !== undefined) {
              returnData.push(responseData);
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Pushcut = Pushcut;
  //# sourceMappingURL=Pushcut.node.js.map

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


node_type: n8n-nodes-base.Pushover
name: Pushover
package_name: n8n-nodes-base
display_name: Pushover
description: Consume Pushover API
code_hash: 3a7a4089c5eeea56b94fe3d78b95dbf850e3eefb49b2255fd9e6a6a4de9cf4a9
source_location: node_modules/n8n-nodes-base/dist/nodes/Pushover/Pushover.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Pushover = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Pushover {
      constructor() {
          this.description = {
              displayName: 'Pushover',
              name: 'pushover',
              icon: 'file:pushover.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Pushover API',
              defaults: {
                  name: 'Pushover',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'pushoverApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Message',
                              value: 'message',
                          },
                      ],
                      default: 'message',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                          },
                      },
                      options: [
                          {
                              name: 'Push',
                              value: 'push',
                              action: 'Push a message',
                          },
                      ],
                      default: 'push',
                  },
                  {
                      displayName: 'User Key',
                      name: 'userKey',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['push'],
                          },
                      },
                      default: '',
                      description: 'The user/group key (not e-mail address) of your user (or you), viewable when logged into the <a href="https://pushover.net/">dashboard</a> (often referred to as <code>USER_KEY</code> in the <a href="https://support.pushover.net/i44-example-code-and-pushover-libraries">libraries</a> and code examples)',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['push'],
                          },
                      },
                      default: '',
                      description: 'Your message',
                  },
                  {
                      displayName: 'Priority',
                      name: 'priority',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['push'],
                          },
                      },
                      options: [
                          {
                              name: 'Lowest Priority',
                              value: -2,
                          },
                          {
                              name: 'Low Priority',
                              value: -1,
                          },
                          {
                              name: 'Normal Priority',
                              value: 0,
                          },
                          {
                              name: 'High Priority',
                              value: 1,
                          },
                          {
                              name: 'Emergency Priority',
                              value: 2,
                          },
                      ],
                      default: -2,
                      description: "Send as -2 to generate no notification/alert, -1 to always send as a quiet notification, 1 to display as high-priority and bypass the user's quiet hours, or 2 to also require confirmation from the user",
                  },
                  {
                      displayName: 'Retry (Seconds)',
                      name: 'retry',
                      type: 'number',
                      typeOptions: {
                          minValue: 0,
                      },
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['push'],
                              priority: [2],
                          },
                      },
                      default: 30,
                      description: 'Specifies how often (in seconds) the Pushover servers will send the same notification to the user. This parameter must have a value of at least 30 seconds between retries.',
                  },
                  {
                      displayName: 'Expire (Seconds)',
                      name: 'expire',
                      type: 'number',
                      typeOptions: {
                          minValue: 0,
                          maxValue: 10800,
                      },
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['push'],
                              priority: [2],
                          },
                      },
                      default: 30,
                      description: 'Specifies how many seconds your notification will continue to be retried for (every retry seconds)',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['push'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Attachment',
                              name: 'attachmentsUi',
                              placeholder: 'Add Attachments',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: false,
                              },
                              options: [
                                  {
                                      name: 'attachmentsValues',
                                      displayName: 'Attachment Property',
                                      values: [
                                          {
                                              displayName: 'Binary Property',
                                              name: 'binaryPropertyName',
                                              type: 'string',
                                              default: '',
                                              placeholder: 'data',
                                              description: 'Name of the binary properties which contain data which should be added to email as attachment',
                                          },
                                      ],
                                  },
                              ],
                              default: {},
                          },
                          {
                              displayName: 'Device',
                              name: 'device',
                              type: 'string',
                              default: '',
                              description: "Your user's device name to send the message directly to that device, rather than all of the user's devices (multiple devices may be separated by a comma)",
                          },
                          {
                              displayName: 'HTML Formatting',
                              name: 'html',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to enable messages formatting with HTML tags',
                          },
                          {
                              displayName: 'Sound Name or ID',
                              name: 'sound',
                              type: 'options',
                              typeOptions: {
                                  loadOptionsMethod: 'getSounds',
                              },
                              default: '',
                              description: 'The name of one of the sounds supported by device clients to override the user\'s default sound choice. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Timestamp',
                              name: 'timestamp',
                              type: 'dateTime',
                              default: '',
                              description: "A Unix timestamp of your message's date and time to display to the user, rather than the time your message is received by our API",
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: "Your message's title, otherwise your app's name is used",
                          },
                          {
                              displayName: 'Timestamp',
                              name: 'timestamp',
                              type: 'dateTime',
                              default: '',
                              description: "A Unix timestamp of your message's date and time to display to the user, rather than the time your message is received by our API",
                          },
                          {
                              displayName: 'URL',
                              name: 'url',
                              type: 'string',
                              default: '',
                              description: 'A supplementary URL to show with your message',
                          },
                          {
                              displayName: 'URL Title',
                              name: 'url_title',
                              type: 'string',
                              default: '',
                              description: 'A title for your supplementary URL, otherwise just the URL is shown',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getSounds() {
                      const { sounds } = await GenericFunctions_1.pushoverApiRequest.call(this, 'GET', '/sounds.json', {});
                      const returnData = [];
                      for (const key of Object.keys(sounds)) {
                          returnData.push({
                              name: sounds[key],
                              value: key,
                          });
                      }
                      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 === 'message') {
                      if (operation === 'push') {
                          const userKey = this.getNodeParameter('userKey', i);
                          const message = this.getNodeParameter('message', i);
                          const priority = this.getNodeParameter('priority', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.html !== undefined) {
                              additionalFields.html = additionalFields.html ? '1' : '';
                          }
                          const body = {
                              user: userKey,
                              message,
                              priority,
                          };
                          if (priority === 2) {
                              body.retry = this.getNodeParameter('retry', i);
                              body.expire = this.getNodeParameter('expire', i);
                          }
                          Object.assign(body, additionalFields);
                          if (body.attachmentsUi) {
                              const attachment = body.attachmentsUi
                                  .attachmentsValues;
                              if (attachment) {
                                  const binaryPropertyName = attachment.binaryPropertyName;
                                  const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                                  const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                                  body.attachment = {
                                      value: dataBuffer,
                                      options: {
                                          filename: binaryData.fileName,
                                      },
                                  };
                                  delete body.attachmentsUi;
                              }
                          }
                          responseData = await GenericFunctions_1.pushoverApiRequest.call(this, 'POST', '/messages.json', 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.Pushover = Pushover;
  //# sourceMappingURL=Pushover.node.js.map

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


node_type: n8n-nodes-base.QuestDb
name: QuestDb
package_name: n8n-nodes-base
display_name: QuestDB
description: Get, add and update data in QuestDB
code_hash: 574aabe37688781da940acac0261aa5557874f116089eed6b378a603b7580b71
source_location: node_modules/n8n-nodes-base/dist/nodes/QuestDb/QuestDb.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.QuestDb = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const pg_promise_1 = __importDefault(require("pg-promise"));
  const genericFunctions_1 = require("../Postgres/v1/genericFunctions");
  class QuestDb {
      constructor() {
          this.description = {
              displayName: 'QuestDB',
              name: 'questDb',
              icon: 'file:questdb.png',
              group: ['input'],
              version: 1,
              description: 'Get, add and update data in QuestDB',
              defaults: {
                  name: 'QuestDB',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'questDb',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Execute Query',
                              value: 'executeQuery',
                              description: 'Executes a SQL query',
                              action: 'Execute a SQL query',
                          },
                          {
                              name: 'Insert',
                              value: 'insert',
                              description: 'Insert rows in database',
                              action: 'Insert rows in database',
                          },
                      ],
                      default: 'insert',
                  },
                  {
                      displayName: 'Query',
                      name: 'query',
                      type: 'string',
                      noDataExpression: true,
                      typeOptions: {
                          editor: 'sqlEditor',
                          rows: 5,
                          sqlDialect: 'PostgreSQL',
                      },
                      displayOptions: {
                          show: {
                              operation: ['executeQuery'],
                          },
                      },
                      default: '',
                      placeholder: 'SELECT id, name FROM product WHERE quantity > $1 AND price <= $2',
                      required: true,
                      description: 'The SQL query to execute. You can use n8n expressions or $1 and $2 in conjunction with query parameters.',
                  },
                  {
                      displayName: 'Schema',
                      name: 'schema',
                      type: 'hidden',
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                      default: '',
                      description: 'Name of the schema the table belongs to',
                  },
                  {
                      displayName: 'Table',
                      name: 'table',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the table in which to insert data to',
                  },
                  {
                      displayName: 'Columns',
                      name: 'columns',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                      default: '',
                      placeholder: 'id,name,description',
                      description: 'Comma-separated list of the properties which should used as columns for the new rows',
                  },
                  {
                      displayName: 'Return Fields',
                      name: 'returnFields',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                      default: '*',
                      description: 'Comma-separated list of the fields that the operation will return',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['executeQuery'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Mode',
                              name: 'mode',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Independently',
                                      value: 'independently',
                                      description: 'Execute each query independently',
                                  },
                                  {
                                      name: 'Transaction',
                                      value: 'transaction',
                                      description: 'Executes all queries in a single transaction',
                                  },
                              ],
                              default: 'independently',
                              description: 'The way queries should be sent to database. Can be used in conjunction with <b>Continue on Fail</b>. See <a href="https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.questdb/">the docs</a> for more examples.',
                          },
                          {
                              displayName: 'Query Parameters',
                              name: 'queryParams',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/operation': ['executeQuery'],
                                  },
                              },
                              default: '',
                              placeholder: 'quantity,price',
                              description: 'Comma-separated list of properties which should be used as query parameters',
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'hidden',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                  },
              ],
          };
      }
      async execute() {
          const credentials = await this.getCredentials('questDb');
          const pgp = (0, pg_promise_1.default)();
          const config = {
              host: credentials.host,
              port: credentials.port,
              database: credentials.database,
              user: credentials.user,
              password: credentials.password,
              ssl: !['disable', undefined].includes(credentials.ssl),
              sslmode: credentials.ssl || 'disable',
          };
          const db = pgp(config);
          let returnItems = [];
          const items = this.getInputData();
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'executeQuery') {
              const additionalFields = this.getNodeParameter('additionalFields', 0);
              const mode = (additionalFields.mode || 'independently');
              const queryResult = await genericFunctions_1.pgQueryV2.call(this, pgp, db, items, this.continueOnFail(), {
                  overrideMode: mode,
                  resolveExpression: true,
              });
              returnItems = this.helpers.returnJsonArray(queryResult);
          }
          else if (operation === 'insert') {
              await (0, genericFunctions_1.pgInsert)(this.getNodeParameter, pgp, db, items, this.continueOnFail(), 'independently');
              const returnFields = this.getNodeParameter('returnFields', 0);
              const table = this.getNodeParameter('table', 0);
              const insertData = await db.any('SELECT ${columns:name} from ${table:name}', {
                  columns: returnFields
                      .split(',')
                      .map((value) => value.trim())
                      .filter((value) => !!value),
                  table,
              });
              returnItems = this.helpers.returnJsonArray(insertData);
          }
          else {
              await db.$pool.end();
              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`);
          }
          await db.$pool.end();
          return [returnItems];
      }
  }
  exports.QuestDb = QuestDb;
  //# sourceMappingURL=QuestDb.node.js.map

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


node_type: n8n-nodes-base.QuickBase
name: QuickBase
package_name: n8n-nodes-base
display_name: Quick Base
description: Integrate with the Quick Base RESTful API
code_hash: bfd2ee929fc7e48c79cc4f0913b3f3978c18ae98191cbce71e2b6c95fdc8c1c5
source_location: node_modules/n8n-nodes-base/dist/nodes/QuickBase/QuickBase.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.QuickBase = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const FieldDescription_1 = require("./FieldDescription");
  const FileDescription_1 = require("./FileDescription");
  const RecordDescription_1 = require("./RecordDescription");
  const ReportDescription_1 = require("./ReportDescription");
  const utilities_1 = require("../../utils/utilities");
  class QuickBase {
      constructor() {
          this.description = {
              displayName: 'Quick Base',
              name: 'quickbase',
              icon: 'file:quickbase.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Integrate with the Quick Base RESTful API',
              defaults: {
                  name: 'Quick Base',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'quickbaseApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Field',
                              value: 'field',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Record',
                              value: 'record',
                          },
                          {
                              name: 'Report',
                              value: 'report',
                          },
                      ],
                      default: 'record',
                  },
                  ...FieldDescription_1.fieldOperations,
                  ...FieldDescription_1.fieldFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
                  ...RecordDescription_1.recordOperations,
                  ...RecordDescription_1.recordFields,
                  ...ReportDescription_1.reportOperations,
                  ...ReportDescription_1.reportFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTableFields() {
                      const returnData = [];
                      const tableId = this.getCurrentNodeParameter('tableId');
                      const fields = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', '/fields', {}, { tableId });
                      for (const field of fields) {
                          returnData.push({
                              name: field.label,
                              value: field.id,
                          });
                      }
                      return returnData;
                  },
                  async getUniqueTableFields() {
                      const returnData = [];
                      const tableId = this.getCurrentNodeParameter('tableId');
                      const fields = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', '/fields', {}, { tableId });
                      for (const field of fields) {
                          if (field.unique === true && field.properties.primaryKey === false) {
                              returnData.push({
                                  name: field.label,
                                  value: field.id,
                              });
                          }
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const itemData = (0, utilities_1.generatePairedItemData)(items.length);
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'field') {
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      const options = this.getNodeParameter('options', i);
                      Object.assign({
                          tableId,
                      }, options);
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', '/fields', {}, qs);
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          if (resource === 'file') {
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const tableId = this.getNodeParameter('tableId', i);
                      const recordId = this.getNodeParameter('recordId', i);
                      const fieldId = this.getNodeParameter('fieldId', i);
                      const versionNumber = this.getNodeParameter('versionNumber', i);
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'DELETE', `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'download') {
                  for (let i = 0; i < length; i++) {
                      const tableId = this.getNodeParameter('tableId', i);
                      const recordId = this.getNodeParameter('recordId', i);
                      const fieldId = this.getNodeParameter('fieldId', i);
                      const versionNumber = this.getNodeParameter('versionNumber', i);
                      const newItem = {
                          json: items[i].json,
                          binary: {},
                      };
                      if (items[i].binary !== undefined) {
                          Object.assign(newItem.binary, items[i].binary);
                      }
                      items[i] = newItem;
                      const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`, {}, {}, { json: false, resolveWithFullResponse: true });
                      const contentDisposition = responseData.headers['content-disposition'];
                      const data = Buffer.from(responseData.body, 'base64');
                      items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, contentDisposition.split('=')[1]);
                  }
                  return [items];
              }
          }
          if (resource === 'record') {
              if (operation === 'create') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const simple = this.getNodeParameter('simple', 0);
                  const data = [];
                  const options = this.getNodeParameter('options', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      if (options.useFieldIDs === true) {
                          for (const key of Object.keys(items[i].json)) {
                              record[key] = { value: items[i].json[key] };
                          }
                      }
                      else {
                          const { fieldsLabelKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                          for (const key of Object.keys(items[i].json)) {
                              if (fieldsLabelKey.hasOwnProperty(key) && columnList.includes(key)) {
                                  record[fieldsLabelKey[key].toString()] = { value: items[i].json[key] };
                              }
                          }
                      }
                      data.push(record);
                  }
                  const body = {
                      data,
                      to: tableId,
                  };
                  body.fieldsToReturn = [3];
                  if (options.fields) {
                      body.fieldsToReturn = options.fields;
                  }
                  responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records', body);
                  if (simple) {
                      const { data: records } = responseData;
                      responseData = [];
                      for (const record of records) {
                          const recordData = {};
                          for (const [key, value] of Object.entries(record)) {
                              recordData[key] = value.value;
                          }
                          responseData.push(recordData);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
                  returnData.push(...executionData);
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const tableId = this.getNodeParameter('tableId', i);
                      const where = this.getNodeParameter('where', i);
                      const body = {
                          from: tableId,
                          where,
                      };
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'DELETE', '/records', body);
                      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 tableId = this.getNodeParameter('tableId', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {
                          from: tableId,
                      };
                      Object.assign(body, options);
                      if (options.sortByUi) {
                          const sort = options.sortByUi.sortByValues;
                          body.sortBy = sort;
                          delete body.sortByUi;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.quickbaseApiRequestAllItems.call(this, 'POST', '/records/query', body, qs);
                      }
                      else {
                          body.options = { top: this.getNodeParameter('limit', i) };
                          responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records/query', body, qs);
                          const { data: records, fields } = responseData;
                          responseData = [];
                          const fieldsIdKey = {};
                          for (const field of fields) {
                              fieldsIdKey[field.id] = field.label;
                          }
                          for (const record of records) {
                              const data = {};
                              for (const [key, value] of Object.entries(record)) {
                                  data[fieldsIdKey[key]] = value.value;
                              }
                              responseData.push(data);
                          }
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'update') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const { fieldsLabelKey: _fieldsLabelKey, fieldsIdKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                  const simple = this.getNodeParameter('simple', 0);
                  const updateKey = this.getNodeParameter('updateKey', 0);
                  const data = [];
                  const options = this.getNodeParameter('options', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      if (options.useFieldIDs === true) {
                          for (const key of Object.keys(items[i].json)) {
                              record[key] = { value: items[i].json[key] };
                          }
                      }
                      else {
                          const { fieldsLabelKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                          for (const key of Object.keys(items[i].json)) {
                              if (fieldsLabelKey.hasOwnProperty(key) && columnList.includes(key)) {
                                  record[fieldsLabelKey[key].toString()] = { value: items[i].json[key] };
                              }
                          }
                      }
                      if (items[i].json[updateKey] === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i });
                      }
                      data.push(record);
                  }
                  const body = {
                      data,
                      to: tableId,
                  };
                  if (options.fields) {
                      body.fieldsToReturn = options.fields;
                  }
                  responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records', body);
                  if (simple) {
                      const { data: records } = responseData;
                      responseData = [];
                      for (const record of records) {
                          const recordData = {};
                          for (const [key, value] of Object.entries(record)) {
                              recordData[fieldsIdKey[key]] = value.value;
                          }
                          responseData.push(recordData);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
                  returnData.push(...executionData);
              }
              if (operation === 'upsert') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const simple = this.getNodeParameter('simple', 0);
                  const updateKey = this.getNodeParameter('updateKey', 0);
                  const mergeFieldId = this.getNodeParameter('mergeFieldId', 0);
                  const data = [];
                  const options = this.getNodeParameter('options', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      if (options.useFieldIDs === true) {
                          for (const key of Object.keys(items[i].json)) {
                              record[key] = { value: items[i].json[key] };
                          }
                      }
                      else {
                          const { fieldsLabelKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                          for (const key of Object.keys(items[i].json)) {
                              if (fieldsLabelKey.hasOwnProperty(key) && columnList.includes(key)) {
                                  record[fieldsLabelKey[key].toString()] = { value: items[i].json[key] };
                              }
                          }
                      }
                      if (items[i].json[updateKey] === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i });
                      }
                      record[mergeFieldId] = { value: items[i].json[updateKey] };
                      data.push(record);
                  }
                  const body = {
                      data,
                      to: tableId,
                      mergeFieldId,
                  };
                  body.fieldsToReturn = [3];
                  if (options.fields) {
                      body.fieldsToReturn = options.fields;
                  }
                  responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records', body);
                  if (simple) {
                      const { data: records } = responseData;
                      responseData = [];
                      for (const record of records) {
                          const recordData = {};
                          for (const [key, value] of Object.entries(record)) {
                              recordData[key] = value.value;
                          }
                          responseData.push(recordData);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
                  returnData.push(...executionData);
              }
          }
          if (resource === 'report') {
              if (operation === 'run') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      const reportId = this.getNodeParameter('reportId', i);
                      qs.tableId = tableId;
                      if (returnAll) {
                          responseData = await GenericFunctions_1.quickbaseApiRequestAllItems.call(this, 'POST', `/reports/${reportId}/run`, {}, qs);
                      }
                      else {
                          qs.top = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', `/reports/${reportId}/run`, {}, qs);
                          const { data: records, fields } = responseData;
                          responseData = [];
                          const fieldsIdKey = {};
                          for (const field of fields) {
                              fieldsIdKey[field.id] = field.label;
                          }
                          for (const record of records) {
                              const data = {};
                              for (const [key, value] of Object.entries(record)) {
                                  data[fieldsIdKey[key]] = value.value;
                              }
                              responseData.push(data);
                          }
                      }
                      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 reportId = this.getNodeParameter('reportId', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      qs.tableId = tableId;
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', `/reports/${reportId}`, {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          return [returnData];
      }
  }
  exports.QuickBase = QuickBase;
  //# sourceMappingURL=QuickBase.node.js.map

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


node_type: n8n-nodes-base.QuickBooks
name: QuickBooks
package_name: n8n-nodes-base
display_name: QuickBooks Online
description: Consume the QuickBooks Online API
code_hash: fec11a5217d27572bb5cc124a06c9011a104bab890905afe4e7c04e3abf95f7f
source_location: node_modules/n8n-nodes-base/dist/nodes/QuickBooks/QuickBooks.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.QuickBooks = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const change_case_1 = require("change-case");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  class QuickBooks {
      constructor() {
          this.description = {
              displayName: 'QuickBooks Online',
              name: 'quickbooks',
              icon: 'file:quickbooks.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the QuickBooks Online API',
              defaults: {
                  name: 'QuickBooks Online',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'quickBooksOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Bill',
                              value: 'bill',
                          },
                          {
                              name: 'Customer',
                              value: 'customer',
                          },
                          {
                              name: 'Employee',
                              value: 'employee',
                          },
                          {
                              name: 'Estimate',
                              value: 'estimate',
                          },
                          {
                              name: 'Invoice',
                              value: 'invoice',
                          },
                          {
                              name: 'Item',
                              value: 'item',
                          },
                          {
                              name: 'Payment',
                              value: 'payment',
                          },
                          {
                              name: 'Purchase',
                              value: 'purchase',
                          },
                          {
                              name: 'Transaction',
                              value: 'transaction',
                          },
                          {
                              name: 'Vendor',
                              value: 'vendor',
                          },
                      ],
                      default: 'customer',
                  },
                  ...descriptions_1.billOperations,
                  ...descriptions_1.billFields,
                  ...descriptions_1.customerOperations,
                  ...descriptions_1.customerFields,
                  ...descriptions_1.employeeOperations,
                  ...descriptions_1.employeeFields,
                  ...descriptions_1.estimateOperations,
                  ...descriptions_1.estimateFields,
                  ...descriptions_1.invoiceOperations,
                  ...descriptions_1.invoiceFields,
                  ...descriptions_1.itemOperations,
                  ...descriptions_1.itemFields,
                  ...descriptions_1.paymentOperations,
                  ...descriptions_1.paymentFields,
                  ...descriptions_1.purchaseOperations,
                  ...descriptions_1.purchaseFields,
                  ...descriptions_1.transactionOperations,
                  ...descriptions_1.transactionFields,
                  ...descriptions_1.vendorOperations,
                  ...descriptions_1.vendorFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCustomers() {
                      return GenericFunctions_1.loadResource.call(this, 'customer');
                  },
                  async getCustomFields() {
                      return GenericFunctions_1.loadResource.call(this, 'preferences');
                  },
                  async getDepartments() {
                      return GenericFunctions_1.loadResource.call(this, 'department');
                  },
                  async getItems() {
                      return GenericFunctions_1.loadResource.call(this, 'item');
                  },
                  async getMemos() {
                      return GenericFunctions_1.loadResource.call(this, 'CreditMemo');
                  },
                  async getPurchases() {
                      return GenericFunctions_1.loadResource.call(this, 'purchase');
                  },
                  async getTaxCodeRefs() {
                      return GenericFunctions_1.loadResource.call(this, 'TaxCode');
                  },
                  async getTerms() {
                      return GenericFunctions_1.loadResource.call(this, 'Term');
                  },
                  async getVendors() {
                      return GenericFunctions_1.loadResource.call(this, 'vendor');
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          const { oauthTokenData } = (await this.getCredentials('quickBooksOAuth2Api'));
          const companyId = oauthTokenData.callbackQueryString.realmId;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'bill') {
                      if (operation === 'create') {
                          const lines = this.getNodeParameter('Line', i);
                          if (!lines.length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`, { itemIndex: i });
                          }
                          if (lines.some((line) => line.DetailType === undefined ||
                              line.Amount === undefined ||
                              line.Description === undefined)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.', { itemIndex: i });
                          }
                          lines.forEach((line) => {
                              if (line.DetailType === 'AccountBasedExpenseLineDetail' &&
                                  line.accountId === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter an account ID for the associated line.', { itemIndex: i });
                              }
                              else if (line.DetailType === 'ItemBasedExpenseLineDetail' &&
                                  line.itemId === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.', { itemIndex: i });
                              }
                          });
                          let body = {
                              VendorRef: {
                                  value: this.getNodeParameter('VendorRef', i),
                              },
                          };
                          body.Line = GenericFunctions_1.processLines.call(this, body, lines, resource);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'delete') {
                          const qs = {
                              operation: 'delete',
                          };
                          const body = {
                              Id: this.getNodeParameter('billId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const billId = this.getNodeParameter('billId', i);
                          const endpoint = `/v3/company/${companyId}/${resource}/${billId}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'update') {
                          const { ref, syncToken } = await GenericFunctions_1.getRefAndSyncToken.call(this, i, companyId, resource, 'VendorRef');
                          let body = {
                              Id: this.getNodeParameter('billId', i),
                              SyncToken: syncToken,
                              sparse: true,
                              VendorRef: {
                                  name: ref.name,
                                  value: ref.value,
                              },
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
                  else if (resource === 'customer') {
                      if (operation === 'create') {
                          let body = {
                              DisplayName: this.getNodeParameter('displayName', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const customerId = this.getNodeParameter('customerId', i);
                          const endpoint = `/v3/company/${companyId}/${resource}/${customerId}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'update') {
                          let body = {
                              Id: this.getNodeParameter('customerId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                              sparse: true,
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
                  else if (resource === 'employee') {
                      if (operation === 'create') {
                          let body = {
                              FamilyName: this.getNodeParameter('FamilyName', i),
                              GivenName: this.getNodeParameter('GivenName', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const employeeId = this.getNodeParameter('employeeId', i);
                          const endpoint = `/v3/company/${companyId}/${resource}/${employeeId}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'update') {
                          let body = {
                              Id: this.getNodeParameter('employeeId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                              sparse: true,
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
                  else if (resource === 'estimate') {
                      if (operation === 'create') {
                          const lines = this.getNodeParameter('Line', i);
                          if (!lines.length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`, { itemIndex: i });
                          }
                          if (lines.some((line) => line.DetailType === undefined ||
                              line.Amount === undefined ||
                              line.Description === undefined)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.', { itemIndex: i });
                          }
                          lines.forEach((line) => {
                              if (line.DetailType === 'SalesItemLineDetail' && line.itemId === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.', { itemIndex: i });
                              }
                          });
                          let body = {
                              CustomerRef: {
                                  value: this.getNodeParameter('CustomerRef', i),
                              },
                          };
                          body.Line = GenericFunctions_1.processLines.call(this, body, lines, resource);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'delete') {
                          const qs = {
                              operation: 'delete',
                          };
                          const body = {
                              Id: this.getNodeParameter('estimateId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const estimateId = this.getNodeParameter('estimateId', i);
                          const download = this.getNodeParameter('download', i);
                          if (download) {
                              responseData = await GenericFunctions_1.handleBinaryData.call(this, items, i, companyId, resource, estimateId);
                          }
                          else {
                              const endpoint = `/v3/company/${companyId}/${resource}/${estimateId}`;
                              responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                              responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                          }
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'send') {
                          const estimateId = this.getNodeParameter('estimateId', i);
                          const qs = {
                              sendTo: this.getNodeParameter('email', i),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}/${estimateId}/send`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'update') {
                          const { ref, syncToken } = await GenericFunctions_1.getRefAndSyncToken.call(this, i, companyId, resource, 'CustomerRef');
                          let body = {
                              Id: this.getNodeParameter('estimateId', i),
                              SyncToken: syncToken,
                              sparse: true,
                              CustomerRef: {
                                  name: ref.name,
                                  value: ref.value,
                              },
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
                  else if (resource === 'invoice') {
                      if (operation === 'create') {
                          const lines = this.getNodeParameter('Line', i);
                          if (!lines.length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`, { itemIndex: i });
                          }
                          if (lines.some((line) => line.DetailType === undefined ||
                              line.Amount === undefined ||
                              line.Description === undefined)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.', { itemIndex: i });
                          }
                          lines.forEach((line) => {
                              if (line.DetailType === 'SalesItemLineDetail' && line.itemId === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.', { itemIndex: i });
                              }
                          });
                          let body = {
                              CustomerRef: {
                                  value: this.getNodeParameter('CustomerRef', i),
                              },
                          };
                          body.Line = GenericFunctions_1.processLines.call(this, body, lines, resource);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'delete') {
                          const qs = {
                              operation: 'delete',
                          };
                          const body = {
                              Id: this.getNodeParameter('invoiceId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const invoiceId = this.getNodeParameter('invoiceId', i);
                          const download = this.getNodeParameter('download', i);
                          if (download) {
                              responseData = await GenericFunctions_1.handleBinaryData.call(this, items, i, companyId, resource, invoiceId);
                          }
                          else {
                              const endpoint = `/v3/company/${companyId}/${resource}/${invoiceId}`;
                              responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                              responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                          }
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'send') {
                          const invoiceId = this.getNodeParameter('invoiceId', i);
                          const qs = {
                              sendTo: this.getNodeParameter('email', i),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}/${invoiceId}/send`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'update') {
                          const { ref, syncToken } = await GenericFunctions_1.getRefAndSyncToken.call(this, i, companyId, resource, 'CustomerRef');
                          let body = {
                              Id: this.getNodeParameter('invoiceId', i),
                              SyncToken: syncToken,
                              sparse: true,
                              CustomerRef: {
                                  name: ref.name,
                                  value: ref.value,
                              },
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'void') {
                          const qs = {
                              Id: this.getNodeParameter('invoiceId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                              operation: 'void',
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
                  else if (resource === 'item') {
                      if (operation === 'get') {
                          const item = this.getNodeParameter('itemId', i);
                          const endpoint = `/v3/company/${companyId}/${resource}/${item}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                  }
                  else if (resource === 'payment') {
                      if (operation === 'create') {
                          let body = {
                              CustomerRef: {
                                  value: this.getNodeParameter('CustomerRef', i),
                              },
                              TotalAmt: this.getNodeParameter('TotalAmt', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'delete') {
                          const qs = {
                              operation: 'delete',
                          };
                          const body = {
                              Id: this.getNodeParameter('paymentId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const paymentId = this.getNodeParameter('paymentId', i);
                          const download = this.getNodeParameter('download', i);
                          if (download) {
                              responseData = await GenericFunctions_1.handleBinaryData.call(this, items, i, companyId, resource, paymentId);
                          }
                          else {
                              const endpoint = `/v3/company/${companyId}/${resource}/${paymentId}`;
                              responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                              responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                          }
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'send') {
                          const paymentId = this.getNodeParameter('paymentId', i);
                          const qs = {
                              sendTo: this.getNodeParameter('email', i),
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}/${paymentId}/send`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'update') {
                          const { ref, syncToken } = await GenericFunctions_1.getRefAndSyncToken.call(this, i, companyId, resource, 'CustomerRef');
                          let body = {
                              Id: this.getNodeParameter('paymentId', i),
                              SyncToken: syncToken,
                              sparse: true,
                              CustomerRef: {
                                  name: ref.name,
                                  value: ref.value,
                              },
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'void') {
                          const qs = {
                              Id: this.getNodeParameter('paymentId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                              operation: 'void',
                          };
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, qs, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
                  else if (resource === 'purchase') {
                      if (operation === 'get') {
                          const purchaseId = this.getNodeParameter('purchaseId', i);
                          const endpoint = `/v3/company/${companyId}/${resource}/${purchaseId}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                  }
                  else if (resource === 'transaction') {
                      if (operation === 'getReport') {
                          const { columns, memo, term, customer, vendor, ...rest } = this.getNodeParameter('filters', i);
                          let qs = { ...rest };
                          if (columns === null || columns === void 0 ? void 0 : columns.length) {
                              qs.columns = columns.join(',');
                          }
                          if (memo === null || memo === void 0 ? void 0 : memo.length) {
                              qs.memo = memo.join(',');
                          }
                          if (term === null || term === void 0 ? void 0 : term.length) {
                              qs.term = term.join(',');
                          }
                          if (customer === null || customer === void 0 ? void 0 : customer.length) {
                              qs.customer = customer.join(',');
                          }
                          if (vendor === null || vendor === void 0 ? void 0 : vendor.length) {
                              qs.vendor = vendor.join(',');
                          }
                          qs = (0, GenericFunctions_1.adjustTransactionDates)(qs);
                          const endpoint = `/v3/company/${companyId}/reports/TransactionList`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, qs, {});
                          const simplifyResponse = this.getNodeParameter('simple', i, true);
                          if (!Object.keys(responseData === null || responseData === void 0 ? void 0 : responseData.Rows).length) {
                              responseData = [];
                          }
                          if (simplifyResponse && !Array.isArray(responseData)) {
                              responseData = (0, GenericFunctions_1.simplifyTransactionReport)(responseData);
                          }
                      }
                  }
                  else if (resource === 'vendor') {
                      if (operation === 'create') {
                          let body = {
                              DisplayName: this.getNodeParameter('displayName', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          body = GenericFunctions_1.populateFields.call(this, body, additionalFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'get') {
                          const vendorId = this.getNodeParameter('vendorId', i);
                          const endpoint = `/v3/company/${companyId}/${resource}/${vendorId}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                      else if (operation === 'getAll') {
                          const endpoint = `/v3/company/${companyId}/query`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, resource);
                      }
                      else if (operation === 'update') {
                          let body = {
                              Id: this.getNodeParameter('vendorId', i),
                              SyncToken: await GenericFunctions_1.getSyncToken.call(this, i, companyId, resource),
                              sparse: true,
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          body = GenericFunctions_1.populateFields.call(this, body, updateFields, resource);
                          const endpoint = `/v3/company/${companyId}/${resource}`;
                          responseData = await GenericFunctions_1.quickBooksApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData[(0, change_case_1.capitalCase)(resource)];
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const download = this.getNodeParameter('download', 0, false);
                      if (['invoice', 'estimate', 'payment'].includes(resource) &&
                          ['get'].includes(operation) &&
                          download) {
                          if (!responseData) {
                              items[i].json = { error: error.message };
                              responseData = items;
                          }
                          else {
                              responseData[i].json = { error: error.message };
                          }
                      }
                      else {
                          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);
          }
          const download = this.getNodeParameter('download', 0, false);
          if (['invoice', 'estimate', 'payment'].includes(resource) &&
              ['get'].includes(operation) &&
              download) {
              return [responseData];
          }
          else {
              return [returnData];
          }
      }
  }
  exports.QuickBooks = QuickBooks;
  //# sourceMappingURL=QuickBooks.node.js.map

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


node_type: n8n-nodes-base.QuickChart
name: QuickChart
package_name: n8n-nodes-base
display_name: QuickChart
description: Create a chart via QuickChart
code_hash: 236f4209dd03f420a5ab72f3149e71a3c515733d510f60f8c2bc8db5baa6fbb8
source_location: node_modules/n8n-nodes-base/dist/nodes/QuickChart/QuickChart.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.QuickChart = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const constants_1 = require("./constants");
  class QuickChart {
      constructor() {
          this.description = {
              displayName: 'QuickChart',
              name: 'quickChart',
              icon: 'file:quickChart.svg',
              group: ['output'],
              description: 'Create a chart via QuickChart',
              version: 1,
              defaults: {
                  name: 'QuickChart',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Chart Type',
                      name: 'chartType',
                      type: 'options',
                      default: 'bar',
                      options: constants_1.CHART_TYPE_OPTIONS,
                      description: 'The type of chart to create',
                  },
                  {
                      displayName: 'Add Labels',
                      name: 'labelsMode',
                      type: 'options',
                      options: [
                          {
                              name: 'Manually',
                              value: 'manually',
                          },
                          {
                              name: 'From Array',
                              value: 'array',
                          },
                      ],
                      default: 'manually',
                  },
                  {
                      displayName: 'Labels',
                      name: 'labelsUi',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                          sortable: true,
                      },
                      default: {},
                      required: true,
                      description: 'Labels to use in the chart',
                      placeholder: 'Add Label',
                      options: [
                          {
                              name: 'labelsValues',
                              displayName: 'Labels',
                              values: [
                                  {
                                      displayName: 'Label',
                                      name: 'label',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                      displayOptions: {
                          show: {
                              labelsMode: ['manually'],
                          },
                      },
                  },
                  {
                      displayName: 'Labels Array',
                      name: 'labelsArray',
                      type: 'string',
                      required: true,
                      default: '',
                      placeholder: 'e.g. ["Berlin", "Paris", "Rome", "New York"]',
                      displayOptions: {
                          show: {
                              labelsMode: ['array'],
                          },
                      },
                      description: 'The array of labels to be used in the chart',
                  },
                  {
                      displayName: 'Data',
                      name: 'data',
                      type: 'json',
                      default: '',
                      description: 'Data to use for the dataset, documentation and examples <a href="https://quickchart.io/documentation/chart-types/" target="_blank">here</a>',
                      placeholder: 'e.g. [60, 10, 12, 20]',
                      required: true,
                  },
                  {
                      displayName: 'Put Output In Field',
                      name: 'output',
                      type: 'string',
                      default: 'data',
                      required: true,
                      description: 'The binary data will be displayed in the Output panel on the right, under the Binary tab',
                      hint: 'The name of the output field to put the binary file data in',
                  },
                  {
                      displayName: 'Chart Options',
                      name: 'chartOptions',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Background Color',
                              name: 'backgroundColor',
                              type: 'color',
                              typeOptions: {
                                  showAlpha: true,
                              },
                              default: '',
                              description: 'Background color of the chart',
                          },
                          {
                              displayName: 'Device Pixel Ratio',
                              name: 'devicePixelRatio',
                              type: 'number',
                              default: 2,
                              typeOptions: {
                                  minValue: 1,
                                  maxValue: 2,
                              },
                              description: 'Pixel ratio of the chart',
                          },
                          {
                              displayName: 'Format',
                              name: 'format',
                              type: 'options',
                              default: 'png',
                              description: 'File format of the resulting chart',
                              options: [
                                  {
                                      name: 'PNG',
                                      value: 'png',
                                  },
                                  {
                                      name: 'PDF',
                                      value: 'pdf',
                                  },
                                  {
                                      name: 'SVG',
                                      value: 'svg',
                                  },
                                  {
                                      name: 'WebP',
                                      value: 'webp',
                                  },
                              ],
                          },
                          {
                              displayName: 'Height',
                              name: 'height',
                              type: 'number',
                              default: 300,
                              description: 'Height of the chart',
                          },
                          {
                              displayName: 'Horizontal',
                              name: 'horizontal',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the chart should use its Y axis horizontal',
                              displayOptions: {
                                  show: {
                                      '/chartType': constants_1.HORIZONTAL_CHARTS,
                                  },
                              },
                          },
                          {
                              displayName: 'Width',
                              name: 'width',
                              type: 'number',
                              default: 500,
                              description: 'Width of the chart',
                          },
                      ],
                  },
                  {
                      displayName: 'Dataset Options',
                      name: 'datasetOptions',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Background Color',
                              name: 'backgroundColor',
                              type: 'color',
                              default: '',
                              typeOptions: {
                                  showAlpha: true,
                              },
                              description: 'Color used for the background the dataset (area of a line graph, fill of a bar chart, etc.)',
                          },
                          {
                              displayName: 'Border Color',
                              name: 'borderColor',
                              type: 'color',
                              typeOptions: {
                                  showAlpha: true,
                              },
                              default: '',
                              description: 'Color used for lines of the dataset',
                          },
                          {
                              displayName: 'Fill',
                              name: 'fill',
                              type: 'boolean',
                              default: true,
                              description: 'Whether to fill area of the dataset',
                              displayOptions: {
                                  show: {
                                      '/chartType': constants_1.Fill_CHARTS,
                                  },
                              },
                          },
                          {
                              displayName: 'Label',
                              name: 'label',
                              type: 'string',
                              default: '',
                              description: 'The label of the dataset',
                          },
                          {
                              displayName: 'Point Style',
                              name: 'pointStyle',
                              type: 'options',
                              default: 'circle',
                              description: 'Style to use for points of the dataset',
                              options: [
                                  {
                                      name: 'Circle',
                                      value: 'circle',
                                  },
                                  {
                                      name: 'Cross',
                                      value: 'cross',
                                  },
                                  {
                                      name: 'CrossRot',
                                      value: 'crossRot',
                                  },
                                  {
                                      name: 'Dash',
                                      value: 'dash',
                                  },
                                  {
                                      name: 'Line',
                                      value: 'line',
                                  },
                                  {
                                      name: 'Rect',
                                      value: 'rect',
                                  },
                                  {
                                      name: 'Rect Rot',
                                      value: 'rectRot',
                                  },
                                  {
                                      name: 'Rect Rounded',
                                      value: 'rectRounded',
                                  },
                                  {
                                      name: 'Star',
                                      value: 'star',
                                  },
                                  {
                                      name: 'Triangle',
                                      value: 'triangle',
                                  },
                              ],
                              displayOptions: {
                                  show: {
                                      '/chartType': constants_1.POINT_STYLE_CHARTS,
                                  },
                              },
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const datasets = [];
          let chartType = '';
          const labels = [];
          const labelsMode = this.getNodeParameter('labelsMode', 0);
          if (labelsMode === 'manually') {
              const labelsUi = this.getNodeParameter('labelsUi.labelsValues', 0, []);
              if (labelsUi.length) {
                  for (const labelValue of labelsUi) {
                      if (Array.isArray(labelValue.label)) {
                          labels === null || labels === void 0 ? void 0 : labels.push(...labelValue.label);
                      }
                      else {
                          labels === null || labels === void 0 ? void 0 : labels.push(labelValue.label);
                      }
                  }
              }
          }
          else {
              const labelsArray = this.getNodeParameter('labelsArray', 0, '');
              const errorMessage = 'Labels Array is not a valid array, use valid JSON format, or specify it by expressions';
              if (Array.isArray(labelsArray)) {
                  labels.push(...labelsArray);
              }
              else {
                  const labelsArrayParsed = (0, n8n_workflow_1.jsonParse)(labelsArray, {
                      errorMessage,
                  });
                  if (!Array.isArray(labelsArrayParsed)) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorMessage);
                  }
                  labels.push(...labelsArrayParsed);
              }
          }
          for (let i = 0; i < items.length; i++) {
              const data = this.getNodeParameter('data', i);
              const datasetOptions = this.getNodeParameter('datasetOptions', i);
              const backgroundColor = datasetOptions.backgroundColor;
              const borderColor = datasetOptions.borderColor;
              const fill = datasetOptions.fill;
              const label = datasetOptions.label || 'Chart';
              const pointStyle = datasetOptions.pointStyle;
              chartType = this.getNodeParameter('chartType', i);
              if (constants_1.HORIZONTAL_CHARTS.includes(chartType)) {
                  const horizontal = this.getNodeParameter('chartOptions.horizontal', i, false);
                  if (horizontal) {
                      chartType =
                          'horizontal' + chartType[0].toUpperCase() + chartType.substring(1, chartType.length);
                  }
              }
              let pointStyleName = 'pointStyle';
              if (constants_1.ITEM_STYLE_CHARTS.includes(chartType)) {
                  pointStyleName = 'itemStyle';
              }
              datasets.push({
                  label,
                  data,
                  backgroundColor,
                  borderColor,
                  type: chartType,
                  fill,
                  [pointStyleName]: pointStyle,
              });
          }
          const output = this.getNodeParameter('output', 0);
          const chartOptions = this.getNodeParameter('chartOptions', 0);
          const chart = {
              type: chartType,
              data: {
                  labels,
                  datasets,
              },
          };
          const options = {
              method: 'GET',
              url: 'https://quickchart.io/chart',
              qs: {
                  chart: JSON.stringify(chart),
                  ...chartOptions,
              },
              returnFullResponse: true,
              encoding: 'arraybuffer',
              json: false,
          };
          const response = (await this.helpers.httpRequest(options));
          let mimeType = response.headers['content-type'];
          mimeType = mimeType ? mimeType.split(';').find((value) => value.includes('/')) : undefined;
          return [
              [
                  {
                      binary: {
                          [output]: await this.helpers.prepareBinaryData(response.body, undefined, mimeType),
                      },
                      json: { chart },
                  },
              ],
          ];
      }
  }
  exports.QuickChart = QuickChart;
  //# sourceMappingURL=QuickChart.node.js.map

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


node_type: n8n-nodes-base.RabbitMQ
name: RabbitMQ
package_name: n8n-nodes-base
display_name: RabbitMQ
description: Sends messages to a RabbitMQ topic
code_hash: 1dda2f41631a54acedfd4cc856f7f2f752f0ea13171eb2040ae37520390a0f5d
source_location: node_modules/n8n-nodes-base/dist/nodes/RabbitMQ/RabbitMQ.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() { return m[k]; } };
      }
      Object.defineProperty(o, k2, desc);
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  }));
  var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
  }) : function(o, v) {
      o["default"] = v;
  });
  var __importStar = (this && this.__importStar) || function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      __setModuleDefault(result, mod);
      return result;
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RabbitMQ = void 0;
  const amqplib = __importStar(require("amqplib"));
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const utilities_1 = require("../../utils/utilities");
  class RabbitMQ {
      constructor() {
          this.description = {
              displayName: 'RabbitMQ',
              name: 'rabbitmq',
              icon: 'file:rabbitmq.png',
              group: ['transform'],
              version: [1, 1.1],
              description: 'Sends messages to a RabbitMQ topic',
              defaults: {
                  name: 'RabbitMQ',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'rabbitmq',
                      required: true,
                      testedBy: 'rabbitmqConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'hidden',
                      noDataExpression: true,
                      default: 'sendMessage',
                      displayOptions: {
                          show: {
                              '@version': [1],
                          },
                      },
                      options: [
                          {
                              name: 'Send a Message to RabbitMQ',
                              value: 'sendMessage',
                              action: 'Send a Message to RabbitMQ',
                          },
                          {
                              name: 'Delete From Queue',
                              value: 'deleteMessage',
                              action: 'Delete From Queue',
                          },
                      ],
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      default: 'sendMessage',
                      displayOptions: {
                          show: {
                              '@version': [1.1],
                          },
                      },
                      options: [
                          {
                              name: 'Send a Message to RabbitMQ',
                              value: 'sendMessage',
                              action: 'Send a Message to RabbitMQ',
                          },
                          {
                              name: 'Delete From Queue',
                              value: 'deleteMessage',
                              action: 'Delete From Queue',
                          },
                      ],
                  },
                  {
                      displayName: 'Will delete an item from the queue triggered earlier in the workflow by a RabbitMQ Trigger node',
                      name: 'deleteMessage',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['deleteMessage'],
                          },
                      },
                  },
                  {
                      displayName: 'Mode',
                      name: 'mode',
                      type: 'options',
                      displayOptions: {
                          hide: {
                              operation: ['deleteMessage'],
                          },
                      },
                      options: [
                          {
                              name: 'Queue',
                              value: 'queue',
                              description: 'Publish data to queue',
                          },
                          {
                              name: 'Exchange',
                              value: 'exchange',
                              description: 'Publish data to exchange',
                          },
                      ],
                      default: 'queue',
                      description: 'To where data should be moved',
                  },
                  {
                      displayName: 'Queue / Topic',
                      name: 'queue',
                      type: 'string',
                      displayOptions: {
                          show: {
                              mode: ['queue'],
                          },
                          hide: {
                              operation: ['deleteMessage'],
                          },
                      },
                      default: '',
                      placeholder: 'queue-name',
                      description: 'Name of the queue to publish to',
                  },
                  {
                      displayName: 'Exchange',
                      name: 'exchange',
                      type: 'string',
                      displayOptions: {
                          show: {
                              mode: ['exchange'],
                          },
                      },
                      default: '',
                      placeholder: 'exchange-name',
                      description: 'Name of the exchange to publish to',
                  },
                  {
                      displayName: 'Type',
                      name: 'exchangeType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              mode: ['exchange'],
                          },
                      },
                      options: [
                          {
                              name: 'Direct',
                              value: 'direct',
                              description: 'Direct exchange type',
                          },
                          {
                              name: 'Topic',
                              value: 'topic',
                              description: 'Topic exchange type',
                          },
                          {
                              name: 'Headers',
                              value: 'headers',
                              description: 'Headers exchange type',
                          },
                          {
                              name: 'Fanout',
                              value: 'fanout',
                              description: 'Fanout exchange type',
                          },
                      ],
                      default: 'fanout',
                      description: 'Type of exchange',
                  },
                  {
                      displayName: 'Routing Key',
                      name: 'routingKey',
                      type: 'string',
                      displayOptions: {
                          show: {
                              mode: ['exchange'],
                          },
                      },
                      default: '',
                      placeholder: 'routing-key',
                      description: 'The routing key for the message',
                  },
                  {
                      displayName: 'Send Input Data',
                      name: 'sendInputData',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['sendMessage'],
                          },
                      },
                      default: true,
                      description: 'Whether to send the the data the node receives as JSON',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      displayOptions: {
                          show: {
                              sendInputData: [false],
                          },
                      },
                      default: '',
                      description: 'The message to be sent',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['sendMessage'],
                          },
                      },
                      placeholder: 'Add Option',
                      options: [
                          {
                              displayName: 'Alternate Exchange',
                              name: 'alternateExchange',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/mode': ['exchange'],
                                  },
                              },
                              default: '',
                              description: 'An exchange to send messages to if this exchange can’t route them to any queues',
                          },
                          {
                              displayName: 'Arguments',
                              name: 'arguments',
                              placeholder: 'Add Argument',
                              description: 'Arguments to add',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'argument',
                                      displayName: 'Argument',
                                      values: [
                                          {
                                              displayName: 'Key',
                                              name: 'key',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Auto Delete Queue',
                              name: 'autoDelete',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the queue will be deleted when the number of consumers drops to zero',
                          },
                          {
                              displayName: 'Durable',
                              name: 'durable',
                              type: 'boolean',
                              default: true,
                              description: 'Whether the queue will survive broker restarts',
                          },
                          {
                              displayName: 'Exclusive',
                              name: 'exclusive',
                              type: 'boolean',
                              displayOptions: {
                                  show: {
                                      '/mode': ['queue'],
                                  },
                              },
                              default: false,
                              description: 'Whether to scope the queue to the connection',
                          },
                          {
                              displayName: 'Headers',
                              name: 'headers',
                              placeholder: 'Add Header',
                              description: 'Headers to add',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'header',
                                      displayName: 'Header',
                                      values: [
                                          {
                                              displayName: 'Key',
                                              name: 'key',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async rabbitmqConnectionTest(credential) {
                      const credentials = credential.data;
                      try {
                          const credentialKeys = ['hostname', 'port', 'username', 'password', 'vhost'];
                          const credentialData = {};
                          credentialKeys.forEach((key) => {
                              credentialData[key] = credentials[key] === '' ? undefined : credentials[key];
                          });
                          const optsData = {};
                          if (credentials.ssl === true) {
                              credentialData.protocol = 'amqps';
                              optsData.ca =
                                  credentials.ca === ''
                                      ? undefined
                                      : [Buffer.from((0, utilities_1.formatPrivateKey)(credentials.ca))];
                              if (credentials.passwordless === true) {
                                  optsData.cert =
                                      credentials.cert === ''
                                          ? undefined
                                          : Buffer.from((0, utilities_1.formatPrivateKey)(credentials.cert));
                                  optsData.key =
                                      credentials.key === ''
                                          ? undefined
                                          : Buffer.from((0, utilities_1.formatPrivateKey)(credentials.key));
                                  optsData.passphrase =
                                      credentials.passphrase === '' ? undefined : credentials.passphrase;
                                  optsData.credentials = amqplib.credentials.external();
                              }
                          }
                          const connection = await amqplib.connect(credentialData, optsData);
                          await connection.close();
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          let channel, options;
          try {
              const items = this.getInputData();
              const operation = this.getNodeParameter('operation', 0);
              if (operation === 'deleteMessage') {
                  this.sendResponse(items[0].json);
                  return [items];
              }
              const mode = this.getNodeParameter('mode', 0) || 'queue';
              const returnItems = [];
              if (mode === 'queue') {
                  const queue = this.getNodeParameter('queue', 0);
                  options = this.getNodeParameter('options', 0, {});
                  channel = await GenericFunctions_1.rabbitmqConnectQueue.call(this, queue, options);
                  const sendInputData = this.getNodeParameter('sendInputData', 0);
                  let message;
                  const queuePromises = [];
                  for (let i = 0; i < items.length; i++) {
                      if (sendInputData) {
                          message = JSON.stringify(items[i].json);
                      }
                      else {
                          message = this.getNodeParameter('message', i);
                      }
                      let headers = {};
                      if (options.headers &&
                          options.headers.header.length) {
                          const itemOptions = this.getNodeParameter('options', i, {});
                          const additionalHeaders = {};
                          itemOptions.headers.header.forEach((header) => {
                              additionalHeaders[header.key] = header.value;
                          });
                          headers = additionalHeaders;
                      }
                      queuePromises.push(channel.sendToQueue(queue, Buffer.from(message), { headers }));
                  }
                  const promisesResponses = await Promise.allSettled(queuePromises);
                  promisesResponses.forEach((response) => {
                      if (response.status !== 'fulfilled') {
                          if (!this.continueOnFail()) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), response);
                          }
                          else {
                              returnItems.push({
                                  json: {
                                      error: response.reason,
                                  },
                              });
                              return;
                          }
                      }
                      returnItems.push({
                          json: {
                              success: response.value,
                          },
                      });
                  });
                  await channel.close();
                  await channel.connection.close();
              }
              else if (mode === 'exchange') {
                  const exchange = this.getNodeParameter('exchange', 0);
                  const type = this.getNodeParameter('exchangeType', 0);
                  const routingKey = this.getNodeParameter('routingKey', 0);
                  options = this.getNodeParameter('options', 0, {});
                  channel = await GenericFunctions_1.rabbitmqConnectExchange.call(this, exchange, type, options);
                  const sendInputData = this.getNodeParameter('sendInputData', 0);
                  let message;
                  const exchangePromises = [];
                  for (let i = 0; i < items.length; i++) {
                      if (sendInputData) {
                          message = JSON.stringify(items[i].json);
                      }
                      else {
                          message = this.getNodeParameter('message', i);
                      }
                      let headers = {};
                      if (options.headers &&
                          options.headers.header.length) {
                          const itemOptions = this.getNodeParameter('options', i, {});
                          const additionalHeaders = {};
                          itemOptions.headers.header.forEach((header) => {
                              additionalHeaders[header.key] = header.value;
                          });
                          headers = additionalHeaders;
                      }
                      exchangePromises.push(channel.publish(exchange, routingKey, Buffer.from(message), { headers }));
                  }
                  const promisesResponses = await Promise.allSettled(exchangePromises);
                  promisesResponses.forEach((response) => {
                      if (response.status !== 'fulfilled') {
                          if (!this.continueOnFail()) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), response);
                          }
                          else {
                              returnItems.push({
                                  json: {
                                      error: response.reason,
                                  },
                              });
                              return;
                          }
                      }
                      returnItems.push({
                          json: {
                              success: response.value,
                          },
                      });
                  });
                  await channel.close();
                  await channel.connection.close();
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`);
              }
              return [returnItems];
          }
          catch (error) {
              if (channel) {
                  await channel.close();
                  await channel.connection.close();
              }
              throw error;
          }
      }
  }
  exports.RabbitMQ = RabbitMQ;
  //# sourceMappingURL=RabbitMQ.node.js.map

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


node_type: n8n-nodes-base.Raindrop
name: Raindrop
package_name: n8n-nodes-base
display_name: Raindrop
description: Consume the Raindrop API
code_hash: 2ffff5f78e6186206cef24c5dd2e380afdbdc2f5402ccc15b45f49cb45ac263e
source_location: node_modules/n8n-nodes-base/dist/nodes/Raindrop/Raindrop.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.Raindrop = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  const omit_1 = __importDefault(require("lodash/omit"));
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  class Raindrop {
      constructor() {
          this.description = {
              displayName: 'Raindrop',
              name: 'raindrop',
              icon: 'file:raindrop.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Raindrop API',
              defaults: {
                  name: 'Raindrop',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'raindropOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Bookmark',
                              value: 'bookmark',
                          },
                          {
                              name: 'Collection',
                              value: 'collection',
                          },
                          {
                              name: 'Tag',
                              value: 'tag',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'collection',
                  },
                  ...descriptions_1.bookmarkOperations,
                  ...descriptions_1.bookmarkFields,
                  ...descriptions_1.collectionOperations,
                  ...descriptions_1.collectionFields,
                  ...descriptions_1.tagOperations,
                  ...descriptions_1.tagFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCollections() {
                      const responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', '/collections', {}, {});
                      return responseData.items.map((item) => ({
                          name: item.title,
                          value: item._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 === 'bookmark') {
                      if (operation === 'create') {
                          const body = {
                              link: this.getNodeParameter('link', i),
                              collection: {
                                  $id: this.getNodeParameter('collectionId', i),
                              },
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(body, additionalFields);
                          }
                          if (additionalFields.pleaseParse === true) {
                              body.pleaseParse = {};
                              delete additionalFields.pleaseParse;
                          }
                          if (additionalFields.tags) {
                              body.tags = additionalFields.tags.split(',').map((tag) => tag.trim());
                          }
                          const endpoint = '/raindrop';
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'POST', endpoint, {}, body);
                          responseData = responseData.item;
                      }
                      else if (operation === 'delete') {
                          const bookmarkId = this.getNodeParameter('bookmarkId', i);
                          const endpoint = `/raindrop/${bookmarkId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'DELETE', endpoint, {}, {});
                      }
                      else if (operation === 'get') {
                          const bookmarkId = this.getNodeParameter('bookmarkId', i);
                          const endpoint = `/raindrop/${bookmarkId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData.item;
                      }
                      else if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const collectionId = this.getNodeParameter('collectionId', i);
                          const endpoint = `/raindrops/${collectionId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData.items;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'update') {
                          const bookmarkId = this.getNodeParameter('bookmarkId', i);
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          Object.assign(body, updateFields);
                          if (updateFields.collectionId) {
                              body.collection = {
                                  $id: updateFields.collectionId,
                              };
                              delete updateFields.collectionId;
                          }
                          if (updateFields.pleaseParse === true) {
                              body.pleaseParse = {};
                              delete updateFields.pleaseParse;
                          }
                          if (updateFields.tags) {
                              body.tags = updateFields.tags.split(',').map((tag) => tag.trim());
                          }
                          const endpoint = `/raindrop/${bookmarkId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'PUT', endpoint, {}, body);
                          responseData = responseData.item;
                      }
                  }
                  else if (resource === 'collection') {
                      if (operation === 'create') {
                          const body = {
                              title: this.getNodeParameter('title', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(body, additionalFields);
                          }
                          if (additionalFields.cover) {
                              body.cover = [body.cover];
                          }
                          if (additionalFields.parentId) {
                              body['parent.$id'] = parseInt(additionalFields.parentId, 10);
                              delete additionalFields.parentId;
                          }
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'POST', '/collection', {}, body);
                          responseData = responseData.item;
                      }
                      else if (operation === 'delete') {
                          const collectionId = this.getNodeParameter('collectionId', i);
                          const endpoint = `/collection/${collectionId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'DELETE', endpoint, {}, {});
                      }
                      else if (operation === 'get') {
                          const collectionId = this.getNodeParameter('collectionId', i);
                          const endpoint = `/collection/${collectionId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData.item;
                      }
                      else if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const endpoint = this.getNodeParameter('type', i) === 'parent'
                              ? '/collections'
                              : '/collections/childrens';
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData.items;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'update') {
                          const collectionId = this.getNodeParameter('collectionId', i);
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          if (updateFields.parentId) {
                              body['parent.$id'] = parseInt(updateFields.parentId, 10);
                              delete updateFields.parentId;
                          }
                          Object.assign(body, (0, omit_1.default)(updateFields, 'binaryPropertyName'));
                          const endpoint = `/collection/${collectionId}`;
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'PUT', endpoint, {}, body);
                          responseData = responseData.item;
                          if (updateFields.cover) {
                              const binaryPropertyName = updateFields.cover;
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              const formData = {
                                  cover: {
                                      value: dataBuffer,
                                      options: {
                                          filename: binaryData.fileName,
                                          contentType: binaryData.mimeType,
                                      },
                                  },
                              };
                              const requestEndpoint = `/collection/${collectionId}/cover`;
                              responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'PUT', requestEndpoint, {}, {}, { 'Content-Type': 'multipart/form-data', formData });
                              responseData = responseData.item;
                          }
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'get') {
                          const self = this.getNodeParameter('self', i);
                          let endpoint = '/user';
                          if (self === false) {
                              const userId = this.getNodeParameter('userId', i);
                              endpoint += `/${userId}`;
                          }
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData.user;
                      }
                  }
                  else if (resource === 'tag') {
                      if (operation === 'delete') {
                          let endpoint = '/tags';
                          const body = {
                              tags: this.getNodeParameter('tags', i).split(','),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.collectionId) {
                              endpoint += `/${additionalFields.collectionId}`;
                          }
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'DELETE', endpoint, {}, body);
                      }
                      else if (operation === 'getAll') {
                          let endpoint = '/tags';
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filter = this.getNodeParameter('filters', i);
                          if (filter.collectionId) {
                              endpoint += `/${filter.collectionId}`;
                          }
                          responseData = await GenericFunctions_1.raindropApiRequest.call(this, 'GET', endpoint, {}, {});
                          responseData = responseData.items;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                  }
                  Array.isArray(responseData)
                      ? returnData.push(...responseData)
                      : returnData.push(responseData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Raindrop = Raindrop;
  //# sourceMappingURL=Raindrop.node.js.map

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


node_type: n8n-nodes-base.ReadBinaryFile
name: ReadBinaryFile
package_name: n8n-nodes-base
display_name: Read Binary File
description: Reads a binary file from disk
code_hash: b25d91d1c599335bb399ef8f8b87952ebc8706ed057404aa453696513fd035f2
source_location: node_modules/n8n-nodes-base/dist/nodes/ReadBinaryFile/ReadBinaryFile.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ReadBinaryFile = void 0;
  class ReadBinaryFile {
      constructor() {
          this.description = {
              displayName: 'Read Binary File',
              name: 'readBinaryFile',
              icon: 'fa:file-import',
              group: ['input'],
              version: 1,
              hidden: true,
              description: 'Reads a binary file from disk',
              defaults: {
                  name: 'Read Binary File',
                  color: '#449922',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'File Path',
                      name: 'filePath',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: '/data/example.jpg',
                      description: 'Path of the file to read',
                  },
                  {
                      displayName: 'Property Name',
                      name: 'dataPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      description: 'Name of the binary property to which to write the data of the read file',
                  },
              ],
          };
      }
      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 newItem = {
                      json: item.json,
                      binary: {},
                      pairedItem: {
                          item: itemIndex,
                      },
                  };
                  if (item.binary !== undefined && newItem.binary) {
                      Object.assign(newItem.binary, item.binary);
                  }
                  const filePath = this.getNodeParameter('filePath', itemIndex);
                  const stream = await this.helpers.createReadStream(filePath);
                  const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
                  newItem.binary[dataPropertyName] = await this.helpers.prepareBinaryData(stream, filePath);
                  returnData.push(newItem);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.ReadBinaryFile = ReadBinaryFile;
  //# sourceMappingURL=ReadBinaryFile.node.js.map

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


node_type: n8n-nodes-base.ReadBinaryFiles
name: ReadBinaryFiles
package_name: n8n-nodes-base
display_name: Read Binary Files
description: Reads binary files from disk
code_hash: b4e758feeb596d9a366840a789ede02f9592fdf23b6da29d0e7fe3a49053ac85
source_location: node_modules/n8n-nodes-base/dist/nodes/ReadBinaryFiles/ReadBinaryFiles.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.ReadBinaryFiles = void 0;
  const fast_glob_1 = __importDefault(require("fast-glob"));
  const utilities_1 = require("../../utils/utilities");
  class ReadBinaryFiles {
      constructor() {
          this.description = {
              displayName: 'Read Binary Files',
              name: 'readBinaryFiles',
              icon: 'fa:file-import',
              group: ['input'],
              version: 1,
              description: 'Reads binary files from disk',
              defaults: {
                  name: 'Read Binary Files',
                  color: '#44AA44',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'File Selector',
                      name: 'fileSelector',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: '*.jpg',
                      description: 'Pattern for files to read',
                  },
                  {
                      displayName: 'Property Name',
                      name: 'dataPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      description: 'Name of the binary property to which to write the data of the read files',
                  },
              ],
          };
      }
      async execute() {
          const fileSelector = this.getNodeParameter('fileSelector', 0);
          const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
          const pairedItem = (0, utilities_1.generatePairedItemData)(this.getInputData().length);
          const files = await (0, fast_glob_1.default)(fileSelector);
          const items = [];
          for (const filePath of files) {
              const stream = await this.helpers.createReadStream(filePath);
              items.push({
                  binary: {
                      [dataPropertyName]: await this.helpers.prepareBinaryData(stream, filePath),
                  },
                  json: {},
                  pairedItem,
              });
          }
          return [items];
      }
  }
  exports.ReadBinaryFiles = ReadBinaryFiles;
  //# sourceMappingURL=ReadBinaryFiles.node.js.map

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


node_type: n8n-nodes-base.Reddit
name: Reddit
package_name: n8n-nodes-base
display_name: Reddit
description: Consume the Reddit API
code_hash: 14ac2bd275d17b8cf9b5ac74cb57392dbf4f15c37e180153e8f3be4a55aedd77
source_location: node_modules/n8n-nodes-base/dist/nodes/Reddit/Reddit.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Reddit = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const PostCommentDescription_1 = require("./PostCommentDescription");
  const PostDescription_1 = require("./PostDescription");
  const ProfileDescription_1 = require("./ProfileDescription");
  const SubredditDescription_1 = require("./SubredditDescription");
  const UserDescription_1 = require("./UserDescription");
  class Reddit {
      constructor() {
          this.description = {
              displayName: 'Reddit',
              name: 'reddit',
              icon: 'file:reddit.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Reddit API',
              defaults: {
                  name: 'Reddit',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'redditOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['postComment', 'post', 'profile'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Post',
                              value: 'post',
                          },
                          {
                              name: 'Post Comment',
                              value: 'postComment',
                          },
                          {
                              name: 'Profile',
                              value: 'profile',
                          },
                          {
                              name: 'Subreddit',
                              value: 'subreddit',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'post',
                  },
                  ...PostCommentDescription_1.postCommentOperations,
                  ...PostCommentDescription_1.postCommentFields,
                  ...ProfileDescription_1.profileOperations,
                  ...ProfileDescription_1.profileFields,
                  ...SubredditDescription_1.subredditOperations,
                  ...SubredditDescription_1.subredditFields,
                  ...PostDescription_1.postOperations,
                  ...PostDescription_1.postFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
              ],
          };
      }
      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 === 'post') {
                      if (operation === 'create') {
                          const qs = {
                              title: this.getNodeParameter('title', i),
                              sr: this.getNodeParameter('subreddit', i),
                              kind: this.getNodeParameter('kind', i),
                          };
                          qs.kind === 'self'
                              ? (qs.text = this.getNodeParameter('text', i))
                              : (qs.url = this.getNodeParameter('url', i));
                          if (qs.url) {
                              qs.resubmit = this.getNodeParameter('resubmit', i);
                          }
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/submit', qs);
                          responseData = responseData.json.data;
                      }
                      else if (operation === 'delete') {
                          const postTypePrefix = 't3_';
                          const qs = {
                              id: postTypePrefix + this.getNodeParameter('postId', i),
                          };
                          await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/del', qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          const postId = this.getNodeParameter('postId', i);
                          const endpoint = `r/${subreddit}/comments/${postId}.json`;
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                          responseData = responseData[0].data.children[0].data;
                      }
                      else if (operation === 'getAll') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          let endpoint = `r/${subreddit}.json`;
                          const { category } = this.getNodeParameter('filters', i);
                          if (category) {
                              endpoint = `r/${subreddit}/${category}.json`;
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint);
                      }
                      else if (operation === 'search') {
                          const location = this.getNodeParameter('location', i);
                          const qs = {
                              q: this.getNodeParameter('keyword', i),
                              restrict_sr: location === 'subreddit',
                          };
                          const { sort } = this.getNodeParameter('additionalFields', i);
                          if (sort) {
                              qs.sort = sort;
                          }
                          let endpoint = '';
                          if (location === 'allReddit') {
                              endpoint = 'search.json';
                          }
                          else {
                              const subreddit = this.getNodeParameter('subreddit', i);
                              endpoint = `r/${subreddit}/search.json`;
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, qs);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                  }
                  else if (resource === 'postComment') {
                      if (operation === 'create') {
                          const postTypePrefix = 't3_';
                          const qs = {
                              text: this.getNodeParameter('commentText', i),
                              thing_id: postTypePrefix + this.getNodeParameter('postId', i),
                          };
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/comment', qs);
                          responseData = responseData.json.data.things[0].data;
                      }
                      else if (operation === 'getAll') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          const postId = this.getNodeParameter('postId', i);
                          const endpoint = `r/${subreddit}/comments/${postId}.json`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint);
                      }
                      else if (operation === 'delete') {
                          const commentTypePrefix = 't1_';
                          const qs = {
                              id: commentTypePrefix + this.getNodeParameter('commentId', i),
                          };
                          await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/del', qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'reply') {
                          const commentTypePrefix = 't1_';
                          const qs = {
                              text: this.getNodeParameter('replyText', i),
                              thing_id: commentTypePrefix + this.getNodeParameter('commentId', i),
                          };
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/comment', qs);
                          responseData = responseData.json.data.things[0].data;
                      }
                  }
                  else if (resource === 'profile') {
                      if (operation === 'get') {
                          const endpoints = {
                              identity: 'me',
                              blockedUsers: 'me/blocked',
                              friends: 'me/friends',
                              karma: 'me/karma',
                              prefs: 'me/prefs',
                              trophies: 'me/trophies',
                          };
                          const details = this.getNodeParameter('details', i);
                          const endpoint = `api/v1/${endpoints[details]}`;
                          let username;
                          if (details === 'saved') {
                              ({ name: username } = await GenericFunctions_1.redditApiRequest.call(this, 'GET', 'api/v1/me', {}));
                          }
                          responseData =
                              details === 'saved'
                                  ? await GenericFunctions_1.handleListing.call(this, i, `user/${username}/saved.json`)
                                  : await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                          if (details === 'identity') {
                              responseData = responseData.features;
                          }
                          else if (details === 'friends') {
                              responseData = responseData.data.children;
                              if (!responseData.length) {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData);
                              }
                          }
                          else if (details === 'karma') {
                              responseData = responseData.data;
                              if (!responseData.length) {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData);
                              }
                          }
                          else if (details === 'trophies') {
                              responseData = responseData.data.trophies.map((trophy) => trophy.data);
                          }
                      }
                  }
                  else if (resource === 'subreddit') {
                      if (operation === 'get') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          const content = this.getNodeParameter('content', i);
                          const endpoint = `r/${subreddit}/about/${content}.json`;
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                          if (content === 'rules') {
                              responseData = responseData.rules;
                          }
                          else if (content === 'about') {
                              responseData = responseData.data;
                          }
                      }
                      else if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i);
                          if (filters.trending) {
                              const returnAll = this.getNodeParameter('returnAll', 0);
                              const endpoint = 'api/trending_subreddits.json';
                              responseData = await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                              responseData = responseData.subreddit_names.map((name) => ({ name }));
                              if (!returnAll) {
                                  const limit = this.getNodeParameter('limit', 0);
                                  responseData = responseData.splice(0, limit);
                              }
                          }
                          else if (filters.keyword) {
                              const qs = {};
                              qs.query = filters.keyword;
                              const endpoint = 'api/search_subreddits.json';
                              responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', endpoint, qs);
                              const returnAll = this.getNodeParameter('returnAll', 0);
                              if (!returnAll) {
                                  const limit = this.getNodeParameter('limit', 0);
                                  responseData = responseData.subreddits.splice(0, limit);
                              }
                          }
                          else {
                              const endpoint = 'r/subreddits.json';
                              responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint);
                          }
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'get') {
                          const username = this.getNodeParameter('username', i);
                          const details = this.getNodeParameter('details', i);
                          const endpoint = `user/${username}/${details}.json`;
                          responseData =
                              details === 'about'
                                  ? await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {})
                                  : await GenericFunctions_1.handleListing.call(this, i, endpoint);
                          if (details === 'about') {
                              responseData = responseData.data;
                          }
                      }
                  }
                  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.Reddit = Reddit;
  //# sourceMappingURL=Reddit.node.js.map

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


node_type: n8n-nodes-base.Redis
name: Redis
package_name: n8n-nodes-base
display_name: Redis
description: Get, send and update data in Redis
code_hash: facd578480f0b4acbbb4acf818dd36df1b1e4881ba29a0ed7eb649e08c5205d7
source_location: node_modules/n8n-nodes-base/dist/nodes/Redis/Redis.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.Redis = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const set_1 = __importDefault(require("lodash/set"));
  const redis_1 = __importDefault(require("redis"));
  const util_1 = __importDefault(require("util"));
  class Redis {
      constructor() {
          this.description = {
              displayName: 'Redis',
              name: 'redis',
              icon: 'file:redis.svg',
              group: ['input'],
              version: 1,
              description: 'Get, send and update data in Redis',
              defaults: {
                  name: 'Redis',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'redis',
                      required: true,
                      testedBy: 'redisConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a key from Redis',
                              action: 'Delete a key from Redis',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the value of a key from Redis',
                              action: 'Get the value of a key from Redis',
                          },
                          {
                              name: 'Increment',
                              value: 'incr',
                              description: 'Atomically increments a key by 1. Creates the key if it does not exist.',
                              action: 'Atomically increment a key by 1. Creates the key if it does not exist.',
                          },
                          {
                              name: 'Info',
                              value: 'info',
                              description: 'Returns generic information about the Redis instance',
                              action: 'Return generic information about the Redis instance',
                          },
                          {
                              name: 'Keys',
                              value: 'keys',
                              description: 'Returns all the keys matching a pattern',
                              action: 'Return all keys matching a pattern',
                          },
                          {
                              name: 'Pop',
                              value: 'pop',
                              description: 'Pop data from a redis list',
                              action: 'Pop data from a redis list',
                          },
                          {
                              name: 'Publish',
                              value: 'publish',
                              description: 'Publish message to redis channel',
                              action: 'Publish message to redis channel',
                          },
                          {
                              name: 'Push',
                              value: 'push',
                              description: 'Push data to a redis list',
                              action: 'Push data to a redis list',
                          },
                          {
                              name: 'Set',
                              value: 'set',
                              description: 'Set the value of a key in redis',
                              action: 'Set the value of a key in redis',
                          },
                      ],
                      default: 'info',
                  },
                  {
                      displayName: 'Name',
                      name: 'propertyName',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      default: 'propertyName',
                      required: true,
                      description: 'Name of the property to write received data to. Supports dot-notation. Example: "data.person[0].name".',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['delete'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to delete from Redis',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to get from Redis',
                  },
                  {
                      displayName: 'Key Type',
                      name: 'keyType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      options: [
                          {
                              name: 'Automatic',
                              value: 'automatic',
                              description: 'Requests the type before requesting the data (slower)',
                          },
                          {
                              name: 'Hash',
                              value: 'hash',
                              description: "Data in key is of type 'hash'",
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: "Data in key is of type 'lists'",
                          },
                          {
                              name: 'Sets',
                              value: 'sets',
                              description: "Data in key is of type 'sets'",
                          },
                          {
                              name: 'String',
                              value: 'string',
                              description: "Data in key is of type 'string'",
                          },
                      ],
                      default: 'automatic',
                      description: 'The type of the key to get',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Dot Notation',
                              name: 'dotNotation',
                              type: 'boolean',
                              default: true,
                              description: '<p>By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.<p></p>If that is not intended this can be deactivated, it will then set { "a.b": value } instead.</p>.',
                          },
                      ],
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['incr'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to increment',
                  },
                  {
                      displayName: 'Expire',
                      name: 'expire',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['incr'],
                          },
                      },
                      default: false,
                      description: 'Whether to set a timeout on key',
                  },
                  {
                      displayName: 'TTL',
                      name: 'ttl',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              operation: ['incr'],
                              expire: [true],
                          },
                      },
                      default: 60,
                      description: 'Number of seconds before key expiration',
                  },
                  {
                      displayName: 'Key Pattern',
                      name: 'keyPattern',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['keys'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'The key pattern for the keys to return',
                  },
                  {
                      displayName: 'Get Values',
                      name: 'getValues',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['keys'],
                          },
                      },
                      default: true,
                      description: 'Whether to get the value of matching keys',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to set in Redis',
                  },
                  {
                      displayName: 'Value',
                      name: 'value',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      default: '',
                      description: 'The value to write in Redis',
                  },
                  {
                      displayName: 'Key Type',
                      name: 'keyType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      options: [
                          {
                              name: 'Automatic',
                              value: 'automatic',
                              description: 'Tries to figure out the type automatically depending on the data',
                          },
                          {
                              name: 'Hash',
                              value: 'hash',
                              description: "Data in key is of type 'hash'",
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: "Data in key is of type 'lists'",
                          },
                          {
                              name: 'Sets',
                              value: 'sets',
                              description: "Data in key is of type 'sets'",
                          },
                          {
                              name: 'String',
                              value: 'string',
                              description: "Data in key is of type 'string'",
                          },
                      ],
                      default: 'automatic',
                      description: 'The type of the key to set',
                  },
                  {
                      displayName: 'Value Is JSON',
                      name: 'valueIsJSON',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              keyType: ['hash'],
                          },
                      },
                      default: true,
                      description: 'Whether the value is JSON or key value pairs',
                  },
                  {
                      displayName: 'Expire',
                      name: 'expire',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      default: false,
                      description: 'Whether to set a timeout on key',
                  },
                  {
                      displayName: 'TTL',
                      name: 'ttl',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              operation: ['set'],
                              expire: [true],
                          },
                      },
                      default: 60,
                      description: 'Number of seconds before key expiration',
                  },
                  {
                      displayName: 'Channel',
                      name: 'channel',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['publish'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Channel name',
                  },
                  {
                      displayName: 'Data',
                      name: 'messageData',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['publish'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Data to publish',
                  },
                  {
                      displayName: 'List',
                      name: 'list',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['push', 'pop'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the list in Redis',
                  },
                  {
                      displayName: 'Data',
                      name: 'messageData',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['push'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Data to push',
                  },
                  {
                      displayName: 'Tail',
                      name: 'tail',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['push', 'pop'],
                          },
                      },
                      default: false,
                      description: 'Whether to push or pop data from the end of the list',
                  },
                  {
                      displayName: 'Name',
                      name: 'propertyName',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['pop'],
                          },
                      },
                      default: 'propertyName',
                      description: 'Optional name of the property to write received data to. Supports dot-notation. Example: "data.person[0].name".',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              operation: ['pop'],
                          },
                      },
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Dot Notation',
                              name: 'dotNotation',
                              type: 'boolean',
                              default: true,
                              description: '<p>By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.<p></p>If that is not intended this can be deactivated, it will then set { "a.b": value } instead.</p>.',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async redisConnectionTest(credential) {
                      const credentials = credential.data;
                      const redisOptions = {
                          host: credentials.host,
                          port: credentials.port,
                          db: credentials.database,
                      };
                      if (credentials.password) {
                          redisOptions.password = credentials.password;
                      }
                      try {
                          const client = redis_1.default.createClient(redisOptions);
                          await new Promise((resolve, reject) => {
                              client.on('connect', async () => {
                                  client.ping('ping', (error, pong) => {
                                      if (error)
                                          reject(error);
                                      resolve(pong);
                                      client.quit();
                                  });
                              });
                              client.on('error', async (err) => {
                                  client.quit();
                                  reject(err);
                              });
                          });
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          function getParsedValue(value) {
              if (value.match(/^[\d\.]+$/) === null) {
                  return value;
              }
              else {
                  return parseFloat(value);
              }
          }
          function convertInfoToObject(stringData) {
              const returnData = {};
              let key, value;
              for (const line of stringData.split('\n')) {
                  if (['#', ''].includes(line.charAt(0))) {
                      continue;
                  }
                  [key, value] = line.split(':');
                  if (key === undefined || value === undefined) {
                      continue;
                  }
                  value = value.trim();
                  if (value.includes('=')) {
                      returnData[key] = {};
                      let key2, value2;
                      for (const keyValuePair of value.split(',')) {
                          [key2, value2] = keyValuePair.split('=');
                          returnData[key][key2] = getParsedValue(value2);
                      }
                  }
                  else {
                      returnData[key] = getParsedValue(value);
                  }
              }
              return returnData;
          }
          async function getValue(client, keyName, type) {
              if (type === undefined || type === 'automatic') {
                  const clientType = util_1.default.promisify(client.type).bind(client);
                  type = await clientType(keyName);
              }
              if (type === 'string') {
                  const clientGet = util_1.default.promisify(client.get).bind(client);
                  return clientGet(keyName);
              }
              else if (type === 'hash') {
                  const clientHGetAll = util_1.default.promisify(client.hgetall).bind(client);
                  return clientHGetAll(keyName);
              }
              else if (type === 'list') {
                  const clientLRange = util_1.default.promisify(client.lrange).bind(client);
                  return clientLRange(keyName, 0, -1);
              }
              else if (type === 'sets') {
                  const clientSMembers = util_1.default.promisify(client.smembers).bind(client);
                  return clientSMembers(keyName);
              }
          }
          const setValue = async (client, keyName, value, expire, ttl, type, valueIsJSON) => {
              if (type === undefined || type === 'automatic') {
                  if (typeof value === 'string') {
                      type = 'string';
                  }
                  else if (Array.isArray(value)) {
                      type = 'list';
                  }
                  else if (typeof value === 'object') {
                      type = 'hash';
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not identify the type to set. Please set it manually!');
                  }
              }
              if (type === 'string') {
                  const clientSet = util_1.default.promisify(client.set).bind(client);
                  await clientSet(keyName, value.toString());
              }
              else if (type === 'hash') {
                  const clientHset = util_1.default.promisify(client.hset).bind(client);
                  if (valueIsJSON) {
                      let values;
                      if (typeof value === 'string') {
                          try {
                              values = JSON.parse(value);
                          }
                          catch {
                              values = value;
                          }
                      }
                      else {
                          values = value;
                      }
                      for (const key of Object.keys(values)) {
                          await clientHset(keyName, key, values[key].toString());
                      }
                  }
                  else {
                      const values = value.toString().split(' ');
                      await clientHset(keyName, values);
                  }
              }
              else if (type === 'list') {
                  const clientLset = util_1.default.promisify(client.lset).bind(client);
                  for (let index = 0; index < value.length; index++) {
                      await clientLset(keyName, index, value[index].toString());
                  }
              }
              else if (type === 'sets') {
                  const clientSadd = util_1.default.promisify(client.sadd).bind(client);
                  await clientSadd(keyName, value);
              }
              if (expire) {
                  const clientExpire = util_1.default.promisify(client.expire).bind(client);
                  await clientExpire(keyName, ttl);
              }
              return;
          };
          return new Promise(async (resolve, reject) => {
              const credentials = await this.getCredentials('redis');
              const redisOptions = {
                  host: credentials.host,
                  port: credentials.port,
                  db: credentials.database,
              };
              if (credentials.password) {
                  redisOptions.password = credentials.password;
              }
              const client = redis_1.default.createClient(redisOptions);
              const operation = this.getNodeParameter('operation', 0);
              client.on('error', (err) => {
                  client.quit();
                  reject(err);
              });
              client.on('ready', async (_err) => {
                  client.select(credentials.database);
                  try {
                      if (operation === 'info') {
                          const clientInfo = util_1.default.promisify(client.info).bind(client);
                          const result = await clientInfo();
                          resolve([[{ json: convertInfoToObject(result) }]]);
                          client.quit();
                      }
                      else if (['delete', 'get', 'keys', 'set', 'incr', 'publish', 'push', 'pop'].includes(operation)) {
                          const items = this.getInputData();
                          const returnItems = [];
                          let item;
                          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
                              item = { json: {} };
                              if (operation === 'delete') {
                                  const keyDelete = this.getNodeParameter('key', itemIndex);
                                  const clientDel = util_1.default.promisify(client.del).bind(client);
                                  await clientDel(keyDelete);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'get') {
                                  const propertyName = this.getNodeParameter('propertyName', itemIndex);
                                  const keyGet = this.getNodeParameter('key', itemIndex);
                                  const keyType = this.getNodeParameter('keyType', itemIndex);
                                  const value = (await getValue(client, keyGet, keyType)) || null;
                                  const options = this.getNodeParameter('options', itemIndex, {});
                                  if (options.dotNotation === false) {
                                      item.json[propertyName] = value;
                                  }
                                  else {
                                      (0, set_1.default)(item.json, propertyName, value);
                                  }
                                  returnItems.push(item);
                              }
                              else if (operation === 'keys') {
                                  const keyPattern = this.getNodeParameter('keyPattern', itemIndex);
                                  const getValues = this.getNodeParameter('getValues', itemIndex, true);
                                  const clientKeys = util_1.default.promisify(client.keys).bind(client);
                                  const keys = await clientKeys(keyPattern);
                                  if (!getValues) {
                                      returnItems.push({ json: { keys } });
                                      continue;
                                  }
                                  const promises = {};
                                  for (const keyName of keys) {
                                      promises[keyName] = await getValue(client, keyName);
                                  }
                                  for (const keyName of keys) {
                                      item.json[keyName] = await promises[keyName];
                                  }
                                  returnItems.push(item);
                              }
                              else if (operation === 'set') {
                                  const keySet = this.getNodeParameter('key', itemIndex);
                                  const value = this.getNodeParameter('value', itemIndex);
                                  const keyType = this.getNodeParameter('keyType', itemIndex);
                                  const valueIsJSON = this.getNodeParameter('valueIsJSON', itemIndex, true);
                                  const expire = this.getNodeParameter('expire', itemIndex, false);
                                  const ttl = this.getNodeParameter('ttl', itemIndex, -1);
                                  await setValue(client, keySet, value, expire, ttl, keyType, valueIsJSON);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'incr') {
                                  const keyIncr = this.getNodeParameter('key', itemIndex);
                                  const expire = this.getNodeParameter('expire', itemIndex, false);
                                  const ttl = this.getNodeParameter('ttl', itemIndex, -1);
                                  const clientIncr = util_1.default.promisify(client.incr).bind(client);
                                  const incrementVal = await clientIncr(keyIncr);
                                  if (expire && ttl > 0) {
                                      const clientExpire = util_1.default.promisify(client.expire).bind(client);
                                      await clientExpire(keyIncr, ttl);
                                  }
                                  returnItems.push({ json: { [keyIncr]: incrementVal } });
                              }
                              else if (operation === 'publish') {
                                  const channel = this.getNodeParameter('channel', itemIndex);
                                  const messageData = this.getNodeParameter('messageData', itemIndex);
                                  const clientPublish = util_1.default.promisify(client.publish).bind(client);
                                  await clientPublish(channel, messageData);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'push') {
                                  const redisList = this.getNodeParameter('list', itemIndex);
                                  const messageData = this.getNodeParameter('messageData', itemIndex);
                                  const tail = this.getNodeParameter('tail', itemIndex, false);
                                  const action = tail ? client.RPUSH : client.LPUSH;
                                  const clientPush = util_1.default.promisify(action).bind(client);
                                  await clientPush(redisList, messageData);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'pop') {
                                  const redisList = this.getNodeParameter('list', itemIndex);
                                  const tail = this.getNodeParameter('tail', itemIndex, false);
                                  const propertyName = this.getNodeParameter('propertyName', itemIndex, 'propertyName');
                                  const action = tail ? client.rpop : client.lpop;
                                  const clientPop = util_1.default.promisify(action).bind(client);
                                  const value = await clientPop(redisList);
                                  let outputValue;
                                  try {
                                      outputValue = JSON.parse(value);
                                  }
                                  catch {
                                      outputValue = value;
                                  }
                                  const options = this.getNodeParameter('options', itemIndex, {});
                                  if (options.dotNotation === false) {
                                      item.json[propertyName] = outputValue;
                                  }
                                  else {
                                      (0, set_1.default)(item.json, propertyName, outputValue);
                                  }
                                  returnItems.push(item);
                              }
                          }
                          client.quit();
                          resolve([returnItems]);
                      }
                  }
                  catch (error) {
                      reject(error);
                  }
              });
          });
      }
  }
  exports.Redis = Redis;
  //# sourceMappingURL=Redis.node.js.map

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


node_type: n8n-nodes-base.RenameKeys
name: RenameKeys
package_name: n8n-nodes-base
display_name: Rename Keys
description: Renames keys
code_hash: 0708fae996ab278764a6b7528a635e8ce4b932769bffade386bf72d7d3ebeadd
source_location: node_modules/n8n-nodes-base/dist/nodes/RenameKeys/RenameKeys.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.RenameKeys = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const get_1 = __importDefault(require("lodash/get"));
  const set_1 = __importDefault(require("lodash/set"));
  const unset_1 = __importDefault(require("lodash/unset"));
  class RenameKeys {
      constructor() {
          this.description = {
              displayName: 'Rename Keys',
              name: 'renameKeys',
              icon: 'fa:edit',
              group: ['transform'],
              version: 1,
              description: 'Renames keys',
              defaults: {
                  name: 'Rename Keys',
                  color: '#772244',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Keys',
                      name: 'keys',
                      placeholder: 'Add new key',
                      description: 'Adds a key which should be renamed',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                          sortable: true,
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Key',
                              name: 'key',
                              values: [
                                  {
                                      displayName: 'Current Key Name',
                                      name: 'currentKey',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'currentKey',
                                      requiresDataPath: 'single',
                                      description: 'The current name of the key. It is also possible to define deep keys by using dot-notation like for example: "level1.level2.currentKey".',
                                  },
                                  {
                                      displayName: 'New Key Name',
                                      name: 'newKey',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'newKey',
                                      description: 'The name the key should be renamed to. It is also possible to define deep keys by using dot-notation like for example: "level1.level2.newKey".',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Options',
                      name: 'additionalOptions',
                      type: 'collection',
                      default: {},
                      placeholder: 'Add Option',
                      options: [
                          {
                              displayName: 'Regex',
                              name: 'regexReplacement',
                              placeholder: 'Add new regular expression',
                              description: 'Adds a regular expressiond',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                                  sortable: true,
                              },
                              default: {},
                              options: [
                                  {
                                      displayName: 'Replacement',
                                      name: 'replacements',
                                      values: [
                                          {
                                              displayName: 'Be aware that by using regular expression previously renamed keys can be affected',
                                              name: 'regExNotice',
                                              type: 'notice',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Regular Expression',
                                              name: 'searchRegex',
                                              type: 'string',
                                              default: '',
                                              placeholder: 'e.g. [N-n]ame',
                                              description: 'Regex to match the key name',
                                              hint: 'Learn more and test RegEx <a href="https://regex101.com/">here</a>',
                                          },
                                          {
                                              displayName: 'Replace With',
                                              name: 'replaceRegex',
                                              type: 'string',
                                              default: '',
                                              placeholder: 'replacedName',
                                              description: "The name the key/s should be renamed to. It's possible to use regex captures e.g. $1, $2, ...",
                                          },
                                          {
                                              displayName: 'Options',
                                              name: 'options',
                                              type: 'collection',
                                              default: {},
                                              placeholder: 'Add Regex Option',
                                              options: [
                                                  {
                                                      displayName: 'Case Insensitive',
                                                      name: 'caseInsensitive',
                                                      type: 'boolean',
                                                      description: 'Whether to use case insensitive match',
                                                      default: false,
                                                  },
                                                  {
                                                      displayName: 'Max Depth',
                                                      name: 'depth',
                                                      type: 'number',
                                                      default: -1,
                                                      description: 'Maximum depth to replace keys',
                                                      hint: 'Specify number for depth level (-1 for unlimited, 0 for top level only)',
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let item;
          let newItem;
          let renameKeys;
          let value;
          const renameKey = (key) => {
              if (key.currentKey === '' || key.newKey === '' || key.currentKey === key.newKey) {
                  return;
              }
              value = (0, get_1.default)(item.json, key.currentKey);
              if (value === undefined) {
                  return;
              }
              (0, set_1.default)(newItem.json, key.newKey, value);
              (0, unset_1.default)(newItem.json, key.currentKey);
          };
          const regexReplaceKey = (replacement) => {
              const { searchRegex, replaceRegex, options } = replacement;
              const { depth, caseInsensitive } = options;
              const flags = caseInsensitive ? 'i' : undefined;
              const regex = new RegExp(searchRegex, flags);
              const renameObjectKeys = (obj, objDepth) => {
                  for (const key in obj) {
                      if (Array.isArray(obj)) {
                          if (objDepth !== 0) {
                              renameObjectKeys(obj[key], objDepth - 1);
                          }
                      }
                      else if (obj.hasOwnProperty(key)) {
                          if (typeof obj[key] === 'object' && objDepth !== 0) {
                              renameObjectKeys(obj[key], objDepth - 1);
                          }
                          if (key.match(regex)) {
                              const newKey = key.replace(regex, replaceRegex);
                              if (newKey !== key) {
                                  obj[newKey] = obj[key];
                                  delete obj[key];
                              }
                          }
                      }
                  }
                  return obj;
              };
              newItem.json = renameObjectKeys(newItem.json, depth);
          };
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              renameKeys = this.getNodeParameter('keys.key', itemIndex, []);
              const regexReplacements = this.getNodeParameter('additionalOptions.regexReplacement.replacements', itemIndex, []);
              item = items[itemIndex];
              newItem = {
                  json: (0, n8n_workflow_1.deepCopy)(item.json),
                  pairedItem: {
                      item: itemIndex,
                  },
              };
              if (item.binary !== undefined) {
                  newItem.binary = item.binary;
              }
              renameKeys.forEach(renameKey);
              regexReplacements.forEach(regexReplaceKey);
              returnData.push(newItem);
          }
          return [returnData];
      }
  }
  exports.RenameKeys = RenameKeys;
  //# sourceMappingURL=RenameKeys.node.js.map

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


node_type: n8n-nodes-base.RespondToWebhook
name: RespondToWebhook
package_name: n8n-nodes-base
display_name: Respond to Webhook
description: Returns data for Webhook
code_hash: 95d3ea6eec3f2182949cb94764aaafedbf727bc3b52e721ca5e1f7f81734501b
source_location: node_modules/n8n-nodes-base/dist/nodes/RespondToWebhook/RespondToWebhook.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RespondToWebhook = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  class RespondToWebhook {
      constructor() {
          this.description = {
              displayName: 'Respond to Webhook',
              icon: 'file:webhook.svg',
              name: 'respondToWebhook',
              group: ['transform'],
              version: 1,
              description: 'Returns data for Webhook',
              defaults: {
                  name: 'Respond to Webhook',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [],
              properties: [
                  {
                      displayName: 'Respond With',
                      name: 'respondWith',
                      type: 'options',
                      options: [
                          {
                              name: 'Binary',
                              value: 'binary',
                          },
                          {
                              name: 'First Incoming Item',
                              value: 'firstIncomingItem',
                          },
                          {
                              name: 'JSON',
                              value: 'json',
                          },
                          {
                              name: 'No Data',
                              value: 'noData',
                          },
                          {
                              name: 'Text',
                              value: 'text',
                          },
                      ],
                      default: 'firstIncomingItem',
                      description: 'The data that should be returned',
                  },
                  {
                      displayName: 'When using expressions, note that this node will only run for the first item in the input data.',
                      name: 'webhookNotice',
                      type: 'notice',
                      displayOptions: {
                          show: {
                              respondWith: ['json', 'text'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Response Body',
                      name: 'responseBody',
                      type: 'json',
                      displayOptions: {
                          show: {
                              respondWith: ['json'],
                          },
                      },
                      default: '',
                      placeholder: '{ "key": "value" }',
                      description: 'The HTTP Response JSON data',
                  },
                  {
                      displayName: 'Response Body',
                      name: 'responseBody',
                      type: 'string',
                      displayOptions: {
                          show: {
                              respondWith: ['text'],
                          },
                      },
                      default: '',
                      placeholder: 'e.g. Workflow started',
                      description: 'The HTTP Response text data',
                  },
                  {
                      displayName: 'Response Data Source',
                      name: 'responseDataSource',
                      type: 'options',
                      displayOptions: {
                          show: {
                              respondWith: ['binary'],
                          },
                      },
                      options: [
                          {
                              name: 'Choose Automatically From Input',
                              value: 'automatically',
                              description: 'Use if input data will contain a single piece of binary data',
                          },
                          {
                              name: 'Specify Myself',
                              value: 'set',
                              description: 'Enter the name of the input field the binary data will be in',
                          },
                      ],
                      default: 'automatically',
                  },
                  {
                      displayName: 'Input Field Name',
                      name: 'inputFieldName',
                      type: 'string',
                      required: true,
                      default: 'data',
                      displayOptions: {
                          show: {
                              respondWith: ['binary'],
                              responseDataSource: ['set'],
                          },
                      },
                      description: 'The name of the node input field with the binary data',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Response Code',
                              name: 'responseCode',
                              type: 'number',
                              typeOptions: {
                                  minValue: 100,
                                  maxValue: 599,
                              },
                              default: 200,
                              description: 'The HTTP Response code to return. Defaults to 200.',
                          },
                          {
                              displayName: 'Response Headers',
                              name: 'responseHeaders',
                              placeholder: 'Add Response Header',
                              description: 'Add headers to the webhook response',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'entries',
                                      displayName: 'Entries',
                                      values: [
                                          {
                                              displayName: 'Name',
                                              name: 'name',
                                              type: 'string',
                                              default: '',
                                              description: 'Name of the header',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                              description: 'Value of the header',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          var _a, _b, _c;
          const items = this.getInputData();
          const respondWith = this.getNodeParameter('respondWith', 0);
          const options = this.getNodeParameter('options', 0, {});
          const headers = {};
          if (options.responseHeaders) {
              for (const header of options.responseHeaders.entries) {
                  if (typeof header.name !== 'string') {
                      header.name = (_a = header.name) === null || _a === void 0 ? void 0 : _a.toString();
                  }
                  headers[(_b = header.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()] = (_c = header.value) === null || _c === void 0 ? void 0 : _c.toString();
              }
          }
          let responseBody;
          if (respondWith === 'json') {
              const responseBodyParameter = this.getNodeParameter('responseBody', 0);
              if (responseBodyParameter) {
                  if (typeof responseBodyParameter === 'object') {
                      responseBody = responseBodyParameter;
                  }
                  else {
                      responseBody = (0, n8n_workflow_1.jsonParse)(responseBodyParameter, {
                          errorMessage: "Invalid JSON in 'Response Body' field",
                      });
                  }
              }
          }
          else if (respondWith === 'firstIncomingItem') {
              responseBody = items[0].json;
          }
          else if (respondWith === 'text') {
              responseBody = this.getNodeParameter('responseBody', 0);
          }
          else if (respondWith === 'binary') {
              const item = items[0];
              if (item.binary === undefined) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No binary data exists on the first item!');
              }
              let responseBinaryPropertyName;
              const responseDataSource = this.getNodeParameter('responseDataSource', 0);
              if (responseDataSource === 'set') {
                  responseBinaryPropertyName = this.getNodeParameter('inputFieldName', 0);
              }
              else {
                  const binaryKeys = Object.keys(item.binary);
                  if (binaryKeys.length === 0) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No binary data exists on the first item!');
                  }
                  responseBinaryPropertyName = binaryKeys[0];
              }
              const binaryData = this.helpers.assertBinaryData(0, responseBinaryPropertyName);
              if (binaryData.id) {
                  responseBody = { binaryData };
              }
              else {
                  responseBody = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                  headers['content-length'] = responseBody.length;
              }
              if (!headers['content-type']) {
                  headers['content-type'] = binaryData.mimeType;
              }
          }
          else if (respondWith !== 'noData') {
              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The Response Data option "${respondWith}" is not supported!`);
          }
          const response = {
              body: responseBody,
              headers,
              statusCode: options.responseCode || 200,
          };
          this.sendResponse(response);
          return [items];
      }
  }
  exports.RespondToWebhook = RespondToWebhook;
  //# sourceMappingURL=RespondToWebhook.node.js.map

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


node_type: n8n-nodes-base.Rocketchat
name: Rocketchat
package_name: n8n-nodes-base
display_name: RocketChat
description: Consume RocketChat API
code_hash: df9e3192d2c8442bd08a2c62870bb8d2e83a38680502727e204def8a46a2d453
source_location: node_modules/n8n-nodes-base/dist/nodes/Rocketchat/Rocketchat.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Rocketchat = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Rocketchat {
      constructor() {
          this.description = {
              displayName: 'RocketChat',
              name: 'rocketchat',
              icon: 'file:rocketchat.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume RocketChat API',
              defaults: {
                  name: 'RocketChat',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'rocketchatApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Chat',
                              value: 'chat',
                          },
                      ],
                      default: 'chat',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                          },
                      },
                      options: [
                          {
                              name: 'Post Message',
                              value: 'postMessage',
                              description: 'Post a message to a channel or a direct message',
                              action: 'Post a message',
                          },
                      ],
                      default: 'postMessage',
                  },
                  {
                      displayName: 'Channel',
                      name: 'channel',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                      default: '',
                      description: 'The channel name with the prefix in front of it',
                  },
                  {
                      displayName: 'Text',
                      name: 'text',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                      default: '',
                      description: 'The text of the message to send, is optional because of attachments',
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Alias',
                              name: 'alias',
                              type: 'string',
                              default: '',
                              description: 'This will cause the message’s name to appear as the given alias, but your username will still display',
                          },
                          {
                              displayName: 'Avatar',
                              name: 'avatar',
                              type: 'string',
                              default: '',
                              description: 'If provided, this will make the avatar use the provided image URL',
                          },
                          {
                              displayName: 'Emoji',
                              name: 'emoji',
                              type: 'string',
                              default: '',
                              description: 'This will cause the message’s name to appear as the given alias, but your username will still display',
                          },
                      ],
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachments',
                      type: 'collection',
                      default: {},
                      placeholder: 'Add Attachment Item',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Attachment',
                      },
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              displayName: 'Color',
                              name: 'color',
                              type: 'color',
                              default: '#ff0000',
                              description: 'The color you want the order on the left side to be, any value background-css supports',
                          },
                          {
                              displayName: 'Text',
                              name: 'text',
                              type: 'string',
                              default: '',
                              description: 'The text to display for this attachment, it is different than the message’s text',
                          },
                          {
                              displayName: 'Timestamp',
                              name: 'ts',
                              type: 'dateTime',
                              default: '',
                              description: 'Displays the time next to the text portion',
                          },
                          {
                              displayName: 'Thumb URL',
                              name: 'thumbUrl',
                              type: 'string',
                              default: '',
                              description: 'An image that displays to the left of the text, looks better when this is relatively small',
                          },
                          {
                              displayName: 'Message Link',
                              name: 'messageLink',
                              type: 'string',
                              default: '',
                              description: 'Only applicable if the timestamp is provided, as it makes the time clickable to this link',
                          },
                          {
                              displayName: 'Collapsed',
                              name: 'collapsed',
                              type: 'boolean',
                              default: false,
                              description: 'Causes the image, audio, and video sections to be hiding when collapsed is true',
                          },
                          {
                              displayName: 'Author Name',
                              name: 'authorName',
                              type: 'string',
                              default: '',
                              description: 'Name of the author',
                          },
                          {
                              displayName: 'Author Link',
                              name: 'authorLink',
                              type: 'string',
                              default: '',
                              description: 'Providing this makes the author name clickable and points to this link',
                          },
                          {
                              displayName: 'Author Icon',
                              name: 'authorIcon',
                              type: 'string',
                              default: '',
                              placeholder: 'https://site.com/img.png',
                              description: 'Displays a tiny icon to the left of the Author’s name',
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'Title to display for this attachment, displays under the author',
                          },
                          {
                              displayName: 'Title Link',
                              name: 'titleLink',
                              type: 'string',
                              default: '',
                              description: 'Providing this makes the title clickable, pointing to this link',
                          },
                          {
                              displayName: 'Title Link Download',
                              name: 'titleLinkDownload',
                              type: 'boolean',
                              default: false,
                              description: 'When this is true, a download icon appears and clicking this saves the link to file',
                          },
                          {
                              displayName: 'Image URL',
                              name: 'imageUrl',
                              type: 'string',
                              default: '',
                              description: 'The image to display, will be “big” and easy to see',
                          },
                          {
                              displayName: 'Audio URL',
                              name: 'audioUrl',
                              type: 'string',
                              default: '',
                              placeholder: 'https://site.com/aud.mp3',
                              description: 'Audio file to play, only supports what html audio does',
                          },
                          {
                              displayName: 'Video URL',
                              name: 'videoUrl',
                              type: 'string',
                              default: '',
                              placeholder: 'https://site.com/vid.mp4',
                              description: 'Video file to play, only supports what html video does',
                          },
                          {
                              displayName: 'Fields',
                              name: 'fields',
                              type: 'fixedCollection',
                              placeholder: 'Add Field Item',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'fieldsValues',
                                      displayName: 'Fields',
                                      values: [
                                          {
                                              displayName: 'Short',
                                              name: 'short',
                                              type: 'boolean',
                                              default: false,
                                              description: 'Whether this field should be a short field',
                                          },
                                          {
                                              displayName: 'Title',
                                              name: 'title',
                                              type: 'string',
                                              default: '',
                                              description: 'The title of this field',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                              description: 'The value of this field, displayed underneath the title value',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachmentsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                              jsonParameters: [true],
                          },
                      },
                      default: '',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          let responseData;
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'chat') {
                      if (operation === 'postMessage') {
                          const channel = this.getNodeParameter('channel', i);
                          const text = this.getNodeParameter('text', i);
                          const options = this.getNodeParameter('options', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              channel,
                              text,
                          };
                          if (options.alias) {
                              body.alias = options.alias;
                          }
                          if (options.avatar) {
                              body.avatar = options.avatar;
                          }
                          if (options.emoji) {
                              body.emoji = options.emoji;
                          }
                          if (!jsonActive) {
                              const optionsAttachments = this.getNodeParameter('attachments', i);
                              if (optionsAttachments.length > 0) {
                                  const attachments = [];
                                  for (let index = 0; index < optionsAttachments.length; index++) {
                                      const attachment = {};
                                      for (const option of Object.keys(optionsAttachments[index])) {
                                          if (option === 'color') {
                                              attachment.color = optionsAttachments[index][option];
                                          }
                                          else if (option === 'text') {
                                              attachment.text = optionsAttachments[index][option];
                                          }
                                          else if (option === 'ts') {
                                              attachment.ts = optionsAttachments[index][option];
                                          }
                                          else if (option === 'messageLinks') {
                                              attachment.message_link = optionsAttachments[index][option];
                                          }
                                          else if (option === 'thumbUrl') {
                                              attachment.thumb_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'collapsed') {
                                              attachment.collapsed = optionsAttachments[index][option];
                                          }
                                          else if (option === 'authorName') {
                                              attachment.author_name = optionsAttachments[index][option];
                                          }
                                          else if (option === 'authorLink') {
                                              attachment.author_link = optionsAttachments[index][option];
                                          }
                                          else if (option === 'authorIcon') {
                                              attachment.author_icon = optionsAttachments[index][option];
                                          }
                                          else if (option === 'title') {
                                              attachment.title = optionsAttachments[index][option];
                                          }
                                          else if (option === 'titleLink') {
                                              attachment.title_link = optionsAttachments[index][option];
                                          }
                                          else if (option === 'titleLinkDownload') {
                                              attachment.title_link_download = optionsAttachments[index][option];
                                          }
                                          else if (option === 'imageUrl') {
                                              attachment.image_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'audioUrl') {
                                              attachment.audio_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'videoUrl') {
                                              attachment.video_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'fields') {
                                              const fieldsValues = optionsAttachments[index][option]
                                                  .fieldsValues;
                                              if (fieldsValues.length > 0) {
                                                  const fields = [];
                                                  for (let j = 0; j < fieldsValues.length; j++) {
                                                      const field = {};
                                                      for (const key of Object.keys(fieldsValues[j])) {
                                                          if (key === 'short') {
                                                              field.short = fieldsValues[j][key];
                                                          }
                                                          else if (key === 'title') {
                                                              field.title = fieldsValues[j][key];
                                                          }
                                                          else if (key === 'value') {
                                                              field.value = fieldsValues[j][key];
                                                          }
                                                      }
                                                      fields.push(field);
                                                      attachment.fields = fields;
                                                  }
                                              }
                                          }
                                      }
                                      attachments.push(attachment);
                                  }
                                  body.attachments = attachments;
                              }
                          }
                          else {
                              body.attachments = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('attachmentsJson', i));
                          }
                          responseData = await GenericFunctions_1.rocketchatApiRequest.call(this, '/chat', 'POST', 'postMessage', 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.Rocketchat = Rocketchat;
  //# sourceMappingURL=Rocketchat.node.js.map

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


node_type: n8n-nodes-base.RssFeedRead
name: RssFeedRead
package_name: n8n-nodes-base
display_name: RSS Read
description: Reads data from an RSS Feed
code_hash: 8fbc9da500347175bdd7371dfcc8ae68cb21a1fb3e39ded017aa4eff48724580
source_location: node_modules/n8n-nodes-base/dist/nodes/RssFeedRead/RssFeedRead.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
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.RssFeedRead = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const rss_parser_1 = __importDefault(require("rss-parser"));
  const url_1 = require("url");
  const utilities_1 = require("../../utils/utilities");
  function validateURL(url) {
      try {
          new url_1.URL(url);
          return true;
      }
      catch (err) {
          return false;
      }
  }
  class RssFeedRead {
      constructor() {
          this.description = {
              displayName: 'RSS Read',
              name: 'rssFeedRead',
              icon: 'fa:rss',
              group: ['input'],
              version: 1,
              description: 'Reads data from an RSS Feed',
              defaults: {
                  name: 'RSS Read',
                  color: '#b02020',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'URL',
                      name: 'url',
                      type: 'string',
                      default: '',
                      required: true,
                      description: 'URL of the RSS feed',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Ignore SSL Issues',
                              name: 'ignoreSSL',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to ignore SSL/TLS certificate issues or not',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const pairedItem = (0, utilities_1.generatePairedItemData)(this.getInputData().length);
          try {
              const url = this.getNodeParameter('url', 0);
              const options = this.getNodeParameter('options', 0);
              const ignoreSSL = Boolean(options.ignoreSSL);
              if (!url) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The parameter "URL" has to be set!');
              }
              if (!validateURL(url)) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The provided "URL" is not valid!');
              }
              const parser = new rss_parser_1.default({
                  requestOptions: {
                      rejectUnauthorized: !ignoreSSL,
                  },
              });
              let feed;
              try {
                  feed = await parser.parseURL(url);
              }
              catch (error) {
                  if (error.code === 'ECONNREFUSED') {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `It was not possible to connect to the URL. Please make sure the URL "${url}" it is valid!`);
                  }
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
              }
              const returnData = [];
              if (feed.items) {
                  feed.items.forEach((item) => {
                      returnData.push({
                          json: item,
                          pairedItem,
                      });
                  });
              }
              return [returnData];
          }
          catch (error) {
              if (this.continueOnFail()) {
                  return [[{ json: { error: error.message }, pairedItem }]];
              }
              throw error;
          }
      }
  }
  exports.RssFeedRead = RssFeedRead;
  //# sourceMappingURL=RssFeedRead.node.js.map

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


node_type: n8n-nodes-base.Rundeck
name: Rundeck
package_name: n8n-nodes-base
display_name: Rundeck
description: Manage Rundeck API
code_hash: 0aa78fa1476a33315899eb61c27e295d593c94d115557ab432a7b1b98023786e
source_location: node_modules/n8n-nodes-base/dist/nodes/Rundeck/Rundeck.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Rundeck = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const RundeckApi_1 = require("./RundeckApi");
  class Rundeck {
      constructor() {
          this.description = {
              displayName: 'Rundeck',
              name: 'rundeck',
              icon: 'file:rundeck.png',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Manage Rundeck API',
              defaults: {
                  name: 'Rundeck',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'rundeckApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Job',
                              value: 'job',
                          },
                      ],
                      default: 'job',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Execute',
                              value: 'execute',
                              description: 'Execute a job',
                              action: 'Execute a job',
                          },
                          {
                              name: 'Get Metadata',
                              value: 'getMetadata',
                              description: 'Get metadata of a job',
                              action: 'Get metadata of a job',
                          },
                      ],
                      default: 'execute',
                  },
                  {
                      displayName: 'Job ID',
                      name: 'jobid',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['execute'],
                              resource: ['job'],
                          },
                      },
                      default: '',
                      placeholder: 'Rundeck Job ID',
                      required: true,
                      description: 'The job ID to execute',
                  },
                  {
                      displayName: 'Arguments',
                      name: 'arguments',
                      placeholder: 'Add Argument',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              operation: ['execute'],
                              resource: ['job'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              name: 'arguments',
                              displayName: 'Arguments',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Filter',
                      name: 'filter',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['execute'],
                              resource: ['job'],
                          },
                      },
                      default: '',
                      placeholder: 'Add Filters',
                      description: 'Filter Rundeck nodes by name',
                  },
                  {
                      displayName: 'Job ID',
                      name: 'jobid',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['getMetadata'],
                              resource: ['job'],
                          },
                      },
                      default: '',
                      placeholder: 'Rundeck Job ID',
                      required: true,
                      description: 'The job ID to get metadata off',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          const rundeckApi = new RundeckApi_1.RundeckApi(this);
          await rundeckApi.init();
          for (let i = 0; i < length; i++) {
              if (resource === 'job') {
                  if (operation === 'execute') {
                      const jobid = this.getNodeParameter('jobid', i);
                      const rundeckArguments = this.getNodeParameter('arguments', i)
                          .arguments;
                      const filter = this.getNodeParameter('filter', i);
                      const response = await rundeckApi.executeJob(jobid, rundeckArguments, filter);
                      returnData.push(response);
                  }
                  else if (operation === 'getMetadata') {
                      const jobid = this.getNodeParameter('jobid', i);
                      const response = await rundeckApi.getJobMetadata(jobid);
                      returnData.push(response);
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, { itemIndex: i });
                  }
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not supported!`, { itemIndex: i });
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Rundeck = Rundeck;
  //# sourceMappingURL=Rundeck.node.js.map

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


node_type: n8n-nodes-base.S3
name: S3
package_name: n8n-nodes-base
display_name: S3
description: Sends data to any S3-compatible service
code_hash: 80c075ea70231b2247f5c6f3da95d4769d94dc14792e809bb2a267a14d97e036
source_location: node_modules/n8n-nodes-base/dist/nodes/S3/S3.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.S3 = void 0;
  const change_case_1 = require("change-case");
  const crypto_1 = require("crypto");
  const xml2js_1 = require("xml2js");
  const n8n_workflow_1 = require("n8n-workflow");
  const BucketDescription_1 = require("../Aws/S3/V1/BucketDescription");
  const FolderDescription_1 = require("../Aws/S3/V1/FolderDescription");
  const FileDescription_1 = require("../Aws/S3/V1/FileDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  class S3 {
      constructor() {
          this.description = {
              displayName: 'S3',
              name: 's3',
              icon: 'file:s3.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Sends data to any S3-compatible service',
              defaults: {
                  name: 'S3',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 's3',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Bucket',
                              value: 'bucket',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Folder',
                              value: 'folder',
                          },
                      ],
                      default: 'file',
                  },
                  ...BucketDescription_1.bucketOperations,
                  ...BucketDescription_1.bucketFields,
                  ...FolderDescription_1.folderOperations,
                  ...FolderDescription_1.folderFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  const headers = {};
                  if (resource === 'bucket') {
                      if (operation === 'create') {
                          let credentials;
                          try {
                              credentials = await this.getCredentials('s3');
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                          const name = this.getNodeParameter('name', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.acl) {
                              headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
                          }
                          if (additionalFields.bucketObjectLockEnabled) {
                              headers['x-amz-bucket-object-lock-enabled'] =
                                  additionalFields.bucketObjectLockEnabled;
                          }
                          if (additionalFields.grantFullControl) {
                              headers['x-amz-grant-full-control'] = '';
                          }
                          if (additionalFields.grantRead) {
                              headers['x-amz-grant-read'] = '';
                          }
                          if (additionalFields.grantReadAcp) {
                              headers['x-amz-grant-read-acp'] = '';
                          }
                          if (additionalFields.grantWrite) {
                              headers['x-amz-grant-write'] = '';
                          }
                          if (additionalFields.grantWriteAcp) {
                              headers['x-amz-grant-write-acp'] = '';
                          }
                          let region = credentials.region;
                          if (additionalFields.region) {
                              region = additionalFields.region;
                          }
                          const body = {
                              CreateBucketConfiguration: {
                                  $: {
                                      xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
                                  },
                              },
                          };
                          let data = '';
                          if (region !== 'us-east-1') {
                              body.CreateBucketConfiguration.LocationConstraint = [region];
                              const builder = new xml2js_1.Builder();
                              data = builder.buildObject(body);
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, `${name}`, 'PUT', '', data, qs, headers);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListAllMyBucketsResult.Buckets.Bucket', '', 'GET', '');
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListAllMyBucketsResult.Buckets.Bucket', '', 'GET', '', '', qs);
                              responseData = responseData.slice(0, qs.limit);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'search') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const additionalFields = this.getNodeParameter('additionalFields', 0);
                          if (additionalFields.prefix) {
                              qs.prefix = additionalFields.prefix;
                          }
                          if (additionalFields.encodingType) {
                              qs['encoding-type'] = additionalFields.encodingType;
                          }
                          if (additionalFields.delmiter) {
                              qs.delimiter = additionalFields.delmiter;
                          }
                          if (additionalFields.fetchOwner) {
                              qs['fetch-owner'] = additionalFields.fetchOwner;
                          }
                          if (additionalFields.startAfter) {
                              qs['start-after'] = additionalFields.startAfter;
                          }
                          if (additionalFields.requesterPays) {
                              qs['x-amz-request-payer'] = 'requester';
                          }
                          qs['list-type'] = 2;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          else {
                              qs['max-keys'] = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', qs, {}, {}, region);
                              responseData = responseData.ListBucketResult.Contents;
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  if (resource === 'folder') {
                      if (operation === 'create') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const folderName = this.getNodeParameter('folderName', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          let path = `/${folderName}/`;
                          if (additionalFields.requesterPays) {
                              headers['x-amz-request-payer'] = 'requester';
                          }
                          if (additionalFields.parentFolderKey) {
                              path = `/${additionalFields.parentFolderKey}${folderName}/`;
                          }
                          if (additionalFields.storageClass) {
                              headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', path, '', qs, headers, {}, region);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'delete') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const folderKey = this.getNodeParameter('folderKey', i);
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '/', '', { 'list-type': 2, prefix: folderKey }, {}, {}, region);
                          if (responseData.length === 0) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${folderKey}`, '', qs, {}, {}, region);
                              responseData = { deleted: [{ Key: folderKey }] };
                          }
                          else {
                              const body = {
                                  Delete: {
                                      $: {
                                          xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
                                      },
                                      Object: [],
                                  },
                              };
                              for (const childObject of responseData) {
                                  body.Delete.Object.push({
                                      Key: childObject.Key,
                                  });
                              }
                              const builder = new xml2js_1.Builder();
                              const data = builder.buildObject(body);
                              headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(data).digest('base64');
                              headers['Content-Type'] = 'application/xml';
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'POST', '/', data, { delete: '' }, headers, {}, region);
                              responseData = { deleted: responseData.DeleteResult.Deleted };
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', 0);
                          if (options.folderKey) {
                              qs.prefix = options.folderKey;
                          }
                          if (options.fetchOwner) {
                              qs['fetch-owner'] = options.fetchOwner;
                          }
                          qs['list-type'] = 2;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          if (Array.isArray(responseData)) {
                              responseData = responseData.filter((e) => e.Key.endsWith('/') && e.Size === '0' && e.Key !== options.folderKey);
                              if (qs.limit) {
                                  responseData = responseData.splice(0, qs.limit);
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  if (resource === 'file') {
                      if (operation === 'copy') {
                          const sourcePath = this.getNodeParameter('sourcePath', i);
                          const destinationPath = this.getNodeParameter('destinationPath', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          headers['x-amz-copy-source'] = sourcePath;
                          if (additionalFields.requesterPays) {
                              headers['x-amz-request-payer'] = 'requester';
                          }
                          if (additionalFields.storageClass) {
                              headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
                          }
                          if (additionalFields.acl) {
                              headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
                          }
                          if (additionalFields.grantFullControl) {
                              headers['x-amz-grant-full-control'] = '';
                          }
                          if (additionalFields.grantRead) {
                              headers['x-amz-grant-read'] = '';
                          }
                          if (additionalFields.grantReadAcp) {
                              headers['x-amz-grant-read-acp'] = '';
                          }
                          if (additionalFields.grantWriteAcp) {
                              headers['x-amz-grant-write-acp'] = '';
                          }
                          if (additionalFields.lockLegalHold) {
                              headers['x-amz-object-lock-legal-hold'] = additionalFields.lockLegalHold
                                  ? 'ON'
                                  : 'OFF';
                          }
                          if (additionalFields.lockMode) {
                              headers['x-amz-object-lock-mode'] = additionalFields.lockMode.toUpperCase();
                          }
                          if (additionalFields.lockRetainUntilDate) {
                              headers['x-amz-object-lock-retain-until-date'] =
                                  additionalFields.lockRetainUntilDate;
                          }
                          if (additionalFields.serverSideEncryption) {
                              headers['x-amz-server-side-encryption'] =
                                  additionalFields.serverSideEncryption;
                          }
                          if (additionalFields.encryptionAwsKmsKeyId) {
                              headers['x-amz-server-side-encryption-aws-kms-key-id'] =
                                  additionalFields.encryptionAwsKmsKeyId;
                          }
                          if (additionalFields.serverSideEncryptionContext) {
                              headers['x-amz-server-side-encryption-context'] =
                                  additionalFields.serverSideEncryptionContext;
                          }
                          if (additionalFields.serversideEncryptionCustomerAlgorithm) {
                              headers['x-amz-server-side-encryption-customer-algorithm'] =
                                  additionalFields.serversideEncryptionCustomerAlgorithm;
                          }
                          if (additionalFields.serversideEncryptionCustomerKey) {
                              headers['x-amz-server-side-encryption-customer-key'] =
                                  additionalFields.serversideEncryptionCustomerKey;
                          }
                          if (additionalFields.serversideEncryptionCustomerKeyMD5) {
                              headers['x-amz-server-side-encryption-customer-key-MD5'] =
                                  additionalFields.serversideEncryptionCustomerKeyMD5;
                          }
                          if (additionalFields.taggingDirective) {
                              headers['x-amz-tagging-directive'] = additionalFields.taggingDirective.toUpperCase();
                          }
                          if (additionalFields.metadataDirective) {
                              headers['x-amz-metadata-directive'] = additionalFields.metadataDirective.toUpperCase();
                          }
                          const destinationParts = destinationPath.split('/');
                          const bucketName = destinationParts[1];
                          const destination = `/${destinationParts.slice(2, destinationParts.length).join('/')}`;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', destination, '', qs, headers, {}, region);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.CopyObjectResult), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'download') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const fileKey = this.getNodeParameter('fileKey', i);
                          const fileName = fileKey.split('/')[fileKey.split('/').length - 1];
                          if (fileKey.substring(fileKey.length - 1) === '/') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Downloding a whole directory is not yet supported, please provide a file key');
                          }
                          let region = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          region = region.LocationConstraint._;
                          const response = await GenericFunctions_1.s3ApiRequestREST.call(this, bucketName, 'GET', `/${fileKey}`, '', qs, {}, { encoding: null, resolveWithFullResponse: true }, region);
                          let mimeType;
                          if (response.headers['content-type']) {
                              mimeType = response.headers['content-type'];
                          }
                          const newItem = {
                              json: items[i].json,
                              binary: {},
                          };
                          if (items[i].binary !== undefined) {
                              Object.assign(newItem.binary, items[i].binary);
                          }
                          items[i] = newItem;
                          const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                          const data = Buffer.from(response.body, 'utf8');
                          items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, fileName, mimeType);
                      }
                      if (operation === 'delete') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const fileKey = this.getNodeParameter('fileKey', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.versionId) {
                              qs.versionId = options.versionId;
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${fileKey}`, '', qs, {}, {}, region);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', 0);
                          if (options.folderKey) {
                              qs.prefix = options.folderKey;
                          }
                          if (options.fetchOwner) {
                              qs['fetch-owner'] = options.fetchOwner;
                          }
                          qs.delimiter = '/';
                          qs['list-type'] = 2;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                              responseData = responseData.splice(0, qs.limit);
                          }
                          if (Array.isArray(responseData)) {
                              responseData = responseData.filter((e) => !e.Key.endsWith('/') && e.Size !== '0');
                              if (qs.limit) {
                                  responseData = responseData.splice(0, qs.limit);
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'upload') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const fileName = this.getNodeParameter('fileName', i);
                          const isBinaryData = this.getNodeParameter('binaryData', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const tagsValues = this.getNodeParameter('tagsUi', i)
                              .tagsValues;
                          let path = '/';
                          let body;
                          if (additionalFields.requesterPays) {
                              headers['x-amz-request-payer'] = 'requester';
                          }
                          if (additionalFields.parentFolderKey) {
                              path = `/${additionalFields.parentFolderKey}/`;
                          }
                          if (additionalFields.storageClass) {
                              headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
                          }
                          if (additionalFields.acl) {
                              headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
                          }
                          if (additionalFields.grantFullControl) {
                              headers['x-amz-grant-full-control'] = '';
                          }
                          if (additionalFields.grantRead) {
                              headers['x-amz-grant-read'] = '';
                          }
                          if (additionalFields.grantReadAcp) {
                              headers['x-amz-grant-read-acp'] = '';
                          }
                          if (additionalFields.grantWriteAcp) {
                              headers['x-amz-grant-write-acp'] = '';
                          }
                          if (additionalFields.lockLegalHold) {
                              headers['x-amz-object-lock-legal-hold'] = additionalFields.lockLegalHold
                                  ? 'ON'
                                  : 'OFF';
                          }
                          if (additionalFields.lockMode) {
                              headers['x-amz-object-lock-mode'] = additionalFields.lockMode.toUpperCase();
                          }
                          if (additionalFields.lockRetainUntilDate) {
                              headers['x-amz-object-lock-retain-until-date'] =
                                  additionalFields.lockRetainUntilDate;
                          }
                          if (additionalFields.serverSideEncryption) {
                              headers['x-amz-server-side-encryption'] =
                                  additionalFields.serverSideEncryption;
                          }
                          if (additionalFields.encryptionAwsKmsKeyId) {
                              headers['x-amz-server-side-encryption-aws-kms-key-id'] =
                                  additionalFields.encryptionAwsKmsKeyId;
                          }
                          if (additionalFields.serverSideEncryptionContext) {
                              headers['x-amz-server-side-encryption-context'] =
                                  additionalFields.serverSideEncryptionContext;
                          }
                          if (additionalFields.serversideEncryptionCustomerAlgorithm) {
                              headers['x-amz-server-side-encryption-customer-algorithm'] =
                                  additionalFields.serversideEncryptionCustomerAlgorithm;
                          }
                          if (additionalFields.serversideEncryptionCustomerKey) {
                              headers['x-amz-server-side-encryption-customer-key'] =
                                  additionalFields.serversideEncryptionCustomerKey;
                          }
                          if (additionalFields.serversideEncryptionCustomerKeyMD5) {
                              headers['x-amz-server-side-encryption-customer-key-MD5'] =
                                  additionalFields.serversideEncryptionCustomerKeyMD5;
                          }
                          if (tagsValues) {
                              const tags = [];
                              tagsValues.forEach((o) => {
                                  tags.push(`${o.key}=${o.value}`);
                              });
                              headers['x-amz-tagging'] = tags.join('&');
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (isBinaryData) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              body = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              headers['Content-Type'] = binaryData.mimeType;
                              headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(body).digest('base64');
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', `${path}${fileName || binaryData.fileName}`, body, qs, headers, {}, region);
                          }
                          else {
                              const fileContent = this.getNodeParameter('fileContent', i);
                              body = Buffer.from(fileContent, 'utf8');
                              headers['Content-Type'] = 'text/html';
                              headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(fileContent).digest('base64');
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', `${path}${fileName}`, body, qs, headers, {}, region);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      if (resource === 'file' && operation === 'download') {
                          items[i].json = { error: error.message };
                      }
                      else {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      continue;
                  }
                  throw error;
              }
          }
          if (resource === 'file' && operation === 'download') {
              return [items];
          }
          return [returnData];
      }
  }
  exports.S3 = S3;
  //# sourceMappingURL=S3.node.js.map

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


node_type: n8n-nodes-base.Salesforce
name: Salesforce
package_name: n8n-nodes-base
display_name: Salesforce
description: Consume Salesforce API
code_hash: 6f246b98c15db36cd6ecfb303d5edf8861482d616bc7a416a74aa341105120c3
source_location: node_modules/n8n-nodes-base/dist/nodes/Salesforce/Salesforce.node.js
extracted_at: 2025-06-07 19:36:42
updated_at: 2025-06-07 19:36:42
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Salesforce = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const AccountDescription_1 = require("./AccountDescription");
  const AttachmentDescription_1 = require("./AttachmentDescription");
  const CaseDescription_1 = require("./CaseDescription");
  const ContactDescription_1 = require("./ContactDescription");
  const CustomObjectDescription_1 = require("./CustomObjectDescription");
  const FlowDescription_1 = require("./FlowDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const LeadDescription_1 = require("./LeadDescription");
  const OpportunityDescription_1 = require("./OpportunityDescription");
  const SearchDescription_1 = require("./SearchDescription");
  const TaskDescription_1 = require("./TaskDescription");
  const UserDescription_1 = require("./UserDescription");
  const DocumentDescription_1 = require("./DocumentDescription");
  class Salesforce {
      constructor() {
          this.description = {
              displayName: 'Salesforce',
              name: 'salesforce',
              icon: 'file:salesforce.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Salesforce API',
              defaults: {
                  name: 'Salesforce',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'salesforceOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
                  {
                      name: 'salesforceJwtApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['jwt'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                          {
                              name: 'OAuth2 JWT',
                              value: 'jwt',
                          },
                      ],
                      default: 'oAuth2',
                      description: 'OAuth Authorization Flow',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Account',
                              value: 'account',
                              description: 'Represents an individual account, which is an organization or person involved with your business (such as customers, competitors, and partners)',
                          },
                          {
                              name: 'Attachment',
                              value: 'attachment',
                              description: 'Represents a file that a has uploaded and attached to a parent object',
                          },
                          {
                              name: 'Case',
                              value: 'case',
                              description: 'Represents a case, which is a customer issue or problem',
                          },
                          {
                              name: 'Contact',
                              value: 'contact',
                              description: 'Represents a contact, which is an individual associated with an account',
                          },
                          {
                              name: 'Custom Object',
                              value: 'customObject',
                              description: 'Represents a custom object',
                          },
                          {
                              name: 'Document',
                              value: 'document',
                              description: 'Represents a document',
                          },
                          {
                              name: 'Flow',
                              value: 'flow',
                              description: 'Represents an autolaunched flow',
                          },
                          {
                              name: 'Lead',
                              value: 'lead',
                              description: 'Represents a prospect or potential',
                          },
                          {
                              name: 'Opportunity',
                              value: 'opportunity',
                              description: 'Represents an opportunity, which is a sale or pending deal',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search records',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                              description: 'Represents a business activity such as making a phone call or other to-do items. In the user interface, and records are collectively referred to as activities.',
                          },
                          {
                              name: 'User',
                              value: 'user',
                              description: 'Represents a person, which is one user in system',
                          },
                      ],
                      default: 'lead',
                  },
                  ...LeadDescription_1.leadOperations,
                  ...LeadDescription_1.leadFields,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
                  ...CustomObjectDescription_1.customObjectOperations,
                  ...CustomObjectDescription_1.customObjectFields,
                  ...DocumentDescription_1.documentOperations,
                  ...DocumentDescription_1.documentFields,
                  ...OpportunityDescription_1.opportunityOperations,
                  ...OpportunityDescription_1.opportunityFields,
                  ...AccountDescription_1.accountOperations,
                  ...AccountDescription_1.accountFields,
                  ...SearchDescription_1.searchOperations,
                  ...SearchDescription_1.searchFields,
                  ...CaseDescription_1.caseOperations,
                  ...CaseDescription_1.caseFields,
                  ...TaskDescription_1.taskOperations,
                  ...TaskDescription_1.taskFields,
                  ...AttachmentDescription_1.attachmentOperations,
                  ...AttachmentDescription_1.attachmentFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
                  ...FlowDescription_1.flowOperations,
                  ...FlowDescription_1.flowFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLeadStatuses() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, MasterLabel FROM LeadStatus',
                      };
                      const statuses = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const status of statuses) {
                          const statusName = status.MasterLabel;
                          returnData.push({
                              name: statusName,
                              value: statusName,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getUsers() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, Name FROM User',
                      };
                      const users = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const user of users) {
                          const userName = user.Name;
                          const userId = user.Id;
                          returnData.push({
                              name: userName,
                              value: userId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseOwners() {
                      const returnData = [];
                      const qsQueues = {
                          q: "SELECT Queue.Id, Queue.Name FROM QueuesObject where Queue.Type='Queue' and SobjectType = 'Case'",
                      };
                      const queues = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsQueues);
                      for (const queue of queues) {
                          const queueName = queue.Queue.Name;
                          const queueId = queue.Queue.Id;
                          returnData.push({
                              name: `Queue: ${queueName}`,
                              value: queueId,
                          });
                      }
                      const qsUsers = {
                          q: 'SELECT id, Name FROM User',
                      };
                      const users = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsUsers);
                      const userPrefix = returnData.length > 0 ? 'User: ' : '';
                      for (const user of users) {
                          const userName = user.Name;
                          const userId = user.Id;
                          returnData.push({
                              name: userPrefix + userName,
                              value: userId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getLeadOwners() {
                      const returnData = [];
                      const qsQueues = {
                          q: "SELECT Queue.Id, Queue.Name FROM QueuesObject where Queue.Type='Queue' and SobjectType = 'Lead'",
                      };
                      const queues = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsQueues);
                      for (const queue of queues) {
                          const queueName = queue.Queue.Name;
                          const queueId = queue.Queue.Id;
                          returnData.push({
                              name: `Queue: ${queueName}`,
                              value: queueId,
                          });
                      }
                      const qsUsers = {
                          q: 'SELECT id, Name FROM User',
                      };
                      const users = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsUsers);
                      const userPrefix = returnData.length > 0 ? 'User: ' : '';
                      for (const user of users) {
                          const userName = user.Name;
                          const userId = user.Id;
                          returnData.push({
                              name: userPrefix + userName,
                              value: userId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getLeadSources() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/lead/describe');
                      for (const field of fields) {
                          if (field.name === 'LeadSource') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCustomFields() {
                      const returnData = [];
                      const resource = this.getNodeParameter('resource', 0);
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${resource}/describe`);
                      for (const field of fields) {
                          if (field.custom === true) {
                              const fieldName = field.label;
                              const fieldId = field.name;
                              returnData.push({
                                  name: fieldName,
                                  value: fieldId,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getRecordTypes() {
                      const returnData = [];
                      let resource = this.getNodeParameter('resource', 0);
                      if (resource === 'customObject') {
                          resource = this.getNodeParameter('customObject', 0);
                      }
                      const qs = {
                          q: `SELECT Id, Name, SobjectType, IsActive FROM RecordType WHERE SobjectType = '${resource}'`,
                      };
                      const types = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const type of types) {
                          if (type.IsActive === true) {
                              returnData.push({
                                  name: type.Name,
                                  value: type.Id,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getExternalIdFields() {
                      const returnData = [];
                      let resource = this.getCurrentNodeParameter('resource');
                      resource =
                          resource === 'customObject'
                              ? this.getCurrentNodeParameter('customObject')
                              : resource;
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${resource}/describe`);
                      for (const field of fields) {
                          if (field.externalId === true || field.idLookup === true) {
                              const fieldName = field.label;
                              const fieldId = field.name;
                              returnData.push({
                                  name: fieldName,
                                  value: fieldId,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccounts() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, Name FROM Account',
                      };
                      const accounts = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const account of accounts) {
                          const accountName = account.Name;
                          const accountId = account.Id;
                          returnData.push({
                              name: accountName,
                              value: accountId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCampaigns() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, Name FROM Campaign',
                      };
                      const campaigns = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const campaign of campaigns) {
                          const campaignName = campaign.Name;
                          const campaignId = campaign.Id;
                          returnData.push({
                              name: campaignName,
                              value: campaignId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getStages() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/opportunity/describe');
                      for (const field of fields) {
                          if (field.name === 'StageName') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccountTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account/describe');
                      for (const field of fields) {
                          if (field.name === 'Type') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccountSources() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account/describe');
                      for (const field of fields) {
                          if (field.name === 'AccountSource') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Type') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseStatuses() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Status') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseReasons() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Reason') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseOrigins() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Origin') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCasePriorities() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Priority') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskStatuses() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'Status') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'TaskSubtype') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskSubjects() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'Subject') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskCallTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'CallType') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskPriorities() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'Priority') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskRecurrenceTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'RecurrenceType') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskRecurrenceInstances() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'RecurrenceInstance') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCustomObjects() {
                      const returnData = [];
                      const { sobjects: objects } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects');
                      for (const object of objects) {
                          if (object.custom === true) {
                              const objectName = object.label;
                              const objectId = object.name;
                              returnData.push({
                                  name: objectName,
                                  value: objectId,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCustomObjectFields() {
                      const returnData = [];
                      const customObject = this.getCurrentNodeParameter('customObject');
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${customObject}/describe`);
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccountFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAtachmentFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/attachment/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getLeadFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/lead/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getOpportunityFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/opportunity/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getUserFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/user/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getContactFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/contact/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          this.logger.debug(`Running "Salesforce" node named "${this.getNode.name}" resource "${resource}" operation "${operation}"`);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'lead') {
                      if (operation === 'create' || operation === 'upsert') {
                          const company = this.getNodeParameter('company', i);
                          const lastname = this.getNodeParameter('lastname', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              Company: company,
                              LastName: lastname,
                          };
                          if (additionalFields.hasOptedOutOfEmail !== undefined) {
                              body.HasOptedOutOfEmail = additionalFields.hasOptedOutOfEmail;
                          }
                          if (additionalFields.hasOptedOutOfFax !== undefined) {
                              body.HasOptedOutOfFax = additionalFields.hasOptedOutOfFax;
                          }
                          if (additionalFields.email !== undefined) {
                              body.Email = additionalFields.email;
                          }
                          if (additionalFields.city !== undefined) {
                              body.City = additionalFields.city;
                          }
                          if (additionalFields.phone !== undefined) {
                              body.Phone = additionalFields.phone;
                          }
                          if (additionalFields.state !== undefined) {
                              body.State = additionalFields.state;
                          }
                          if (additionalFields.title !== undefined) {
                              body.Title = additionalFields.title;
                          }
                          if (additionalFields.jigsaw !== undefined) {
                              body.Jigsaw = additionalFields.jigsaw;
                          }
                          if (additionalFields.rating !== undefined) {
                              body.Rating = additionalFields.rating;
                          }
                          if (additionalFields.status !== undefined) {
                              body.Status = additionalFields.status;
                          }
                          if (additionalFields.street !== undefined) {
                              body.Street = additionalFields.street;
                          }
                          if (additionalFields.country !== undefined) {
                              body.Country = additionalFields.country;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.website !== undefined) {
                              body.Website = additionalFields.website;
                          }
                          if (additionalFields.industry !== undefined) {
                              body.Industry = additionalFields.industry;
                          }
                          if (additionalFields.fax !== undefined) {
                              body.Fax = additionalFields.fax;
                          }
                          if (additionalFields.firstname !== undefined) {
                              body.FirstName = additionalFields.firstname;
                          }
                          if (additionalFields.leadSource !== undefined) {
                              body.LeadSource = additionalFields.leadSource;
                          }
                          if (additionalFields.postalCode !== undefined) {
                              body.PostalCode = additionalFields.postalCode;
                          }
                          if (additionalFields.salutation !== undefined) {
                              body.Salutation = additionalFields.salutation;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = additionalFields.annualRevenue;
                          }
                          if (additionalFields.isUnreadByOwner !== undefined) {
                              body.IsUnreadByOwner = additionalFields.isUnreadByOwner;
                          }
                          if (additionalFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = additionalFields.numberOfEmployees;
                          }
                          if (additionalFields.mobilePhone !== undefined) {
                              body.MobilePhone = additionalFields.mobilePhone;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/lead';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/lead/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const leadId = this.getNodeParameter('leadId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (!Object.keys(updateFields).length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must add at least one update field', { itemIndex: i });
                          }
                          if (updateFields.hasOptedOutOfEmail !== undefined) {
                              body.HasOptedOutOfEmail = updateFields.hasOptedOutOfEmail;
                          }
                          if (updateFields.hasOptedOutOfFax !== undefined) {
                              body.hasOptedOutOfFax = updateFields.hasOptedOutOfFax;
                          }
                          if (updateFields.lastname !== undefined) {
                              body.LastName = updateFields.lastname;
                          }
                          if (updateFields.company !== undefined) {
                              body.Company = updateFields.company;
                          }
                          if (updateFields.email !== undefined) {
                              body.Email = updateFields.email;
                          }
                          if (updateFields.city !== undefined) {
                              body.City = updateFields.city;
                          }
                          if (updateFields.phone !== undefined) {
                              body.Phone = updateFields.phone;
                          }
                          if (updateFields.state !== undefined) {
                              body.State = updateFields.state;
                          }
                          if (updateFields.title !== undefined) {
                              body.Title = updateFields.title;
                          }
                          if (updateFields.jigsaw !== undefined) {
                              body.Jigsaw = updateFields.jigsaw;
                          }
                          if (updateFields.rating !== undefined) {
                              body.Rating = updateFields.rating;
                          }
                          if (updateFields.status !== undefined) {
                              body.Status = updateFields.status;
                          }
                          if (updateFields.street !== undefined) {
                              body.Street = updateFields.street;
                          }
                          if (updateFields.country !== undefined) {
                              body.Country = updateFields.country;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.website !== undefined) {
                              body.Website = updateFields.website;
                          }
                          if (updateFields.industry !== undefined) {
                              body.Industry = updateFields.industry;
                          }
                          if (updateFields.firstname !== undefined) {
                              body.FirstName = updateFields.firstname;
                          }
                          if (updateFields.fax !== undefined) {
                              body.Fax = updateFields.fax;
                          }
                          if (updateFields.leadSource !== undefined) {
                              body.LeadSource = updateFields.leadSource;
                          }
                          if (updateFields.postalCode !== undefined) {
                              body.PostalCode = updateFields.postalCode;
                          }
                          if (updateFields.salutation !== undefined) {
                              body.Salutation = updateFields.salutation;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = updateFields.annualRevenue;
                          }
                          if (updateFields.isUnreadByOwner !== undefined) {
                              body.IsUnreadByOwner = updateFields.isUnreadByOwner;
                          }
                          if (updateFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = updateFields.numberOfEmployees;
                          }
                          if (updateFields.mobilePhone !== undefined) {
                              body.MobilePhone = updateFields.mobilePhone;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/lead/${leadId}`, body);
                      }
                      if (operation === 'get') {
                          const leadId = this.getNodeParameter('leadId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/lead/${leadId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Lead', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Lead', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const leadId = this.getNodeParameter('leadId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/lead/${leadId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/lead');
                      }
                      if (operation === 'addToCampaign') {
                          const leadId = this.getNodeParameter('leadId', i);
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              LeadId: leadId,
                              CampaignId: campaignId,
                          };
                          if (options.status) {
                              body.Status = options.status;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/CampaignMember', body);
                      }
                      if (operation === 'addNote') {
                          const leadId = this.getNodeParameter('leadId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: leadId,
                          };
                          if (options.body) {
                              body.Body = options.body;
                          }
                          if (options.owner) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'contact') {
                      if (operation === 'create' || operation === 'upsert') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const lastname = this.getNodeParameter('lastname', i);
                          const body = {
                              LastName: lastname,
                          };
                          if (additionalFields.fax !== undefined) {
                              body.Fax = additionalFields.fax;
                          }
                          if (additionalFields.email !== undefined) {
                              body.Email = additionalFields.email;
                          }
                          if (additionalFields.phone !== undefined) {
                              body.Phone = additionalFields.phone;
                          }
                          if (additionalFields.title !== undefined) {
                              body.Title = additionalFields.title;
                          }
                          if (additionalFields.jigsaw !== undefined) {
                              body.Jigsaw = additionalFields.jigsaw;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.acconuntId !== undefined) {
                              body.AccountId = additionalFields.acconuntId;
                          }
                          if (additionalFields.birthdate !== undefined) {
                              body.Birthdate = additionalFields.birthdate;
                          }
                          if (additionalFields.firstName !== undefined) {
                              body.FirstName = additionalFields.firstName;
                          }
                          if (additionalFields.homePhone !== undefined) {
                              body.HomePhone = additionalFields.homePhone;
                          }
                          if (additionalFields.otherCity !== undefined) {
                              body.OtherCity = additionalFields.otherCity;
                          }
                          if (additionalFields.department !== undefined) {
                              body.Department = additionalFields.department;
                          }
                          if (additionalFields.leadSource !== undefined) {
                              body.LeadSource = additionalFields.leadSource;
                          }
                          if (additionalFields.otherPhone !== undefined) {
                              body.OtherPhone = additionalFields.otherPhone;
                          }
                          if (additionalFields.otherState !== undefined) {
                              body.OtherState = additionalFields.otherState;
                          }
                          if (additionalFields.salutation !== undefined) {
                              body.Salutation = additionalFields.salutation;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.mailingCity !== undefined) {
                              body.MailingCity = additionalFields.mailingCity;
                          }
                          if (additionalFields.mobilePhone !== undefined) {
                              body.MobilePhone = additionalFields.mobilePhone;
                          }
                          if (additionalFields.otherStreet !== undefined) {
                              body.OtherStreet = additionalFields.otherStreet;
                          }
                          if (additionalFields.mailingState !== undefined) {
                              body.MailingState = additionalFields.mailingState;
                          }
                          if (additionalFields.otherCountry !== undefined) {
                              body.OtherCountry = additionalFields.otherCountry;
                          }
                          if (additionalFields.assistantName !== undefined) {
                              body.AssistantName = additionalFields.assistantName;
                          }
                          if (additionalFields.mailingStreet !== undefined) {
                              body.MailingStreet = additionalFields.mailingStreet;
                          }
                          if (additionalFields.assistantPhone !== undefined) {
                              body.AssistantPhone = additionalFields.assistantPhone;
                          }
                          if (additionalFields.mailingCountry !== undefined) {
                              body.MailingCountry = additionalFields.mailingCountry;
                          }
                          if (additionalFields.otherPostalCode !== undefined) {
                              body.OtherPostalCode = additionalFields.otherPostalCode;
                          }
                          if (additionalFields.emailBouncedDate !== undefined) {
                              body.EmailBouncedDate = additionalFields.emailBouncedDate;
                          }
                          if (additionalFields.mailingPostalCode !== undefined) {
                              body.MailingPostalCode = additionalFields.mailingPostalCode;
                          }
                          if (additionalFields.emailBouncedReason !== undefined) {
                              body.EmailBouncedReason = additionalFields.emailBouncedReason;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/contact';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/contact/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (!Object.keys(updateFields).length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must add at least one update field', { itemIndex: i });
                          }
                          if (updateFields.lastName !== undefined) {
                              body.LastName = updateFields.lastName;
                          }
                          if (updateFields.fax !== undefined) {
                              body.Fax = updateFields.fax;
                          }
                          if (updateFields.email !== undefined) {
                              body.Email = updateFields.email;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.phone !== undefined) {
                              body.Phone = updateFields.phone;
                          }
                          if (updateFields.title !== undefined) {
                              body.Title = updateFields.title;
                          }
                          if (updateFields.jigsaw !== undefined) {
                              body.Jigsaw = updateFields.jigsaw;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.acconuntId !== undefined) {
                              body.AccountId = updateFields.acconuntId;
                          }
                          if (updateFields.birthdate !== undefined) {
                              body.Birthdate = updateFields.birthdate;
                          }
                          if (updateFields.firstName !== undefined) {
                              body.FirstName = updateFields.firstName;
                          }
                          if (updateFields.homePhone !== undefined) {
                              body.HomePhone = updateFields.homePhone;
                          }
                          if (updateFields.otherCity !== undefined) {
                              body.OtherCity = updateFields.otherCity;
                          }
                          if (updateFields.department !== undefined) {
                              body.Department = updateFields.department;
                          }
                          if (updateFields.leadSource !== undefined) {
                              body.LeadSource = updateFields.leadSource;
                          }
                          if (updateFields.otherPhone !== undefined) {
                              body.OtherPhone = updateFields.otherPhone;
                          }
                          if (updateFields.otherState !== undefined) {
                              body.OtherState = updateFields.otherState;
                          }
                          if (updateFields.salutation !== undefined) {
                              body.Salutation = updateFields.salutation;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.mailingCity !== undefined) {
                              body.MailingCity = updateFields.mailingCity;
                          }
                          if (updateFields.mobilePhone !== undefined) {
                              body.MobilePhone = updateFields.mobilePhone;
                          }
                          if (updateFields.otherStreet !== undefined) {
                              body.OtherStreet = updateFields.otherStreet;
                          }
                          if (updateFields.mailingState !== undefined) {
                              body.MailingState = updateFields.mailingState;
                          }
                          if (updateFields.otherCountry !== undefined) {
                              body.OtherCountry = updateFields.otherCountry;
                          }
                          if (updateFields.assistantName !== undefined) {
                              body.AssistantName = updateFields.assistantName;
                          }
                          if (updateFields.mailingStreet !== undefined) {
                              body.MailingStreet = updateFields.mailingStreet;
                          }
                          if (updateFields.assistantPhone !== undefined) {
                              body.AssistantPhone = updateFields.assistantPhone;
                          }
                          if (updateFields.mailingCountry !== undefined) {
                              body.MailingCountry = updateFields.mailingCountry;
                          }
                          if (updateFields.otherPostalCode !== undefined) {
                              body.OtherPostalCode = updateFields.otherPostalCode;
                          }
                          if (updateFields.emailBouncedDate !== undefined) {
                              body.EmailBouncedDate = updateFields.emailBouncedDate;
                          }
                          if (updateFields.mailingPostalCode !== undefined) {
                              body.MailingPostalCode = updateFields.mailingPostalCode;
                          }
                          if (updateFields.emailBouncedReason !== undefined) {
                              body.EmailBouncedReason = updateFields.emailBouncedReason;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/contact/${contactId}`, body);
                      }
                      if (operation === 'get') {
                          const contactId = this.getNodeParameter('contactId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/contact/${contactId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Contact', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Contact', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const contactId = this.getNodeParameter('contactId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/contact/${contactId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/contact');
                      }
                      if (operation === 'addToCampaign') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              ContactId: contactId,
                              CampaignId: campaignId,
                          };
                          if (options.status) {
                              body.Status = options.status;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/CampaignMember', body);
                      }
                      if (operation === 'addNote') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: contactId,
                          };
                          if (options.body !== undefined) {
                              body.Body = options.body;
                          }
                          if (options.owner !== undefined) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate !== undefined) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'customObject') {
                      if (operation === 'create' || operation === 'upsert') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const customFieldsUi = this.getNodeParameter('customFieldsUi', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          if (customFieldsUi) {
                              const customFields = customFieldsUi.customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          if (additionalFields.recordTypeId) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          let endpoint = `/sobjects/${customObject}`;
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/${customObject}/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const recordId = this.getNodeParameter('recordId', i);
                          const customObject = this.getNodeParameter('customObject', i);
                          const customFieldsUi = this.getNodeParameter('customFieldsUi', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.recordTypeId) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (customFieldsUi) {
                              const customFields = customFieldsUi.customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/${customObject}/${recordId}`, body);
                      }
                      if (operation === 'get') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const recordId = this.getNodeParameter('recordId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${customObject}/${recordId}`);
                      }
                      if (operation === 'getAll') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, customObject, returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, customObject, returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const recordId = this.getNodeParameter('recordId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/${customObject}/${recordId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                  }
                  if (resource === 'document') {
                      if (operation === 'upload') {
                          const title = this.getNodeParameter('title', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const body = {
                              entity_content: {
                                  Title: title,
                                  ContentLocation: 'S',
                              },
                          };
                          if (additionalFields.ownerId) {
                              body.entity_content.ownerId = additionalFields.ownerId;
                          }
                          if (additionalFields.linkToObjectId) {
                              body.entity_content.FirstPublishLocationId =
                                  additionalFields.linkToObjectId;
                          }
                          const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                          const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                          body.entity_content.PathOnClient = `${title}.${additionalFields.fileExtension || binaryData.fileExtension}`;
                          const data = {
                              entity_content: {
                                  value: JSON.stringify(body.entity_content),
                                  options: {
                                      contentType: 'application/json',
                                  },
                              },
                              VersionData: {
                                  value: dataBuffer,
                                  options: {
                                      filename: body.entity_content.PathOnClient,
                                  },
                              },
                          };
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/ContentVersion', {}, {}, undefined, { formData: data });
                      }
                  }
                  if (resource === 'opportunity') {
                      if (operation === 'create' || operation === 'upsert') {
                          const name = this.getNodeParameter('name', i);
                          const closeDate = this.getNodeParameter('closeDate', i);
                          const stageName = this.getNodeParameter('stageName', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              Name: name,
                              CloseDate: closeDate,
                              StageName: stageName,
                          };
                          if (additionalFields.type !== undefined) {
                              body.Type = additionalFields.type;
                          }
                          if (additionalFields.amount !== undefined) {
                              body.Amount = additionalFields.amount;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.nextStep !== undefined) {
                              body.NextStep = additionalFields.nextStep;
                          }
                          if (additionalFields.accountId !== undefined) {
                              body.AccountId = additionalFields.accountId;
                          }
                          if (additionalFields.campaignId !== undefined) {
                              body.CampaignId = additionalFields.campaignId;
                          }
                          if (additionalFields.leadSource !== undefined) {
                              body.LeadSource = additionalFields.leadSource;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.probability !== undefined) {
                              body.Probability = additionalFields.probability;
                          }
                          if (additionalFields.pricebook2Id !== undefined) {
                              body.Pricebook2Id = additionalFields.pricebook2Id;
                          }
                          if (additionalFields.forecastCategoryName !== undefined) {
                              body.ForecastCategoryName = additionalFields.forecastCategoryName;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/opportunity';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/opportunity/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.name !== undefined) {
                              body.Name = updateFields.name;
                          }
                          if (updateFields.closeDate !== undefined) {
                              body.CloseDate = updateFields.closeDate;
                          }
                          if (updateFields.stageName !== undefined) {
                              body.StageName = updateFields.stageName;
                          }
                          if (updateFields.type !== undefined) {
                              body.Type = updateFields.type;
                          }
                          if (updateFields.amount !== undefined) {
                              body.Amount = updateFields.amount;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.nextStep !== undefined) {
                              body.NextStep = updateFields.nextStep;
                          }
                          if (updateFields.accountId !== undefined) {
                              body.AccountId = updateFields.accountId;
                          }
                          if (updateFields.campaignId !== undefined) {
                              body.CampaignId = updateFields.campaignId;
                          }
                          if (updateFields.leadSource !== undefined) {
                              body.LeadSource = updateFields.leadSource;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.probability !== undefined) {
                              body.Probability = updateFields.probability;
                          }
                          if (updateFields.pricebook2Id !== undefined) {
                              body.Pricebook2Id = updateFields.pricebook2Id;
                          }
                          if (updateFields.forecastCategoryName !== undefined) {
                              body.ForecastCategoryName = updateFields.forecastCategoryName;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/opportunity/${opportunityId}`, body);
                      }
                      if (operation === 'get') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/opportunity/${opportunityId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Opportunity', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Opportunity', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/opportunity/${opportunityId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/opportunity');
                      }
                      if (operation === 'addNote') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: opportunityId,
                          };
                          if (options.body !== undefined) {
                              body.Body = options.body;
                          }
                          if (options.owner !== undefined) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate !== undefined) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'account') {
                      if (operation === 'create' || operation === 'upsert') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const name = this.getNodeParameter('name', i);
                          const body = {
                              Name: name,
                          };
                          if (additionalFields.fax !== undefined) {
                              body.Fax = additionalFields.fax;
                          }
                          if (additionalFields.type !== undefined) {
                              body.Type = additionalFields.type;
                          }
                          if (additionalFields.jigsaw !== undefined) {
                              body.Jigsaw = additionalFields.jigsaw;
                          }
                          if (additionalFields.phone !== undefined) {
                              body.Phone = additionalFields.phone;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.sicDesc !== undefined) {
                              body.SicDesc = additionalFields.sicDesc;
                          }
                          if (additionalFields.website !== undefined) {
                              body.Website = additionalFields.website;
                          }
                          if (additionalFields.industry !== undefined) {
                              body.Industry = additionalFields.industry;
                          }
                          if (additionalFields.parentId !== undefined) {
                              body.ParentId = additionalFields.parentId;
                          }
                          if (additionalFields.billingCity !== undefined) {
                              body.BillingCity = additionalFields.billingCity;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.billingState !== undefined) {
                              body.BillingState = additionalFields.billingState;
                          }
                          if (additionalFields.shippingCity !== undefined) {
                              body.ShippingCity = additionalFields.shippingCity;
                          }
                          if (additionalFields.accountNumber !== undefined) {
                              body.AccountNumber = additionalFields.accountNumber;
                          }
                          if (additionalFields.accountSource !== undefined) {
                              body.AccountSource = additionalFields.accountSource;
                          }
                          if (additionalFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = additionalFields.annualRevenue;
                          }
                          if (additionalFields.billingStreet !== undefined) {
                              body.BillingStreet = additionalFields.billingStreet;
                          }
                          if (additionalFields.shippingState !== undefined) {
                              body.ShippingState = additionalFields.shippingState;
                          }
                          if (additionalFields.billingCountry !== undefined) {
                              body.BillingCountry = additionalFields.billingCountry;
                          }
                          if (additionalFields.shippingStreet !== undefined) {
                              body.ShippingStreet = additionalFields.shippingStreet;
                          }
                          if (additionalFields.shippingCountry !== undefined) {
                              body.ShippingCountry = additionalFields.shippingCountry;
                          }
                          if (additionalFields.billingPostalCode !== undefined) {
                              body.BillingPostalCode = additionalFields.billingPostalCode;
                          }
                          if (additionalFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = additionalFields.numberOfEmployees;
                          }
                          if (additionalFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = additionalFields.shippingPostalCode;
                          }
                          if (additionalFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = additionalFields.shippingPostalCode;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/account';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/account/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const accountId = this.getNodeParameter('accountId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.name !== undefined) {
                              body.Name = updateFields.name;
                          }
                          if (updateFields.fax !== undefined) {
                              body.Fax = updateFields.fax;
                          }
                          if (updateFields.type !== undefined) {
                              body.Type = updateFields.type;
                          }
                          if (updateFields.jigsaw !== undefined) {
                              body.Jigsaw = updateFields.jigsaw;
                          }
                          if (updateFields.phone !== undefined) {
                              body.Phone = updateFields.phone;
                          }
                          if (updateFields.ownerId !== undefined) {
                              body.OwnerId = updateFields.ownerId;
                          }
                          if (updateFields.sicDesc !== undefined) {
                              body.SicDesc = updateFields.sicDesc;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.website !== undefined) {
                              body.Website = updateFields.website;
                          }
                          if (updateFields.industry !== undefined) {
                              body.Industry = updateFields.industry;
                          }
                          if (updateFields.parentId !== undefined) {
                              body.ParentId = updateFields.parentId;
                          }
                          if (updateFields.billingCity !== undefined) {
                              body.BillingCity = updateFields.billingCity;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.billingState !== undefined) {
                              body.BillingState = updateFields.billingState;
                          }
                          if (updateFields.shippingCity !== undefined) {
                              body.ShippingCity = updateFields.shippingCity;
                          }
                          if (updateFields.accountNumber !== undefined) {
                              body.AccountNumber = updateFields.accountNumber;
                          }
                          if (updateFields.accountSource !== undefined) {
                              body.AccountSource = updateFields.accountSource;
                          }
                          if (updateFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = updateFields.annualRevenue;
                          }
                          if (updateFields.billingStreet !== undefined) {
                              body.BillingStreet = updateFields.billingStreet;
                          }
                          if (updateFields.shippingState !== undefined) {
                              body.ShippingState = updateFields.shippingState;
                          }
                          if (updateFields.billingCountry !== undefined) {
                              body.BillingCountry = updateFields.billingCountry;
                          }
                          if (updateFields.shippingStreet !== undefined) {
                              body.ShippingStreet = updateFields.shippingStreet;
                          }
                          if (updateFields.shippingCountry !== undefined) {
                              body.ShippingCountry = updateFields.shippingCountry;
                          }
                          if (updateFields.billingPostalCode !== undefined) {
                              body.BillingPostalCode = updateFields.billingPostalCode;
                          }
                          if (updateFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = updateFields.numberOfEmployees;
                          }
                          if (updateFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = updateFields.shippingPostalCode;
                          }
                          if (updateFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = updateFields.shippingPostalCode;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/account/${accountId}`, body);
                      }
                      if (operation === 'get') {
                          const accountId = this.getNodeParameter('accountId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/account/${accountId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Account', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Account', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const accountId = this.getNodeParameter('accountId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/account/${accountId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account');
                      }
                      if (operation === 'addNote') {
                          const accountId = this.getNodeParameter('accountId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: accountId,
                          };
                          if (options.body !== undefined) {
                              body.Body = options.body;
                          }
                          if (options.owner !== undefined) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate !== undefined) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'case') {
                      if (operation === 'create') {
                          const type = this.getNodeParameter('type', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              Type: type,
                          };
                          if (additionalFields.origin !== undefined) {
                              body.Origin = additionalFields.origin;
                          }
                          if (additionalFields.reason !== undefined) {
                              body.Reason = additionalFields.reason;
                          }
                          if (additionalFields.status !== undefined) {
                              body.Status = additionalFields.status;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.subject !== undefined) {
                              body.Subject = additionalFields.subject;
                          }
                          if (additionalFields.parentId !== undefined) {
                              body.ParentId = additionalFields.parentId;
                          }
                          if (additionalFields.priority !== undefined) {
                              body.Priority = additionalFields.priority;
                          }
                          if (additionalFields.accountId !== undefined) {
                              body.AccountId = additionalFields.accountId;
                          }
                          if (additionalFields.contactId !== undefined) {
                              body.ContactId = additionalFields.contactId;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.isEscalated !== undefined) {
                              body.IsEscalated = additionalFields.isEscalated;
                          }
                          if (additionalFields.suppliedName !== undefined) {
                              body.SuppliedName = additionalFields.suppliedName;
                          }
                          if (additionalFields.suppliedEmail !== undefined) {
                              body.SuppliedEmail = additionalFields.suppliedEmail;
                          }
                          if (additionalFields.suppliedPhone !== undefined) {
                              body.SuppliedPhone = additionalFields.suppliedPhone;
                          }
                          if (additionalFields.suppliedCompany !== undefined) {
                              body.SuppliedCompany = additionalFields.suppliedCompany;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/case', body);
                      }
                      if (operation === 'update') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.type !== undefined) {
                              body.Type = updateFields.type;
                          }
                          if (updateFields.origin !== undefined) {
                              body.Origin = updateFields.origin;
                          }
                          if (updateFields.reason !== undefined) {
                              body.Reason = updateFields.reason;
                          }
                          if (updateFields.status !== undefined) {
                              body.Status = updateFields.status;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.subject !== undefined) {
                              body.Subject = updateFields.subject;
                          }
                          if (updateFields.parentId !== undefined) {
                              body.ParentId = updateFields.parentId;
                          }
                          if (updateFields.priority !== undefined) {
                              body.Priority = updateFields.priority;
                          }
                          if (updateFields.accountId !== undefined) {
                              body.AccountId = updateFields.accountId;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.contactId !== undefined) {
                              body.ContactId = updateFields.contactId;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.isEscalated !== undefined) {
                              body.IsEscalated = updateFields.isEscalated;
                          }
                          if (updateFields.suppliedName !== undefined) {
                              body.SuppliedName = updateFields.suppliedName;
                          }
                          if (updateFields.suppliedEmail !== undefined) {
                              body.SuppliedEmail = updateFields.suppliedEmail;
                          }
                          if (updateFields.suppliedPhone !== undefined) {
                              body.SuppliedPhone = updateFields.suppliedPhone;
                          }
                          if (updateFields.suppliedCompany !== undefined) {
                              body.SuppliedCompany = updateFields.suppliedCompany;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/case/${caseId}`, body);
                      }
                      if (operation === 'get') {
                          const caseId = this.getNodeParameter('caseId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/case/${caseId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Case', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Case', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const caseId = this.getNodeParameter('caseId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/case/${caseId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case');
                      }
                      if (operation === 'addComment') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              ParentId: caseId,
                          };
                          if (options.commentBody !== undefined) {
                              body.CommentBody = options.commentBody;
                          }
                          if (options.isPublished !== undefined) {
                              body.IsPublished = options.isPublished;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/casecomment', body);
                      }
                  }
                  if (resource === 'task') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const status = this.getNodeParameter('status', i);
                          const body = {
                              Status: status,
                          };
                          if (additionalFields.type !== undefined) {
                              body.TaskSubtype = additionalFields.type;
                          }
                          if (additionalFields.whoId !== undefined) {
                              body.WhoId = additionalFields.whoId;
                          }
                          if (additionalFields.whatId !== undefined) {
                              body.WhatId = additionalFields.whatId;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.subject !== undefined) {
                              body.Subject = additionalFields.subject;
                          }
                          if (additionalFields.callType !== undefined) {
                              body.CallType = additionalFields.callType;
                          }
                          if (additionalFields.priority !== undefined) {
                              body.Priority = additionalFields.priority;
                          }
                          if (additionalFields.callObject !== undefined) {
                              body.CallObject = additionalFields.callObject;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.activityDate !== undefined) {
                              body.ActivityDate = additionalFields.activityDate;
                          }
                          if (additionalFields.isReminderSet !== undefined) {
                              body.IsReminderSet = additionalFields.isReminderSet;
                          }
                          if (additionalFields.recurrenceType !== undefined) {
                              body.RecurrenceType = additionalFields.recurrenceType;
                          }
                          if (additionalFields.callDisposition !== undefined) {
                              body.CallDisposition = additionalFields.callDisposition;
                          }
                          if (additionalFields.reminderDateTime !== undefined) {
                              body.ReminderDateTime = additionalFields.reminderDateTime;
                          }
                          if (additionalFields.recurrenceInstance !== undefined) {
                              body.RecurrenceInstance = additionalFields.recurrenceInstance;
                          }
                          if (additionalFields.recurrenceInterval !== undefined) {
                              body.RecurrenceInterval = additionalFields.recurrenceInterval;
                          }
                          if (additionalFields.recurrenceDayOfMonth !== undefined) {
                              body.RecurrenceDayOfMonth = additionalFields.recurrenceDayOfMonth;
                          }
                          if (additionalFields.callDurationInSeconds !== undefined) {
                              body.CallDurationInSeconds = additionalFields.callDurationInSeconds;
                          }
                          if (additionalFields.recurrenceEndDateOnly !== undefined) {
                              body.RecurrenceEndDateOnly = additionalFields.recurrenceEndDateOnly;
                          }
                          if (additionalFields.recurrenceMonthOfYear !== undefined) {
                              body.RecurrenceMonthOfYear = additionalFields.recurrenceMonthOfYear;
                          }
                          if (additionalFields.recurrenceDayOfWeekMask !== undefined) {
                              body.RecurrenceDayOfWeekMask = additionalFields.recurrenceDayOfWeekMask;
                          }
                          if (additionalFields.recurrenceStartDateOnly !== undefined) {
                              body.RecurrenceStartDateOnly = additionalFields.recurrenceStartDateOnly;
                          }
                          if (additionalFields.recurrenceTimeZoneSidKey !== undefined) {
                              body.RecurrenceTimeZoneSidKey = additionalFields.recurrenceTimeZoneSidKey;
                          }
                          if (additionalFields.recurrenceRegeneratedType !== undefined) {
                              body.RecurrenceRegeneratedType = additionalFields.recurrenceRegeneratedType;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/task', body);
                      }
                      if (operation === 'update') {
                          const taskId = this.getNodeParameter('taskId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.type !== undefined) {
                              body.TaskSubtype = updateFields.type;
                          }
                          if (updateFields.whoId !== undefined) {
                              body.WhoId = updateFields.whoId;
                          }
                          if (updateFields.status !== undefined) {
                              body.Status = updateFields.status;
                          }
                          if (updateFields.whatId !== undefined) {
                              body.WhatId = updateFields.whatId;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.subject !== undefined) {
                              body.Subject = updateFields.subject;
                          }
                          if (updateFields.callType !== undefined) {
                              body.CallType = updateFields.callType;
                          }
                          if (updateFields.priority !== undefined) {
                              body.Priority = updateFields.priority;
                          }
                          if (updateFields.callObject !== undefined) {
                              body.CallObject = updateFields.callObject;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.activityDate !== undefined) {
                              body.ActivityDate = updateFields.activityDate;
                          }
                          if (updateFields.isReminderSet !== undefined) {
                              body.IsReminderSet = updateFields.isReminderSet;
                          }
                          if (updateFields.recurrenceType !== undefined) {
                              body.RecurrenceType = updateFields.recurrenceType;
                          }
                          if (updateFields.callDisposition !== undefined) {
                              body.CallDisposition = updateFields.callDisposition;
                          }
                          if (updateFields.reminderDateTime !== undefined) {
                              body.ReminderDateTime = updateFields.reminderDateTime;
                          }
                          if (updateFields.recurrenceInstance !== undefined) {
                              body.RecurrenceInstance = updateFields.recurrenceInstance;
                          }
                          if (updateFields.recurrenceInterval !== undefined) {
                              body.RecurrenceInterval = updateFields.recurrenceInterval;
                          }
                          if (updateFields.recurrenceDayOfMonth !== undefined) {
                              body.RecurrenceDayOfMonth = updateFields.recurrenceDayOfMonth;
                          }
                          if (updateFields.callDurationInSeconds !== undefined) {
                              body.CallDurationInSeconds = updateFields.callDurationInSeconds;
                          }
                          if (updateFields.recurrenceEndDateOnly !== undefined) {
                              body.RecurrenceEndDateOnly = updateFields.recurrenceEndDateOnly;
                          }
                          if (updateFields.recurrenceMonthOfYear !== undefined) {
                              body.RecurrenceMonthOfYear = updateFields.recurrenceMonthOfYear;
                          }
                          if (updateFields.recurrenceDayOfWeekMask !== undefined) {
                              body.RecurrenceDayOfWeekMask = updateFields.recurrenceDayOfWeekMask;
                          }
                          if (updateFields.recurrenceStartDateOnly !== undefined) {
                              body.RecurrenceStartDateOnly = updateFields.recurrenceStartDateOnly;
                          }
                          if (updateFields.recurrenceTimeZoneSidKey !== undefined) {
                              body.RecurrenceTimeZoneSidKey = updateFields.recurrenceTimeZoneSidKey;
                          }
                          if (updateFields.recurrenceRegeneratedType !== undefined) {
                              body.RecurrenceRegeneratedType = updateFields.recurrenceRegeneratedType;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/task/${taskId}`, body);
                      }
                      if (operation === 'get') {
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/task/${taskId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Task', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Task', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const taskId = this.getNodeParameter('taskId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/task/${taskId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task');
                      }
                  }
                  if (resource === 'attachment') {
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const parentId = this.getNodeParameter('parentId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const body = {
                              Name: name,
                              ParentId: parentId,
                          };
                          if (items[i].binary && items[i].binary[binaryPropertyName]) {
                              body.Body = items[i].binary[binaryPropertyName].data;
                              body.ContentType = items[i].binary[binaryPropertyName].mimeType;
                          }
                          else {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i });
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.isPrivate !== undefined) {
                              body.IsPrivate = additionalFields.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/attachment', body);
                      }
                      if (operation === 'update') {
                          const attachmentId = this.getNodeParameter('attachmentId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.binaryPropertyName !== undefined) {
                              const binaryPropertyName = updateFields.binaryPropertyName;
                              if (items[i].binary && items[i].binary[binaryPropertyName]) {
                                  body.Body = items[i].binary[binaryPropertyName].data;
                                  body.ContentType = items[i].binary[binaryPropertyName].mimeType;
                              }
                              else {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i });
                              }
                          }
                          if (updateFields.name !== undefined) {
                              body.Name = updateFields.name;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.isPrivate !== undefined) {
                              body.IsPrivate = updateFields.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/attachment/${attachmentId}`, body);
                      }
                      if (operation === 'get') {
                          const attachmentId = this.getNodeParameter('attachmentId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/attachment/${attachmentId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Attachment', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Attachment', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const attachmentId = this.getNodeParameter('attachmentId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/attachment/${attachmentId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/attachment');
                      }
                  }
                  if (resource === 'user') {
                      if (operation === 'get') {
                          const userId = this.getNodeParameter('userId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/user/${userId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'User', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'User', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                  }
                  if (resource === 'flow') {
                      if (operation === 'invoke') {
                          const apiName = this.getNodeParameter('apiName', i);
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          let variables = {};
                          if (jsonParameters) {
                              variables = this.getNodeParameter('variablesJson', i);
                          }
                          else {
                              const setInputVariable = this.getNodeParameter('variablesUi', i, {});
                              if (setInputVariable.variablesValues !== undefined) {
                                  for (const inputVariableData of setInputVariable.variablesValues) {
                                      variables[inputVariableData.name] = inputVariableData.value;
                                  }
                              }
                          }
                          const body = {
                              inputs: [variables],
                          };
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', `/actions/custom/flow/${apiName}`, body);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/actions/custom/flow');
                          responseData = responseData.actions;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                  }
                  if (resource === 'search') {
                      if (operation === 'query') {
                          qs.q = this.getNodeParameter('query', i);
                          responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      }
                  }
                  if (!Array.isArray(responseData) && responseData === undefined) {
                      responseData = {
                          errors: [],
                          success: true,
                      };
                  }
                  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.Salesforce = Salesforce;
  //# sourceMappingURL=Salesforce.node.js.map

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


