# nodes

node_type: n8n-nodes-base.Salesmate
name: Salesmate
package_name: n8n-nodes-base
display_name: Salesmate
description: Consume Salesmate API
code_hash: ac0be2ad778e6daabce9912980fc92e4f611c33f6c7b4e7ba0ee80316f412075
source_location: node_modules/n8n-nodes-base/dist/nodes/Salesmate/Salesmate.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.Salesmate = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const CompanyDescription_1 = require("./CompanyDescription");
  const ActivityDescription_1 = require("./ActivityDescription");
  const DealDescription_1 = require("./DealDescription");
  class Salesmate {
      constructor() {
          this.description = {
              displayName: 'Salesmate',
              name: 'salesmate',
              icon: 'file:salesmate.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
              description: 'Consume Salesmate API',
              defaults: {
                  name: 'Salesmate',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'salesmateApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Activity',
                              value: 'activity',
                          },
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Deal',
                              value: 'deal',
                          },
                      ],
                      default: 'activity',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...ActivityDescription_1.activityOperations,
                  ...DealDescription_1.dealOperations,
                  ...CompanyDescription_1.companyFields,
                  ...ActivityDescription_1.activityFields,
                  ...DealDescription_1.dealFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getUsers() {
                      const returnData = [];
                      const users = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', '/v1/users/active');
                      for (const user of users.Data) {
                          const userName = user.nickname;
                          const userId = user.id;
                          returnData.push({
                              name: userName,
                              value: userId,
                          });
                      }
                      return returnData;
                  },
                  async getContacts() {
                      const returnData = [];
                      const qs = {
                          fields: ['name', 'id'],
                          query: {},
                      };
                      const contacts = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/contacts/search', qs);
                      for (const contact of contacts.Data.data) {
                          const contactName = contact.name;
                          const contactId = contact.id;
                          returnData.push({
                              name: contactName,
                              value: contactId,
                          });
                      }
                      return returnData;
                  },
                  async getCompanies() {
                      const returnData = [];
                      const qs = {
                          fields: ['name', 'id'],
                          query: {},
                      };
                      const companies = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/companies/search', qs);
                      for (const company of companies.Data.data) {
                          const companyName = company.name;
                          const companyId = company.id;
                          returnData.push({
                              name: companyName,
                              value: companyId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'company') {
                  if (operation === 'create') {
                      const owner = this.getNodeParameter('owner', i);
                      const name = this.getNodeParameter('name', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          name,
                          owner,
                      };
                      if (additionalFields.website) {
                          body.website = additionalFields.website;
                      }
                      if (additionalFields.phone) {
                          body.phone = additionalFields.phone;
                      }
                      if (additionalFields.otherPhone) {
                          body.otherPhone = additionalFields.otherPhone;
                      }
                      if (additionalFields.facebookHandle) {
                          body.facebookHandle = additionalFields.facebookHandle;
                      }
                      if (additionalFields.googlePlusHandle) {
                          body.googlePlusHandle = additionalFields.googlePlusHandle;
                      }
                      if (additionalFields.linkedInHandle) {
                          body.linkedInHandle = additionalFields.linkedInHandle;
                      }
                      if (additionalFields.skypeId) {
                          body.skypeId = additionalFields.skypeId;
                      }
                      if (additionalFields.twitterHandle) {
                          body.twitterHandle = additionalFields.twitterHandle;
                      }
                      if (additionalFields.currency) {
                          body.currency = additionalFields.currency;
                      }
                      if (additionalFields.billingAddressLine1) {
                          body.billingAddressLine1 = additionalFields.billingAddressLine1;
                      }
                      if (additionalFields.billingAddressLine2) {
                          body.billingAddressLine2 = additionalFields.billingAddressLine2;
                      }
                      if (additionalFields.billingCity) {
                          body.billingCity = additionalFields.billingCity;
                      }
                      if (additionalFields.billingZipCode) {
                          body.billingZipCode = additionalFields.billingZipCode;
                      }
                      if (additionalFields.billingState) {
                          body.billingState = additionalFields.billingState;
                      }
                      if (additionalFields.description) {
                          body.description = additionalFields.description;
                      }
                      if (additionalFields.tags) {
                          body.tags = additionalFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v1/companies', body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'update') {
                      const companyId = this.getNodeParameter('id', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const body = {};
                      if (updateFields.owner) {
                          body.owner = updateFields.owner;
                      }
                      if (updateFields.name) {
                          body.name = updateFields.name;
                      }
                      if (updateFields.website) {
                          body.website = updateFields.website;
                      }
                      if (updateFields.phone) {
                          body.phone = updateFields.phone;
                      }
                      if (updateFields.otherPhone) {
                          body.otherPhone = updateFields.otherPhone;
                      }
                      if (updateFields.facebookHandle) {
                          body.facebookHandle = updateFields.facebookHandle;
                      }
                      if (updateFields.googlePlusHandle) {
                          body.googlePlusHandle = updateFields.googlePlusHandle;
                      }
                      if (updateFields.linkedInHandle) {
                          body.linkedInHandle = updateFields.linkedInHandle;
                      }
                      if (updateFields.skypeId) {
                          body.skypeId = updateFields.skypeId;
                      }
                      if (updateFields.twitterHandle) {
                          body.twitterHandle = updateFields.twitterHandle;
                      }
                      if (updateFields.currency) {
                          body.currency = updateFields.currency;
                      }
                      if (updateFields.billingAddressLine1) {
                          body.billingAddressLine1 = updateFields.billingAddressLine1;
                      }
                      if (updateFields.billingAddressLine2) {
                          body.billingAddressLine2 = updateFields.billingAddressLine2;
                      }
                      if (updateFields.billingCity) {
                          body.billingCity = updateFields.billingCity;
                      }
                      if (updateFields.billingZipCode) {
                          body.billingZipCode = updateFields.billingZipCode;
                      }
                      if (updateFields.billingState) {
                          body.billingState = updateFields.billingState;
                      }
                      if (updateFields.description) {
                          body.description = updateFields.description;
                      }
                      if (updateFields.tags) {
                          body.tags = updateFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'PUT', `/v1/companies/${companyId}`, body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'get') {
                      const companyId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', `/v1/companies/${companyId}`);
                      responseData = responseData.Data;
                      if (!rawData) {
                          responseData = (0, GenericFunctions_1.simplifySalesmateData)(responseData);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      let body = {
                          query: {
                              group: {},
                          },
                      };
                      if (options.sortBy) {
                          qs.sortBy = options.sortBy;
                      }
                      if (options.sortOrder) {
                          qs.sortOrder = options.sortOrder;
                      }
                      if (options.fields) {
                          if (options.fields.trim() === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to add at least one field', {
                                  itemIndex: i,
                              });
                          }
                          body.fields = options.fields.split(',');
                      }
                      else {
                          body.fields = [
                              'name',
                              'description',
                              'billingAddressLine1',
                              'billingAddressLine2',
                              'billingCity',
                              'billingZipCode',
                              'billingState',
                              'billingCountry',
                              'website',
                              'owner',
                              'tags',
                              'photo',
                              'createdAt',
                          ];
                      }
                      if (!jsonActive) {
                          const filters = [];
                          const filtersUi = this.getNodeParameter('filters', i).filtersUi;
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.conditions) {
                              const conditions = filtersUi.conditions;
                              if (conditions.conditionsUi) {
                                  for (const condition of conditions.conditionsUi) {
                                      const filter = {};
                                      filter.moduleName = 'Company';
                                      filter.field = {
                                          fieldName: condition.field,
                                      };
                                      filter.condition = condition.condition;
                                      filter.data = condition.value;
                                      filters.push(filter);
                                  }
                              }
                          }
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.operator) {
                              body.query.group = {
                                  operator: filtersUi.operator,
                                  rules: filters,
                              };
                          }
                      }
                      else {
                          const json = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('filtersJson', i));
                          body = json;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.salesmateApiRequestAllItems.call(this, 'Data', 'POST', '/v2/companies/search', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.rows = limit;
                          responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/companies/search', body, qs);
                          responseData = responseData.Data.data;
                      }
                  }
                  if (operation === 'delete') {
                      const companyId = parseInt(this.getNodeParameter('id', i), 10);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'DELETE', `/v1/companies/${companyId}`);
                  }
              }
              if (resource === 'activity') {
                  if (operation === 'create') {
                      const owner = this.getNodeParameter('owner', i);
                      const title = this.getNodeParameter('title', i);
                      const type = this.getNodeParameter('type', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          title,
                          owner,
                          type,
                      };
                      if (additionalFields.dueDate) {
                          body.dueDate = new Date(additionalFields.dueDate).getTime();
                      }
                      if (additionalFields.duration) {
                          body.duration = additionalFields.duration;
                      }
                      if (additionalFields.isCalendarInvite) {
                          body.isCalendarInvite = additionalFields.isCalendarInvite;
                      }
                      if (additionalFields.isCompleted) {
                          body.isCompleted = additionalFields.isCompleted;
                      }
                      if (additionalFields.description) {
                          body.description = additionalFields.description;
                      }
                      if (additionalFields.tags) {
                          body.tags = additionalFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v1/activities', body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'update') {
                      const activityId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = {};
                      if (updateFields.title) {
                          body.title = updateFields.title;
                      }
                      if (updateFields.type) {
                          body.type = updateFields.type;
                      }
                      if (updateFields.owner) {
                          body.owner = updateFields.owner;
                      }
                      if (updateFields.dueDate) {
                          body.dueDate = new Date(updateFields.dueDate).getTime();
                      }
                      if (updateFields.duration) {
                          body.duration = updateFields.duration;
                      }
                      if (updateFields.isCalendarInvite) {
                          body.isCalendarInvite = updateFields.isCalendarInvite;
                      }
                      if (updateFields.isCompleted) {
                          body.isCompleted = updateFields.isCompleted;
                      }
                      if (updateFields.description) {
                          body.description = updateFields.description;
                      }
                      if (updateFields.tags) {
                          body.tags = updateFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'PUT', `/v1/activities/${activityId}`, body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'get') {
                      const activityId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', `/v1/activities/${activityId}`);
                      responseData = responseData.Data;
                      if (!rawData) {
                          responseData = (0, GenericFunctions_1.simplifySalesmateData)(responseData);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      let body = {
                          query: {
                              group: {},
                          },
                      };
                      if (options.sortBy) {
                          qs.sortBy = options.sortBy;
                      }
                      if (options.sortOrder) {
                          qs.sortOrder = options.sortOrder;
                      }
                      if (options.fields) {
                          if (options.fields.trim() === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to add at least one field', {
                                  itemIndex: i,
                              });
                          }
                          body.fields = options.fields.split(',');
                      }
                      else {
                          body.fields = [
                              'title',
                              'dueDate',
                              'description',
                              'duration',
                              'owner',
                              'Deal.title',
                              'PrimaryContact.name',
                              'PrimaryContact.email',
                              'PrimaryCompany.name',
                              'PrimaryCompany.email',
                              'tags',
                              'type',
                              'createdAt',
                              'isCompleted',
                          ];
                      }
                      if (!jsonActive) {
                          const filters = [];
                          const filtersUi = this.getNodeParameter('filters', i).filtersUi;
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.conditions) {
                              const conditions = filtersUi.conditions;
                              if (conditions.conditionsUi) {
                                  for (const condition of conditions.conditionsUi) {
                                      const filter = {};
                                      filter.moduleName = 'Task';
                                      filter.field = {
                                          fieldName: condition.field,
                                      };
                                      filter.condition = condition.condition;
                                      filter.data = condition.value;
                                      filters.push(filter);
                                  }
                              }
                          }
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.operator) {
                              body.query.group = {
                                  operator: filtersUi.operator,
                                  rules: filters,
                              };
                          }
                      }
                      else {
                          const json = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('filtersJson', i));
                          body = json;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.salesmateApiRequestAllItems.call(this, 'Data', 'POST', '/v2/activities/search', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.rows = limit;
                          responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/activities/search', body, qs);
                          responseData = responseData.Data.data;
                      }
                  }
                  if (operation === 'delete') {
                      const activityId = this.getNodeParameter('id', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'DELETE', `/v1/activities/${activityId}`);
                  }
              }
              if (resource === 'deal') {
                  if (operation === 'create') {
                      const title = this.getNodeParameter('title', i);
                      const owner = this.getNodeParameter('owner', i);
                      const primaryContact = this.getNodeParameter('primaryContact', i);
                      const pipeline = this.getNodeParameter('pipeline', i);
                      const status = this.getNodeParameter('status', i);
                      const stage = this.getNodeParameter('stage', i);
                      const currency = this.getNodeParameter('currency', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          title,
                          owner,
                          primaryContact,
                          pipeline,
                          status,
                          stage,
                          currency,
                      };
                      if (additionalFields.description) {
                          body.description = additionalFields.description;
                      }
                      if (additionalFields.tags) {
                          body.tags = additionalFields.tags;
                      }
                      if (additionalFields.primaryCompany) {
                          body.primaryCompany = additionalFields.primaryCompany;
                      }
                      if (additionalFields.source) {
                          body.source = additionalFields.source;
                      }
                      if (additionalFields.estimatedCloseDate) {
                          body.estimatedCloseDate = additionalFields.estimatedCloseDate;
                      }
                      if (additionalFields.dealValue) {
                          body.dealValue = additionalFields.dealValue;
                      }
                      if (additionalFields.priority) {
                          body.priority = additionalFields.priority;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v1/deals', body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'update') {
                      const dealId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = {};
                      if (updateFields.title) {
                          body.title = updateFields.title;
                      }
                      if (updateFields.owner) {
                          body.owner = updateFields.owner;
                      }
                      if (updateFields.primaryContact) {
                          body.primaryContact = updateFields.primaryContact;
                      }
                      if (updateFields.status) {
                          body.status = updateFields.status;
                      }
                      if (updateFields.currency) {
                          body.currency = updateFields.currency;
                      }
                      if (updateFields.stage) {
                          body.stage = updateFields.stage;
                      }
                      if (updateFields.pipeline) {
                          body.pipeline = updateFields.pipeline;
                      }
                      if (updateFields.description) {
                          body.description = updateFields.description;
                      }
                      if (updateFields.tags) {
                          body.tags = updateFields.tags;
                      }
                      if (updateFields.primaryCompany) {
                          body.primaryCompany = updateFields.primaryCompany;
                      }
                      if (updateFields.source) {
                          body.source = updateFields.source;
                      }
                      if (updateFields.estimatedCloseDate) {
                          body.estimatedCloseDate = updateFields.estimatedCloseDate;
                      }
                      if (updateFields.dealValue) {
                          body.dealValue = updateFields.dealValue;
                      }
                      if (updateFields.priority) {
                          body.priority = updateFields.priority;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'PUT', `/v1/deals/${dealId}`, body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'get') {
                      const dealId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', `/v1/deals/${dealId}`);
                      responseData = responseData.Data;
                      if (!rawData) {
                          responseData = (0, GenericFunctions_1.simplifySalesmateData)(responseData);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      let body = {
                          query: {
                              group: {},
                          },
                      };
                      if (options.sortBy) {
                          qs.sortBy = options.sortBy;
                      }
                      if (options.sortOrder) {
                          qs.sortOrder = options.sortOrder;
                      }
                      if (options.fields !== undefined) {
                          if (options.fields.trim() === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to add at least one field', {
                                  itemIndex: i,
                              });
                          }
                          body.fields = options.fields.split(',');
                      }
                      else {
                          body.fields = [
                              'title',
                              'PrimaryContact.name',
                              'PrimaryContact.email',
                              'PrimaryCompany.name',
                              'PrimaryCompany.email',
                              'dealValue',
                              'priority',
                              'stage',
                              'status',
                              'owner',
                              'tags',
                              'createdAt',
                          ];
                      }
                      if (!jsonActive) {
                          const filters = [];
                          const filtersUi = this.getNodeParameter('filters', i).filtersUi;
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.conditions) {
                              const conditions = filtersUi.conditions;
                              if (conditions.conditionsUi) {
                                  for (const condition of conditions.conditionsUi) {
                                      const filter = {};
                                      filter.moduleName = 'Task';
                                      filter.field = {
                                          fieldName: condition.field,
                                      };
                                      filter.condition = condition.condition;
                                      filter.data = condition.value;
                                      filters.push(filter);
                                  }
                              }
                          }
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.operator) {
                              body.query.group = {
                                  operator: filtersUi.operator,
                                  rules: filters,
                              };
                          }
                      }
                      else {
                          const json = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('filtersJson', i));
                          body = json;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.salesmateApiRequestAllItems.call(this, 'Data', 'POST', '/v2/deals/search', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.rows = limit;
                          responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/deals/search', body, qs);
                          responseData = responseData.Data.data;
                      }
                  }
                  if (operation === 'delete') {
                      const dealId = this.getNodeParameter('id', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'DELETE', `/v1/deals/${dealId}`);
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Salesmate = Salesmate;
  //# sourceMappingURL=Salesmate.node.js.map

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


node_type: n8n-nodes-base.SeaTable
name: SeaTable
package_name: n8n-nodes-base
display_name: SeaTable
description: Consume the SeaTable API
code_hash: 2838fa6931fb12f6c56a751f7251d2eed63f2f2160f055204f3a37ef31dd043a
source_location: node_modules/n8n-nodes-base/dist/nodes/SeaTable/SeaTable.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.SeaTable = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const RowDescription_1 = require("./RowDescription");
  class SeaTable {
      constructor() {
          this.description = {
              displayName: 'SeaTable',
              name: 'seaTable',
              icon: 'file:seaTable.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume the SeaTable API',
              defaults: {
                  name: 'SeaTable',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'seaTableApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Row',
                              value: 'row',
                          },
                      ],
                      default: 'row',
                  },
                  ...RowDescription_1.rowOperations,
                  ...RowDescription_1.rowFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTableNames() {
                      const returnData = [];
                      const { metadata: { tables }, } = await GenericFunctions_1.seaTableApiRequest.call(this, {}, 'GET', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/metadata');
                      for (const table of tables) {
                          returnData.push({
                              name: table.name,
                              value: table.name,
                          });
                      }
                      return returnData;
                  },
                  async getTableIds() {
                      const returnData = [];
                      const { metadata: { tables }, } = await GenericFunctions_1.seaTableApiRequest.call(this, {}, 'GET', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/metadata');
                      for (const table of tables) {
                          returnData.push({
                              name: table.name,
                              value: table._id,
                          });
                      }
                      return returnData;
                  },
                  async getTableUpdateAbleColumns() {
                      const tableName = this.getNodeParameter('tableName');
                      const columns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                      return columns
                          .filter((column) => column.editable)
                          .map((column) => ({ name: column.name, value: column.name }));
                  },
                  async getAllSortableColumns() {
                      const tableName = this.getNodeParameter('tableName');
                      const columns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                      return columns
                          .filter((column) => !['file', 'image', 'url', 'collaborator', 'long-text'].includes(column.type))
                          .map((column) => ({ name: column.name, value: column.name }));
                  },
                  async getViews() {
                      const tableName = this.getNodeParameter('tableName');
                      const views = await GenericFunctions_1.getTableViews.call(this, tableName);
                      return views.map((view) => ({ name: view.name, value: view.name }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const body = {};
          const qs = {};
          const ctx = {};
          if (resource === 'row') {
              if (operation === 'create') {
                  const tableName = this.getNodeParameter('tableName', 0);
                  const tableColumns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                  body.table_name = tableName;
                  const fieldsToSend = this.getNodeParameter('fieldsToSend', 0);
                  let rowInput = {};
                  for (let i = 0; i < items.length; i++) {
                      rowInput = {};
                      try {
                          if (fieldsToSend === 'autoMapInputData') {
                              const incomingKeys = Object.keys(items[i].json);
                              const inputDataToIgnore = (0, GenericFunctions_1.split)(this.getNodeParameter('inputsToIgnore', i, ''));
                              for (const key of incomingKeys) {
                                  if (inputDataToIgnore.includes(key))
                                      continue;
                                  rowInput[key] = items[i].json[key];
                              }
                          }
                          else {
                              const columns = this.getNodeParameter('columnsUi.columnValues', i, []);
                              for (const column of columns) {
                                  rowInput[column.columnName] = column.columnValue;
                              }
                          }
                          body.row = (0, GenericFunctions_1.rowExport)(rowInput, (0, GenericFunctions_1.updateAble)(tableColumns));
                          responseData = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'POST', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/', body);
                          const { _id: insertId } = responseData;
                          if (insertId === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'SeaTable: No identity after appending row.', { itemIndex: i });
                          }
                          const newRowInsertData = (0, GenericFunctions_1.rowMapKeyToName)(responseData, tableColumns);
                          qs.table_name = tableName;
                          qs.convert = true;
                          const newRow = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'GET', `/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/${encodeURIComponent(insertId)}/`, body, qs);
                          if (newRow._id === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'SeaTable: No identity for appended row.', { itemIndex: i });
                          }
                          const row = (0, GenericFunctions_1.rowFormatColumns)({ ...newRowInsertData, ...newRow }, tableColumns.map(({ name }) => name).concat(['_id', '_ctime', '_mtime']));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(row), { 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;
                      }
                  }
              }
              else if (operation === 'get') {
                  for (let i = 0; i < items.length; i++) {
                      try {
                          const tableId = this.getNodeParameter('tableId', 0);
                          const rowId = this.getNodeParameter('rowId', i);
                          const response = (await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'GET', `/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/${rowId}`, {}, { table_id: tableId, convert: true }));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), { 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;
                      }
                  }
              }
              else if (operation === 'getAll') {
                  const tableName = this.getNodeParameter('tableName', 0);
                  const tableColumns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                  for (let i = 0; i < items.length; i++) {
                      try {
                          const endpoint = '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/';
                          qs.table_name = tableName;
                          const filters = this.getNodeParameter('filters', i);
                          const options = this.getNodeParameter('options', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          Object.assign(qs, filters, options);
                          if (qs.convert_link_id === false) {
                              delete qs.convert_link_id;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.setableApiRequestAllItems.call(this, ctx, 'rows', 'GET', endpoint, body, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'GET', endpoint, body, qs);
                              responseData = responseData.rows;
                          }
                          const rows = responseData.map((row) => (0, GenericFunctions_1.rowFormatColumns)({ ...row }, tableColumns.map(({ name }) => name).concat(['_id', '_ctime', '_mtime'])));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(rows), { 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);
                          }
                          throw error;
                      }
                  }
              }
              else if (operation === 'delete') {
                  for (let i = 0; i < items.length; i++) {
                      try {
                          const tableName = this.getNodeParameter('tableName', 0);
                          const rowId = this.getNodeParameter('rowId', i);
                          const requestBody = {
                              table_name: tableName,
                              row_id: rowId,
                          };
                          const response = (await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'DELETE', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/', requestBody, qs));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), { 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;
                      }
                  }
              }
              else if (operation === 'update') {
                  const tableName = this.getNodeParameter('tableName', 0);
                  const tableColumns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                  body.table_name = tableName;
                  const fieldsToSend = this.getNodeParameter('fieldsToSend', 0);
                  let rowInput = {};
                  for (let i = 0; i < items.length; i++) {
                      const rowId = this.getNodeParameter('rowId', i);
                      rowInput = {};
                      try {
                          if (fieldsToSend === 'autoMapInputData') {
                              const incomingKeys = Object.keys(items[i].json);
                              const inputDataToIgnore = (0, GenericFunctions_1.split)(this.getNodeParameter('inputsToIgnore', i, ''));
                              for (const key of incomingKeys) {
                                  if (inputDataToIgnore.includes(key))
                                      continue;
                                  rowInput[key] = items[i].json[key];
                              }
                          }
                          else {
                              const columns = this.getNodeParameter('columnsUi.columnValues', i, []);
                              for (const column of columns) {
                                  rowInput[column.columnName] = column.columnValue;
                              }
                          }
                          body.row = (0, GenericFunctions_1.rowExport)(rowInput, (0, GenericFunctions_1.updateAble)(tableColumns));
                          body.table_name = tableName;
                          body.row_id = rowId;
                          responseData = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'PUT', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/', body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ _id: rowId, ...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;
                      }
                  }
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`);
              }
          }
          return [returnData];
      }
  }
  exports.SeaTable = SeaTable;
  //# sourceMappingURL=SeaTable.node.js.map

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


node_type: n8n-nodes-base.SecurityScorecard
name: SecurityScorecard
package_name: n8n-nodes-base
display_name: SecurityScorecard
description: Consume SecurityScorecard API
code_hash: 126925cdb415faf27b54c0587590eb72f3a0a7a7be4adb9f5ffbc6121152ca14
source_location: node_modules/n8n-nodes-base/dist/nodes/SecurityScorecard/SecurityScorecard.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.SecurityScorecard = void 0;
  const CompanyDescription_1 = require("./descriptions/CompanyDescription");
  const IndustryDescription_1 = require("./descriptions/IndustryDescription");
  const InviteDescription_1 = require("./descriptions/InviteDescription");
  const PortfolioDescription_1 = require("./descriptions/PortfolioDescription");
  const PortfolioCompanyDescription_1 = require("./descriptions/PortfolioCompanyDescription");
  const ReportDescription_1 = require("./descriptions/ReportDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_1 = __importDefault(require("moment"));
  class SecurityScorecard {
      constructor() {
          this.description = {
              displayName: 'SecurityScorecard',
              name: 'securityScorecard',
              icon: 'file:securityScorecard.svg',
              group: ['transform'],
              subtitle: '={{$parameter["operation"]}} : {{$parameter["resource"]}}',
              version: 1,
              description: 'Consume SecurityScorecard API',
              defaults: {
                  name: 'SecurityScorecard',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'securityScorecardApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      options: [
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Industry',
                              value: 'industry',
                          },
                          {
                              name: 'Invite',
                              value: 'invite',
                          },
                          {
                              name: 'Portfolio',
                              value: 'portfolio',
                          },
                          {
                              name: 'Portfolio Company',
                              value: 'portfolioCompany',
                          },
                          {
                              name: 'Report',
                              value: 'report',
                          },
                      ],
                      default: 'company',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...CompanyDescription_1.companyFields,
                  ...IndustryDescription_1.industryOperations,
                  ...IndustryDescription_1.industryFields,
                  ...InviteDescription_1.inviteOperations,
                  ...InviteDescription_1.inviteFields,
                  ...PortfolioDescription_1.portfolioOperations,
                  ...PortfolioDescription_1.portfolioFields,
                  ...PortfolioCompanyDescription_1.portfolioCompanyOperations,
                  ...PortfolioCompanyDescription_1.portfolioCompanyFields,
                  ...ReportDescription_1.reportOperations,
                  ...ReportDescription_1.reportFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const length = items.length;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'portfolio') {
                  if (operation === 'create') {
                      const name = this.getNodeParameter('name', i);
                      const description = this.getNodeParameter('description', i);
                      const privacy = this.getNodeParameter('privacy', i);
                      const body = {
                          name,
                          description,
                          privacy,
                      };
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'POST', 'portfolios', body);
                      returnData.push(responseData);
                  }
                  if (operation === 'delete') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'DELETE', `portfolios/${portfolioId}`);
                      returnData.push({ success: true });
                  }
                  if (operation === 'update') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const name = this.getNodeParameter('name', i);
                      const description = this.getNodeParameter('description', i);
                      const privacy = this.getNodeParameter('privacy', i);
                      const body = {
                          name,
                          description,
                          privacy,
                      };
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'PUT', `portfolios/${portfolioId}`, body);
                      returnData.push(responseData);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', 'portfolios');
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', 0);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'portfolioCompany') {
                  if (operation === 'add') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const domain = this.getNodeParameter('domain', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'PUT', `portfolios/${portfolioId}/companies/${domain}`);
                      returnData.push(responseData);
                  }
                  if (operation === 'remove') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const domain = this.getNodeParameter('domain', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'DELETE', `portfolios/${portfolioId}/companies/${domain}`);
                      returnData.push({ success: true });
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const filterParams = this.getNodeParameter('filters', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `portfolios/${portfolioId}/companies`, {}, filterParams);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', 0);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'report') {
                  if (operation === 'download') {
                      const reportUrl = this.getNodeParameter('url', i);
                      const response = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', '', {}, {}, reportUrl, {
                          encoding: null,
                          resolveWithFullResponse: true,
                      });
                      let mimeType;
                      if (response.headers['content-type']) {
                          mimeType = response.headers['content-type'];
                      }
                      const newItem = {
                          json: items[i].json,
                          binary: {},
                      };
                      if (items[i].binary !== undefined && newItem.binary) {
                          Object.assign(newItem.binary, items[i].binary);
                      }
                      items[i] = newItem;
                      const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                      const fileName = reportUrl.split('/').pop();
                      const data = Buffer.from(response.body, 'utf8');
                      items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, fileName, mimeType);
                  }
                  if (operation === 'generate') {
                      const reportType = this.getNodeParameter('report', i);
                      let body = {};
                      if (reportType !== 'portfolio') {
                          body.scorecard_identifier = this.getNodeParameter('scorecardIdentifier', i);
                      }
                      else {
                          body.portfolio_id = this.getNodeParameter('portfolioId', i);
                      }
                      if (reportType === 'events-json') {
                          body.date = this.getNodeParameter('date', i);
                      }
                      if (['issues', 'portfolio'].indexOf(reportType) > -1) {
                          body.format = this.getNodeParameter('options.format', i) || 'pdf';
                      }
                      if (['detailed', 'summary'].indexOf(reportType) > -1) {
                          body.branding = this.getNodeParameter('branding', i);
                      }
                      if (['events-json', 'full-scorecard-json'].indexOf(reportType) > -1) {
                          body = { params: body };
                      }
                      if (reportType === 'scorecard-footprint') {
                          const options = this.getNodeParameter('options', i);
                          Object.assign(body, options);
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'POST', `reports/${reportType}`, body);
                      returnData.push(responseData);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', 'reports/recent');
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'invite') {
                  if (operation === 'create') {
                      const body = {
                          email: this.getNodeParameter('email', i),
                          first_name: this.getNodeParameter('firstName', i),
                          last_name: this.getNodeParameter('lastName', i),
                          message: this.getNodeParameter('message', i),
                      };
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'POST', 'invitations', body);
                      returnData.push(responseData);
                  }
              }
              if (resource === 'industry') {
                  if (operation === 'getScore') {
                      const industry = this.getNodeParameter('industry', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `industries/${industry}/score`);
                      returnData.push(responseData);
                  }
                  if (operation === 'getFactor') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      const industry = this.getNodeParameter('industry', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `industries/${industry}/history/factors`);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getFactorHistorical') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const industry = this.getNodeParameter('industry', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.from) {
                          options.from = (0, moment_1.default)(options.from).format('YYYY-MM-DD');
                      }
                      if (options.to) {
                          options.to = (0, moment_1.default)(options.to).format('YYYY-MM-DD');
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `industries/${industry}/history/factors`, {}, options);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'company') {
                  if (operation === 'getScorecard') {
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}`);
                      returnData.push(responseData);
                  }
                  if (operation === 'getFactor') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const filterParams = this.getNodeParameter('filters', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/factors`, {}, filterParams);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getFactorHistorical') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.date_from) {
                          options.date_from = (0, moment_1.default)(options.date_from).format('YYYY-MM-DD');
                      }
                      if (options.date_to) {
                          options.date_to = (0, moment_1.default)(options.date_to).format('YYYY-MM-DD');
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/history/factors/score`, {}, options);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getHistoricalScore') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.date_from) {
                          options.from = (0, moment_1.default)(options.date_from).format('YYYY-MM-DD');
                          delete options.date_from;
                      }
                      if (options.date_to) {
                          options.to = (0, moment_1.default)(options.date_to).format('YYYY-MM-DD');
                          delete options.date_to;
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/history/factors/score`, {}, options);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getScorePlan') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const targetScore = this.getNodeParameter('score', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/score-plans/by-target/${targetScore}`);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
          }
          if (resource === 'report' && operation === 'download') {
              return [items];
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.SecurityScorecard = SecurityScorecard;
  //# sourceMappingURL=SecurityScorecard.node.js.map

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


node_type: n8n-nodes-base.Segment
name: Segment
package_name: n8n-nodes-base
display_name: Segment
description: Consume Segment API
code_hash: 9fc9d8949d7a2d9b8ae94a10b699705756e1f9f2cb2e6a0feeff301b5108b19d
source_location: node_modules/n8n-nodes-base/dist/nodes/Segment/Segment.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.Segment = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const GroupDescription_1 = require("./GroupDescription");
  const IdentifyDescription_1 = require("./IdentifyDescription");
  const TrackDescription_1 = require("./TrackDescription");
  const uuid_1 = require("uuid");
  class Segment {
      constructor() {
          this.description = {
              displayName: 'Segment',
              name: 'segment',
              icon: 'file:segment.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
              description: 'Consume Segment API',
              defaults: {
                  name: 'Segment',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'segmentApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Group',
                              value: 'group',
                              description: 'Group lets you associate an identified user with a group',
                          },
                          {
                              name: 'Identify',
                              value: 'identify',
                              description: 'Identify lets you tie a user to their actions',
                          },
                          {
                              name: 'Track',
                              value: 'track',
                              description: 'Track lets you record events',
                          },
                      ],
                      default: 'identify',
                  },
                  ...GroupDescription_1.groupOperations,
                  ...GroupDescription_1.groupFields,
                  ...IdentifyDescription_1.identifyOperations,
                  ...TrackDescription_1.trackOperations,
                  ...IdentifyDescription_1.identifyFields,
                  ...TrackDescription_1.trackFields,
              ],
          };
      }
      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 === 'group') {
                      if (operation === 'add') {
                          const userId = this.getNodeParameter('userId', i);
                          const groupId = this.getNodeParameter('groupId', i);
                          const traits = this.getNodeParameter('traits', i)
                              .traitsUi;
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const body = {
                              groupId,
                              traits: {
                                  company: {},
                                  address: {},
                              },
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              integrations: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (traits) {
                              if (traits && traits.length !== 0) {
                                  for (const trait of traits) {
                                      body.traits[trait.key] = trait.value;
                                  }
                              }
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/group', body);
                      }
                  }
                  if (resource === 'identify') {
                      if (operation === 'create') {
                          const userId = this.getNodeParameter('userId', i);
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const traits = this.getNodeParameter('traits', i)
                              .traitsUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const body = {
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              traits: {},
                              integrations: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          if (traits) {
                              if (traits && traits.length !== 0) {
                                  for (const trait of traits) {
                                      body.traits[trait.key] = trait.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/identify', body);
                      }
                  }
                  if (resource === 'track') {
                      if (operation === 'event') {
                          const userId = this.getNodeParameter('userId', i);
                          const event = this.getNodeParameter('event', i);
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const properties = this.getNodeParameter('properties', i)
                              .propertiesUi;
                          const body = {
                              event,
                              traits: {},
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              integrations: {},
                              properties: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          if (properties) {
                              if (properties && properties.length !== 0) {
                                  for (const property of properties) {
                                      body.properties[property.key] = property.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/track', body);
                      }
                      if (operation === 'page') {
                          const userId = this.getNodeParameter('userId', i);
                          const name = this.getNodeParameter('name', i);
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const properties = this.getNodeParameter('properties', i)
                              .propertiesUi;
                          const body = {
                              name,
                              traits: {},
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              integrations: {},
                              properties: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          if (properties) {
                              if (properties && properties.length !== 0) {
                                  for (const property of properties) {
                                      body.properties[property.key] = property.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/page', body);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
              if (Array.isArray(responseData)) {
                  returnData.push.apply(returnData, responseData);
              }
              else {
                  returnData.push(responseData);
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Segment = Segment;
  //# sourceMappingURL=Segment.node.js.map

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


node_type: n8n-nodes-base.SendGrid
name: SendGrid
package_name: n8n-nodes-base
display_name: SendGrid
description: Consume SendGrid API
code_hash: c682d47a8e16769aa94a9421671141e4f81eee92760eabbe45af312286758989
source_location: node_modules/n8n-nodes-base/dist/nodes/SendGrid/SendGrid.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.SendGrid = void 0;
  const ListDescription_1 = require("./ListDescription");
  const ContactDescription_1 = require("./ContactDescription");
  const MailDescription_1 = require("./MailDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class SendGrid {
      constructor() {
          this.description = {
              displayName: 'SendGrid',
              name: 'sendGrid',
              icon: 'file:sendGrid.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
              description: 'Consume SendGrid API',
              defaults: {
                  name: 'SendGrid',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sendGridApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'List',
                              value: 'list',
                          },
                          {
                              name: 'Mail',
                              value: 'mail',
                          },
                      ],
                      default: 'list',
                      required: true,
                  },
                  ...ListDescription_1.listOperations,
                  ...ListDescription_1.listFields,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
                  ...MailDescription_1.mailOperations,
                  ...MailDescription_1.mailFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCustomFields() {
                      const returnData = [];
                      const { custom_fields } = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/field_definitions', 'GET', {}, {});
                      if (custom_fields !== undefined) {
                          for (const customField of custom_fields) {
                              returnData.push({
                                  name: customField.name,
                                  value: customField.id,
                              });
                          }
                      }
                      return returnData;
                  },
                  async getListIds() {
                      const returnData = [];
                      const lists = await GenericFunctions_1.sendGridApiRequestAllItems.call(this, '/marketing/lists', 'GET', 'result', {}, {});
                      for (const list of lists) {
                          returnData.push({
                              name: list.name,
                              value: list.id,
                          });
                      }
                      return returnData;
                  },
                  async getTemplateIds() {
                      const responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/templates', 'GET', {}, { generations: 'dynamic' });
                      return responseData.templates.map(({ id, name }) => ({
                          name,
                          value: id,
                      }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          const qs = {};
          let responseData;
          const timezone = this.getTimezone();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'contact') {
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filters = this.getNodeParameter('filters', i);
                          let endpoint = '/marketing/contacts';
                          let method = 'GET';
                          const body = {};
                          if (filters.query && filters.query !== '') {
                              endpoint = '/marketing/contacts/search';
                              method = 'POST';
                              Object.assign(body, { query: filters.query });
                          }
                          responseData = await GenericFunctions_1.sendGridApiRequestAllItems.call(this, endpoint, method, 'result', body, 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);
                      }
                      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;
                      }
                  }
              }
              if (operation === 'get') {
                  const by = this.getNodeParameter('by', 0);
                  let endpoint;
                  let method;
                  const body = {};
                  for (let i = 0; i < length; i++) {
                      try {
                          if (by === 'id') {
                              method = 'GET';
                              const contactId = this.getNodeParameter('contactId', i);
                              endpoint = `/marketing/contacts/${contactId}`;
                          }
                          else {
                              const email = this.getNodeParameter('email', i);
                              endpoint = '/marketing/contacts/search';
                              method = 'POST';
                              Object.assign(body, { query: `email LIKE '${email}' ` });
                          }
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, endpoint, method, body, qs);
                          responseData = responseData.result || responseData;
                          if (Array.isArray(responseData)) {
                              responseData = responseData[0];
                          }
                          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;
                      }
                  }
              }
              if (operation === 'upsert') {
                  try {
                      const contacts = [];
                      let lists;
                      for (let i = 0; i < length; i++) {
                          const email = this.getNodeParameter('email', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const contact = {
                              email,
                          };
                          if (additionalFields.addressUi) {
                              const addressValues = additionalFields.addressUi
                                  .addressValues;
                              const addressLine1 = addressValues.address1;
                              const addressLine2 = addressValues.address2;
                              if (addressLine2) {
                                  Object.assign(contact, { address_line_2: addressLine2 });
                              }
                              Object.assign(contact, { address_line_1: addressLine1 });
                          }
                          if (additionalFields.city) {
                              const city = additionalFields.city;
                              Object.assign(contact, { city });
                          }
                          if (additionalFields.country) {
                              const country = additionalFields.country;
                              Object.assign(contact, { country });
                          }
                          if (additionalFields.firstName) {
                              const firstName = additionalFields.firstName;
                              Object.assign(contact, { first_name: firstName });
                          }
                          if (additionalFields.lastName) {
                              const lastName = additionalFields.lastName;
                              Object.assign(contact, { last_name: lastName });
                          }
                          if (additionalFields.postalCode) {
                              const postalCode = additionalFields.postalCode;
                              Object.assign(contact, { postal_code: postalCode });
                          }
                          if (additionalFields.stateProvinceRegion) {
                              const stateProvinceRegion = additionalFields.stateProvinceRegion;
                              Object.assign(contact, { state_province_region: stateProvinceRegion });
                          }
                          if (additionalFields.alternateEmails) {
                              const alternateEmails = additionalFields.alternateEmails
                                  .split(',')
                                  .filter((mail) => !!mail);
                              if (alternateEmails.length !== 0) {
                                  Object.assign(contact, { alternate_emails: alternateEmails });
                              }
                          }
                          if (additionalFields.listIdsUi) {
                              const listIdValues = additionalFields.listIdsUi
                                  .listIdValues;
                              const listIds = listIdValues.listIds;
                              lists = listIds;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldValues;
                              if (customFields) {
                                  const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
                                  Object.assign(contact, { custom_fields: data });
                              }
                          }
                          contacts.push(contact);
                      }
                      responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/contacts', 'PUT', { list_ids: lists, contacts }, qs);
                      returnData.push(responseData);
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          returnData.push({ json: { error: error.message } });
                      }
                      else {
                          throw error;
                      }
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const deleteAll = this.getNodeParameter('deleteAll', i);
                          if (deleteAll) {
                              qs.delete_all_contacts = 'true';
                          }
                          qs.ids = this.getNodeParameter('ids', i).replace(/\s/g, '');
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/contacts', 'DELETE', {}, qs);
                          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;
                      }
                  }
              }
          }
          if (resource === 'list') {
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = await GenericFunctions_1.sendGridApiRequestAllItems.call(this, '/marketing/lists', 'GET', 'result', {}, 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);
                      }
                      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;
                      }
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const listId = this.getNodeParameter('listId', i);
                          qs.contact_sample = this.getNodeParameter('contactSample', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, `/marketing/lists/${listId}`, 'GET', {}, qs);
                          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;
                      }
                  }
              }
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const name = this.getNodeParameter('name', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/lists', 'POST', { name }, qs);
                          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;
                      }
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const listId = this.getNodeParameter('listId', i);
                          qs.delete_contacts = this.getNodeParameter('deleteContacts', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, `/marketing/lists/${listId}`, 'DELETE', {}, qs);
                          responseData = { success: true };
                          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;
                      }
                  }
              }
              if (operation === 'update') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const name = this.getNodeParameter('name', i);
                          const listId = this.getNodeParameter('listId', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, `/marketing/lists/${listId}`, 'PATCH', { name }, qs);
                          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;
                      }
                  }
              }
          }
          if (resource === 'mail') {
              if (operation === 'send') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const toEmail = this.getNodeParameter('toEmail', i);
                          const parsedToEmail = toEmail.includes(',')
                              ? toEmail.split(',').map((entry) => ({ email: entry.trim() }))
                              : [{ email: toEmail.trim() }];
                          const { bccEmail, ccEmail, enableSandbox, sendAt, headers, attachments, categories, ipPoolName, } = this.getNodeParameter('additionalFields', i);
                          const body = {
                              personalizations: [
                                  {
                                      to: parsedToEmail,
                                  },
                              ],
                              from: {
                                  email: this.getNodeParameter('fromEmail', i).trim(),
                                  name: this.getNodeParameter('fromName', i),
                              },
                              mail_settings: {
                                  sandbox_mode: {
                                      enable: enableSandbox || false,
                                  },
                              },
                          };
                          const dynamicTemplateEnabled = this.getNodeParameter('dynamicTemplate', i);
                          if (dynamicTemplateEnabled) {
                              body.template_id = this.getNodeParameter('templateId', i);
                              const { fields } = this.getNodeParameter('dynamicTemplateFields', i);
                              if (fields) {
                                  body.personalizations[0].dynamic_template_data = {};
                                  fields.forEach((field) => {
                                      body.personalizations[0].dynamic_template_data[field.key] = field.value;
                                  });
                              }
                          }
                          else {
                              body.personalizations[0].subject = this.getNodeParameter('subject', i);
                              body.content = [
                                  {
                                      type: this.getNodeParameter('contentType', i),
                                      value: this.getNodeParameter('contentValue', i),
                                  },
                              ];
                          }
                          if (attachments) {
                              const attachmentsToSend = [];
                              const binaryProperties = attachments.split(',').map((p) => p.trim());
                              for (const property of binaryProperties) {
                                  const binaryData = this.helpers.assertBinaryData(i, property);
                                  const dataBuffer = await this.helpers.getBinaryDataBuffer(i, property);
                                  attachmentsToSend.push({
                                      content: dataBuffer.toString('base64'),
                                      filename: binaryData.fileName || 'unknown',
                                      type: binaryData.mimeType,
                                  });
                              }
                              if (attachmentsToSend.length) {
                                  body.attachments = attachmentsToSend;
                              }
                          }
                          if (bccEmail) {
                              body.personalizations[0].bcc = bccEmail
                                  .split(',')
                                  .map((entry) => ({ email: entry.trim() }));
                          }
                          if (ccEmail) {
                              body.personalizations[0].cc = ccEmail
                                  .split(',')
                                  .map((entry) => ({ email: entry.trim() }));
                          }
                          if (headers === null || headers === void 0 ? void 0 : headers.details.length) {
                              const parsedHeaders = {};
                              headers.details.forEach((obj) => (parsedHeaders[obj.key] = obj.value));
                              body.headers = parsedHeaders;
                          }
                          if (categories) {
                              body.categories = categories.split(',');
                          }
                          if (ipPoolName) {
                              body.ip_pool_name = ipPoolName;
                          }
                          if (sendAt) {
                              body.personalizations[0].send_at = moment_timezone_1.default.tz(sendAt, timezone).unix();
                          }
                          const data = await GenericFunctions_1.sendGridApiRequest.call(this, '/mail/send', 'POST', body, qs, {
                              resolveWithFullResponse: true,
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ messageId: data.headers['x-message-id'] }), { 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.SendGrid = SendGrid;
  //# sourceMappingURL=SendGrid.node.js.map

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


node_type: n8n-nodes-base.Sendy
name: Sendy
package_name: n8n-nodes-base
display_name: Sendy
description: Consume Sendy API
code_hash: 8f1551f664c318139782631bc2298a5dc48d279198dcc99bfff803806441c8ab
source_location: node_modules/n8n-nodes-base/dist/nodes/Sendy/Sendy.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.Sendy = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const CampaignDescription_1 = require("./CampaignDescription");
  const SubscriberDescription_1 = require("./SubscriberDescription");
  class Sendy {
      constructor() {
          this.description = {
              displayName: 'Sendy',
              name: 'sendy',
              icon: 'file:sendy.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Sendy API',
              defaults: {
                  name: 'Sendy',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sendyApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Campaign',
                              value: 'campaign',
                          },
                          {
                              name: 'Subscriber',
                              value: 'subscriber',
                          },
                      ],
                      default: 'subscriber',
                  },
                  ...CampaignDescription_1.campaignOperations,
                  ...CampaignDescription_1.campaignFields,
                  ...SubscriberDescription_1.subscriberOperations,
                  ...SubscriberDescription_1.subscriberFields,
              ],
          };
      }
      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 === 'campaign') {
                  if (operation === 'create') {
                      const fromName = this.getNodeParameter('fromName', i);
                      const fromEmail = this.getNodeParameter('fromEmail', i);
                      const replyTo = this.getNodeParameter('replyTo', i);
                      const title = this.getNodeParameter('title', i);
                      const subject = this.getNodeParameter('subject', i);
                      const htmlText = this.getNodeParameter('htmlText', i);
                      const sendCampaign = this.getNodeParameter('sendCampaign', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      let brandId = null;
                      if (!sendCampaign) {
                          brandId = this.getNodeParameter('brandId', i);
                      }
                      const body = {
                          from_name: fromName,
                          from_email: fromEmail,
                          reply_to: replyTo,
                          title,
                          subject,
                          send_campaign: sendCampaign ? 1 : 0,
                          html_text: htmlText,
                      };
                      if (brandId) {
                          body.brand_id = brandId;
                      }
                      if (additionalFields.plainText) {
                          body.plain_text = additionalFields.plainText;
                      }
                      if (additionalFields.listIds) {
                          body.list_ids = additionalFields.listIds;
                      }
                      if (additionalFields.segmentIds) {
                          body.segment_ids = additionalFields.segmentIds;
                      }
                      if (additionalFields.excludeListIds) {
                          body.exclude_list_ids = additionalFields.excludeListIds;
                      }
                      if (additionalFields.excludeSegmentIds) {
                          body.exclude_segments_ids = additionalFields.excludeSegmentIds;
                      }
                      if (additionalFields.queryString) {
                          body.query_string = additionalFields.queryString;
                      }
                      if (additionalFields.trackOpens) {
                          body.track_opens = additionalFields.trackOpens ? 1 : 0;
                      }
                      if (additionalFields.trackClicks) {
                          body.track_clicks = additionalFields.trackClicks ? 1 : 0;
                      }
                      responseData = await GenericFunctions_1.sendyApiRequest.call(this, 'POST', '/api/campaigns/create.php', body);
                      const success = ['Campaign created', 'Campaign created and now sending'];
                      if (success.includes(responseData)) {
                          responseData = { message: responseData };
                      }
                      else {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData, { httpCode: '400' });
                      }
                  }
              }
              if (resource === 'subscriber') {
                  if (operation === 'add') {
                      const email = this.getNodeParameter('email', i);
                      const listId = this.getNodeParameter('listId', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          email,
                          list: listId,
                      };
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.sendyApiRequest.call(this, 'POST', '/subscribe', body);
                      if (responseData === '1') {
                          responseData = { success: true };
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i });
                      }
                  }
                  if (operation === 'count') {
                      const listId = this.getNodeParameter('listId', i);
                      const body = {
                          list_id: listId,
                      };
                      responseData = await GenericFunctions_1.sendyApiRequest.call(this, 'POST', '/api/subscribers/active-subscriber-count.php', body);
                      const errors = [
                          'No data passed',
                          'API key not passed',
                          'Invalid API key',
                          'List ID not passed',
                          'List does not exist',
                      ];
                      if (!errors.includes(responseData)) {
                          responseData = { count: responseData };
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i });
                      }
                  }
                  if (operation === 'delete') {
                      const email = this.getNodeParameter('email', i);
                      const listId = this.getNodeParameter('listId', i);
                      const body = {
                          email,
                          list_id: listId,
                      };
                      responseData = await GenericFunctions_1.sendyApiRequest.call(this, 'POST', '/api/subscribers/delete.php', body);
                      if (responseData === '1') {
                          responseData = { success: true };
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i });
                      }
                  }
                  if (operation === 'remove') {
                      const email = this.getNodeParameter('email', i);
                      const listId = this.getNodeParameter('listId', i);
                      const body = {
                          email,
                          list: listId,
                      };
                      responseData = await GenericFunctions_1.sendyApiRequest.call(this, 'POST', '/unsubscribe', body);
                      if (responseData === '1') {
                          responseData = { success: true };
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i });
                      }
                  }
                  if (operation === 'status') {
                      const email = this.getNodeParameter('email', i);
                      const listId = this.getNodeParameter('listId', i);
                      const body = {
                          email,
                          list_id: listId,
                      };
                      responseData = await GenericFunctions_1.sendyApiRequest.call(this, 'POST', '/api/subscribers/subscription-status.php', body);
                      const status = [
                          'Subscribed',
                          'Unsubscribed',
                          'Unconfirmed',
                          'Bounced',
                          'Soft bounced',
                          'Complained',
                      ];
                      if (status.includes(responseData)) {
                          responseData = { status: responseData };
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i });
                      }
                  }
              }
          }
          if (Array.isArray(responseData)) {
              returnData.push.apply(returnData, responseData);
          }
          else if (responseData !== undefined) {
              returnData.push(responseData);
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Sendy = Sendy;
  //# sourceMappingURL=Sendy.node.js.map

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


node_type: n8n-nodes-base.SentryIo
name: SentryIo
package_name: n8n-nodes-base
display_name: Sentry.io
description: Consume Sentry.io API
code_hash: 12e647ea8cb08abfa06aba35b9341919467decb8126ef162439de5714292bc31
source_location: node_modules/n8n-nodes-base/dist/nodes/SentryIo/SentryIo.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.SentryIo = void 0;
  const EventDescription_1 = require("./EventDescription");
  const IssueDescription_1 = require("./IssueDescription");
  const OrganizationDescription_1 = require("./OrganizationDescription");
  const ProjectDescription_1 = require("./ProjectDescription");
  const ReleaseDescription_1 = require("./ReleaseDescription");
  const TeamDescription_1 = require("./TeamDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  class SentryIo {
      constructor() {
          this.description = {
              displayName: 'Sentry.io',
              name: 'sentryIo',
              icon: 'file:sentryio.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Sentry.io API',
              defaults: {
                  name: 'Sentry.io',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sentryIoOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                              sentryVersion: ['cloud'],
                          },
                      },
                  },
                  {
                      name: 'sentryIoApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                              sentryVersion: ['cloud'],
                          },
                      },
                  },
                  {
                      name: 'sentryIoServerApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                              sentryVersion: ['server'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Sentry Version',
                      name: 'sentryVersion',
                      type: 'options',
                      options: [
                          {
                              name: 'Cloud',
                              value: 'cloud',
                          },
                          {
                              name: 'Server (Self Hosted)',
                              value: 'server',
                          },
                      ],
                      default: 'cloud',
                  },
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      displayOptions: {
                          show: {
                              sentryVersion: ['cloud'],
                          },
                      },
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'accessToken',
                  },
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      displayOptions: {
                          show: {
                              sentryVersion: ['server'],
                          },
                      },
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                      ],
                      default: 'accessToken',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Event',
                              value: 'event',
                          },
                          {
                              name: 'Issue',
                              value: 'issue',
                          },
                          {
                              name: 'Organization',
                              value: 'organization',
                          },
                          {
                              name: 'Project',
                              value: 'project',
                          },
                          {
                              name: 'Release',
                              value: 'release',
                          },
                          {
                              name: 'Team',
                              value: 'team',
                          },
                      ],
                      default: 'event',
                  },
                  ...EventDescription_1.eventOperations,
                  ...EventDescription_1.eventFields,
                  ...IssueDescription_1.issueOperations,
                  ...IssueDescription_1.issueFields,
                  ...OrganizationDescription_1.organizationOperations,
                  ...OrganizationDescription_1.organizationFields,
                  ...ProjectDescription_1.projectOperations,
                  ...ProjectDescription_1.projectFields,
                  ...ReleaseDescription_1.releaseOperations,
                  ...ReleaseDescription_1.releaseFields,
                  ...TeamDescription_1.teamOperations,
                  ...TeamDescription_1.teamFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getOrganizations() {
                      const returnData = [];
                      const organizations = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', '/api/0/organizations/', {});
                      for (const organization of organizations) {
                          returnData.push({
                              name: organization.slug,
                              value: organization.slug,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getProjects() {
                      const returnData = [];
                      const projects = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', '/api/0/projects/', {});
                      const organizationSlug = this.getNodeParameter('organizationSlug');
                      for (const project of projects) {
                          if (organizationSlug !== project.organization.slug) {
                              continue;
                          }
                          returnData.push({
                              name: project.slug,
                              value: project.slug,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getTeams() {
                      const returnData = [];
                      const organizationSlug = this.getNodeParameter('organizationSlug');
                      const teams = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', `/api/0/organizations/${organizationSlug}/teams/`, {});
                      for (const team of teams) {
                          returnData.push({
                              name: team.slug,
                              value: team.slug,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'event') {
                      if (operation === 'getAll') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const projectSlug = this.getNodeParameter('projectSlug', i);
                          const full = this.getNodeParameter('full', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const endpoint = `/api/0/projects/${organizationSlug}/${projectSlug}/events/`;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                          }
                          qs.full = full;
                          responseData = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', endpoint, {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'get') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const projectSlug = this.getNodeParameter('projectSlug', i);
                          const eventId = this.getNodeParameter('eventId', i);
                          const endpoint = `/api/0/projects/${organizationSlug}/${projectSlug}/events/${eventId}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'GET', endpoint, qs);
                      }
                  }
                  if (resource === 'issue') {
                      if (operation === 'getAll') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const projectSlug = this.getNodeParameter('projectSlug', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const endpoint = `/api/0/projects/${organizationSlug}/${projectSlug}/issues/`;
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.statsPeriod) {
                              qs.statsPeriod = additionalFields.statsPeriod;
                          }
                          if (additionalFields.shortIdLookup) {
                              qs.shortIdLookup = additionalFields.shortIdLookup;
                          }
                          if (additionalFields.query) {
                              qs.query = additionalFields.query;
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                          }
                          responseData = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', endpoint, {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'get') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const endpoint = `/api/0/issues/${issueId}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'GET', endpoint, qs);
                      }
                      if (operation === 'delete') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const endpoint = `/api/0/issues/${issueId}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'DELETE', endpoint, qs);
                          responseData = { success: true };
                      }
                      if (operation === 'update') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const endpoint = `/api/0/issues/${issueId}/`;
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.status) {
                              qs.status = additionalFields.status;
                          }
                          if (additionalFields.assignedTo) {
                              qs.assignedTo = additionalFields.assignedTo;
                          }
                          if (additionalFields.hasSeen) {
                              qs.hasSeen = additionalFields.hasSeen;
                          }
                          if (additionalFields.isBookmarked) {
                              qs.isBookmarked = additionalFields.isBookmarked;
                          }
                          if (additionalFields.isSubscribed) {
                              qs.isSubscribed = additionalFields.isSubscribed;
                          }
                          if (additionalFields.isPublic) {
                              qs.isPublic = additionalFields.isPublic;
                          }
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'PUT', endpoint, qs);
                      }
                  }
                  if (resource === 'organization') {
                      if (operation === 'get') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'GET', endpoint, qs);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const endpoint = '/api/0/organizations/';
                          if (additionalFields.member) {
                              qs.member = additionalFields.member;
                          }
                          if (additionalFields.owner) {
                              qs.owner = additionalFields.owner;
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                          }
                          responseData = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', endpoint, {}, qs);
                          if (responseData === undefined) {
                              responseData = [];
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const agreeTerms = this.getNodeParameter('agreeTerms', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const endpoint = '/api/0/organizations/';
                          qs.name = name;
                          qs.agreeTerms = agreeTerms;
                          if (additionalFields.slug) {
                              qs.slug = additionalFields.slug;
                          }
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'POST', endpoint, qs);
                      }
                      if (operation === 'update') {
                          const organizationSlug = this.getNodeParameter('organization_slug', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/`;
                          const body = this.getNodeParameter('updateFields', i);
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
                      }
                  }
                  if (resource === 'project') {
                      if (operation === 'create') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const teamSlug = this.getNodeParameter('teamSlug', i);
                          const name = this.getNodeParameter('name', i);
                          const endpoint = `/api/0/teams/${organizationSlug}/${teamSlug}/projects/`;
                          const body = {
                              name,
                              ...this.getNodeParameter('additionalFields', i),
                          };
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'POST', endpoint, body, qs);
                      }
                      if (operation === 'get') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const projectSlug = this.getNodeParameter('projectSlug', i);
                          const endpoint = `/api/0/projects/${organizationSlug}/${projectSlug}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'GET', endpoint, qs);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const endpoint = '/api/0/projects/';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                          }
                          responseData = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', endpoint, {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'update') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const projectSlug = this.getNodeParameter('projectSlug', i);
                          const endpoint = `/api/0/projects/${organizationSlug}/${projectSlug}/`;
                          const body = this.getNodeParameter('updateFields', i);
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
                      }
                      if (operation === 'delete') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const projectSlug = this.getNodeParameter('projectSlug', i);
                          const endpoint = `/api/0/projects/${organizationSlug}/${projectSlug}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'DELETE', endpoint, qs);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'release') {
                      if (operation === 'get') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const version = this.getNodeParameter('version', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/releases/${version}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'GET', endpoint, qs);
                      }
                      if (operation === 'getAll') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/releases/`;
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (additionalFields.query) {
                              qs.query = additionalFields.query;
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                          }
                          responseData = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', endpoint, {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'delete') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const version = this.getNodeParameter('version', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/releases/${version}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'DELETE', endpoint, qs);
                          responseData = { success: true };
                      }
                      if (operation === 'create') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/releases/`;
                          const version = this.getNodeParameter('version', i);
                          const url = this.getNodeParameter('url', i);
                          const projects = this.getNodeParameter('projects', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.dateReleased) {
                              qs.dateReleased = additionalFields.dateReleased;
                          }
                          qs.version = version;
                          qs.url = url;
                          qs.projects = projects;
                          if (additionalFields.commits) {
                              const commits = [];
                              additionalFields.commits.commitProperties.map((commit) => {
                                  const commitObject = { id: commit.id };
                                  if (commit.repository) {
                                      commitObject.repository = commit.repository;
                                  }
                                  if (commit.message) {
                                      commitObject.message = commit.message;
                                  }
                                  if (commit.patchSet && Array.isArray(commit.patchSet)) {
                                      commit.patchSet.patchSetProperties.map((patchSet) => {
                                          var _a;
                                          (_a = commitObject.patch_set) === null || _a === void 0 ? void 0 : _a.push(patchSet);
                                      });
                                  }
                                  if (commit.authorName) {
                                      commitObject.author_name = commit.authorName;
                                  }
                                  if (commit.authorEmail) {
                                      commitObject.author_email = commit.authorEmail;
                                  }
                                  if (commit.timestamp) {
                                      commitObject.timestamp = commit.timestamp;
                                  }
                                  commits.push(commitObject);
                              });
                              qs.commits = commits;
                          }
                          if (additionalFields.refs) {
                              const refs = [];
                              additionalFields.refs.refProperties.map((ref) => {
                                  refs.push(ref);
                              });
                              qs.refs = refs;
                          }
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'POST', endpoint, qs);
                      }
                      if (operation === 'update') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const version = this.getNodeParameter('version', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/releases/${version}/`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = { ...updateFields };
                          if (updateFields.commits) {
                              const commits = [];
                              updateFields.commits.commitProperties.map((commit) => {
                                  const commitObject = { id: commit.id };
                                  if (commit.repository) {
                                      commitObject.repository = commit.repository;
                                  }
                                  if (commit.message) {
                                      commitObject.message = commit.message;
                                  }
                                  if (commit.patchSet && Array.isArray(commit.patchSet)) {
                                      commit.patchSet.patchSetProperties.map((patchSet) => {
                                          var _a;
                                          (_a = commitObject.patch_set) === null || _a === void 0 ? void 0 : _a.push(patchSet);
                                      });
                                  }
                                  if (commit.authorName) {
                                      commitObject.author_name = commit.authorName;
                                  }
                                  if (commit.authorEmail) {
                                      commitObject.author_email = commit.authorEmail;
                                  }
                                  if (commit.timestamp) {
                                      commitObject.timestamp = commit.timestamp;
                                  }
                                  commits.push(commitObject);
                              });
                              body.commits = commits;
                          }
                          if (updateFields.refs) {
                              const refs = [];
                              updateFields.refs.refProperties.map((ref) => {
                                  refs.push(ref);
                              });
                              body.refs = refs;
                          }
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
                      }
                  }
                  if (resource === 'team') {
                      if (operation === 'get') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const teamSlug = this.getNodeParameter('teamSlug', i);
                          const endpoint = `/api/0/teams/${organizationSlug}/${teamSlug}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'GET', endpoint, qs);
                      }
                      if (operation === 'getAll') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/teams/`;
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                          }
                          responseData = await GenericFunctions_1.sentryApiRequestAllItems.call(this, 'GET', endpoint, {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'create') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const name = this.getNodeParameter('name', i);
                          const endpoint = `/api/0/organizations/${organizationSlug}/teams/`;
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          qs.name = name;
                          if (additionalFields.slug) {
                              qs.slug = additionalFields.slug;
                          }
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'POST', endpoint, qs);
                      }
                      if (operation === 'update') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const teamSlug = this.getNodeParameter('teamSlug', i);
                          const endpoint = `/api/0/teams/${organizationSlug}/${teamSlug}/`;
                          const body = this.getNodeParameter('updateFields', i);
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'PUT', endpoint, body, qs);
                      }
                      if (operation === 'delete') {
                          const organizationSlug = this.getNodeParameter('organizationSlug', i);
                          const teamSlug = this.getNodeParameter('teamSlug', i);
                          const endpoint = `/api/0/teams/${organizationSlug}/${teamSlug}/`;
                          responseData = await GenericFunctions_1.sentryIoApiRequest.call(this, 'DELETE', endpoint, qs);
                          responseData = { 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.SentryIo = SentryIo;
  //# sourceMappingURL=SentryIo.node.js.map

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


node_type: n8n-nodes-base.ServiceNow
name: ServiceNow
package_name: n8n-nodes-base
display_name: ServiceNow
description: Consume ServiceNow API
code_hash: ff46288455e6d2f1a7f7f9bd7f3b80f839079d11a53c14846d3bf88f7f162af2
source_location: node_modules/n8n-nodes-base/dist/nodes/ServiceNow/ServiceNow.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.ServiceNow = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const AttachmentDescription_1 = require("./AttachmentDescription");
  const BusinessServiceDescription_1 = require("./BusinessServiceDescription");
  const ConfigurationItemsDescription_1 = require("./ConfigurationItemsDescription");
  const DepartmentDescription_1 = require("./DepartmentDescription");
  const DictionaryDescription_1 = require("./DictionaryDescription");
  const IncidentDescription_1 = require("./IncidentDescription");
  const TableRecordDescription_1 = require("./TableRecordDescription");
  const UserDescription_1 = require("./UserDescription");
  const UserGroupDescription_1 = require("./UserGroupDescription");
  const UserRoleDescription_1 = require("./UserRoleDescription");
  class ServiceNow {
      constructor() {
          this.description = {
              displayName: 'ServiceNow',
              name: 'serviceNow',
              icon: 'file:servicenow.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume ServiceNow API',
              defaults: {
                  name: 'ServiceNow',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'serviceNowOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
                  {
                      name: 'serviceNowBasicApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['basicAuth'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Basic Auth',
                              value: 'basicAuth',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'oAuth2',
                      description: 'Authentication method to use',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Attachment',
                              value: 'attachment',
                          },
                          {
                              name: 'Business Service',
                              value: 'businessService',
                          },
                          {
                              name: 'Configuration Item',
                              value: 'configurationItems',
                          },
                          {
                              name: 'Department',
                              value: 'department',
                          },
                          {
                              name: 'Dictionary',
                              value: 'dictionary',
                          },
                          {
                              name: 'Incident',
                              value: 'incident',
                          },
                          {
                              name: 'Table Record',
                              value: 'tableRecord',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                          {
                              name: 'User Group',
                              value: 'userGroup',
                          },
                          {
                              name: 'User Role',
                              value: 'userRole',
                          },
                      ],
                      default: 'user',
                  },
                  ...AttachmentDescription_1.attachmentOperations,
                  ...AttachmentDescription_1.attachmentFields,
                  ...BusinessServiceDescription_1.businessServiceOperations,
                  ...BusinessServiceDescription_1.businessServiceFields,
                  ...ConfigurationItemsDescription_1.configurationItemsOperations,
                  ...ConfigurationItemsDescription_1.configurationItemsFields,
                  ...DepartmentDescription_1.departmentOperations,
                  ...DepartmentDescription_1.departmentFields,
                  ...DictionaryDescription_1.dictionaryOperations,
                  ...DictionaryDescription_1.dictionaryFields,
                  ...IncidentDescription_1.incidentOperations,
                  ...IncidentDescription_1.incidentFields,
                  ...TableRecordDescription_1.tableRecordOperations,
                  ...TableRecordDescription_1.tableRecordFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
                  ...UserGroupDescription_1.userGroupOperations,
                  ...UserGroupDescription_1.userGroupFields,
                  ...UserRoleDescription_1.userRoleOperations,
                  ...UserRoleDescription_1.userRoleFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTables() {
                      const returnData = [];
                      const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/doc/table/schema', {}, {});
                      for (const table of response.result) {
                          returnData.push({
                              name: table.label,
                              value: table.value,
                              description: table.value,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getColumns() {
                      const resource = this.getNodeParameter('resource', 0);
                      const operation = this.getNodeParameter('operation', 0);
                      const returnData = [];
                      let tableName;
                      if (resource === 'tableRecord') {
                          tableName = this.getNodeParameter('tableName');
                      }
                      else {
                          tableName = (0, GenericFunctions_1.mapEndpoint)(resource, operation);
                      }
                      const qs = {
                          sysparm_query: `name=${tableName}`,
                          sysparm_fields: 'column_label,element',
                      };
                      const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/sys_dictionary', {}, qs);
                      for (const column of response.result) {
                          if (column.element) {
                              returnData.push({
                                  name: column.column_label,
                                  value: column.element,
                              });
                          }
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getBusinessServices() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'name,sys_id',
                      };
                      const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/cmdb_ci_service', {}, qs);
                      for (const column of response.result) {
                          returnData.push({
                              name: column.name,
                              value: column.sys_id,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getUsers() {
                      const returnData = [];
                      const resource = this.getNodeParameter('resource', 0);
                      const operation = this.getNodeParameter('operation', 0);
                      const qs = {
                          sysparm_fields: 'sys_id,user_name',
                      };
                      if (resource === 'incident' && operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields');
                          const group = additionalFields.assignment_group;
                          const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_grmember', {}, {
                              sysparm_query: `group=${group}^`,
                          });
                          for (const column of response) {
                              if (column.user) {
                                  const responseData = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', `/now/table/sys_user/${column.user.value}`, {}, {});
                                  const user = responseData.result;
                                  returnData.push({
                                      name: user.user_name,
                                      value: user.sys_id,
                                  });
                              }
                          }
                      }
                      else {
                          const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user', {}, qs);
                          for (const column of response) {
                              if (column.user_name) {
                                  returnData.push({
                                      name: column.user_name,
                                      value: column.sys_id,
                                  });
                              }
                          }
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getAssignmentGroups() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'sys_id,name',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_group', {}, qs);
                      for (const column of response) {
                          if (column.name) {
                              returnData.push({
                                  name: column.name,
                                  value: column.sys_id,
                              });
                          }
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getUserRoles() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'sys_id,name',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_role', {}, qs);
                      for (const column of response) {
                          if (column.name) {
                              returnData.push({
                                  name: column.name,
                                  value: column.sys_id,
                              });
                          }
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getConfigurationItems() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'sys_id,name,sys_class_name',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/cmdb_ci', {}, qs);
                      for (const column of response) {
                          if (column.name) {
                              returnData.push({
                                  name: column.name,
                                  value: column.sys_id,
                                  description: column.sys_class_name,
                              });
                          }
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getIncidentCategories() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'label,value',
                          sysparm_query: 'element=category^name=incident',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_choice', {}, qs);
                      for (const column of response) {
                          returnData.push({
                              name: column.label,
                              value: column.value,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getIncidentSubcategories() {
                      const returnData = [];
                      const operation = this.getNodeParameter('operation');
                      let category;
                      if (operation === 'update') {
                          const updateFields = this.getNodeParameter('updateFields');
                          category = updateFields.category;
                      }
                      else {
                          const additionalFields = this.getNodeParameter('additionalFields');
                          category = additionalFields.category;
                      }
                      const qs = {
                          sysparm_fields: 'label,value',
                          sysparm_query: `name=incident^element=subcategory^dependent_value=${category}`,
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_choice', {}, qs);
                      for (const column of response) {
                          returnData.push({
                              name: column.label,
                              value: column.value,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getIncidentStates() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'label,value',
                          sysparm_query: 'element=state^name=incident',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_choice', {}, qs);
                      for (const column of response) {
                          returnData.push({
                              name: column.label,
                              value: column.value,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getIncidentResolutionCodes() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'label,value',
                          sysparm_query: 'element=close_code^name=incident',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_choice', {}, qs);
                      for (const column of response) {
                          returnData.push({
                              name: column.label,
                              value: column.value,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
                  async getIncidentHoldReasons() {
                      const returnData = [];
                      const qs = {
                          sysparm_fields: 'label,value',
                          sysparm_query: 'element=hold_reason^name=incident',
                      };
                      const response = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_choice', {}, qs);
                      for (const column of response) {
                          returnData.push({
                              name: column.label,
                              value: column.value,
                          });
                      }
                      return (0, GenericFunctions_1.sortData)(returnData);
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData = {};
          let qs;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'attachment') {
                      if (operation === 'get') {
                          const attachmentsSysId = this.getNodeParameter('attachmentId', i);
                          const download = this.getNodeParameter('download', i);
                          const endpoint = `/now/attachment/${attachmentsSysId}`;
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', endpoint, {});
                          const fileMetadata = response.result;
                          responseData = {
                              json: fileMetadata,
                          };
                          if (download) {
                              const outputField = this.getNodeParameter('outputField', i);
                              responseData = {
                                  ...responseData,
                                  binary: {
                                      [outputField]: await GenericFunctions_1.serviceNowDownloadAttachment.call(this, endpoint, fileMetadata.file_name, fileMetadata.content_type),
                                  },
                              };
                          }
                      }
                      else if (operation === 'getAll') {
                          const download = this.getNodeParameter('download', i);
                          const tableName = this.getNodeParameter('tableName', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          qs = {};
                          qs.sysparm_query = `table_name=${tableName}`;
                          if (options.queryFilter) {
                              qs.sysparm_query = `${qs.sysparm_query}^${options.queryFilter}`;
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/attachment', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/attachment', {}, qs);
                          }
                          if (download) {
                              const outputField = this.getNodeParameter('outputField', i);
                              const responseDataWithAttachments = [];
                              for (const data of responseData) {
                                  responseDataWithAttachments.push({
                                      json: data,
                                      binary: {
                                          [outputField]: await GenericFunctions_1.serviceNowDownloadAttachment.call(this, `/now/attachment/${data.sys_id}`, data.file_name, data.content_type),
                                      },
                                  });
                              }
                              responseData = responseDataWithAttachments;
                          }
                          else {
                              responseData = responseData.map((data) => ({ json: data }));
                          }
                      }
                      else if (operation === 'upload') {
                          const tableName = this.getNodeParameter('tableName', i);
                          const recordId = this.getNodeParameter('id', i);
                          const inputDataFieldName = this.getNodeParameter('inputDataFieldName', i);
                          const options = this.getNodeParameter('options', i);
                          const binaryData = this.helpers.assertBinaryData(i, inputDataFieldName);
                          const headers = {
                              'Content-Type': binaryData.mimeType,
                          };
                          const query = {
                              table_name: tableName,
                              table_sys_id: recordId,
                              file_name: binaryData.fileName
                                  ? binaryData.fileName
                                  : `${inputDataFieldName}.${binaryData.fileExtension}`,
                              ...options,
                          };
                          const body = await this.helpers.getBinaryDataBuffer(i, inputDataFieldName);
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'POST', '/now/attachment/file', body, query, '', { headers });
                          responseData = response.result;
                      }
                      else if (operation === 'delete') {
                          const attachmentsSysId = this.getNodeParameter('attachmentId', i);
                          await GenericFunctions_1.serviceNowApiRequest.call(this, 'DELETE', `/now/attachment/${attachmentsSysId}`);
                          responseData = { success: true };
                      }
                  }
                  else if (resource === 'businessService') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/cmdb_ci_service', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/cmdb_ci_service', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'configurationItems') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/cmdb_ci', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/cmdb_ci', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'department') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/cmn_department', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/cmn_department', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'dictionary') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/sys_dictionary', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_dictionary', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'incident') {
                      if (operation === 'create') {
                          const shortDescription = this.getNodeParameter('short_description', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              short_description: shortDescription,
                              ...additionalFields,
                          };
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'POST', '/now/table/incident', body);
                          responseData = response.result;
                      }
                      else if (operation === 'delete') {
                          const id = this.getNodeParameter('id', i);
                          responseData = await GenericFunctions_1.serviceNowApiRequest.call(this, 'DELETE', `/now/table/incident/${id}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const id = this.getNodeParameter('id', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', `/now/table/incident/${id}`, {}, qs);
                          responseData = response.result;
                      }
                      else if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/incident', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/incident', {}, qs);
                          }
                      }
                      else if (operation === 'update') {
                          const id = this.getNodeParameter('id', i);
                          const body = this.getNodeParameter('updateFields', i);
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'PATCH', `/now/table/incident/${id}`, body);
                          responseData = response.result;
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'tableRecord') {
                      if (operation === 'create') {
                          const tableName = this.getNodeParameter('tableName', i);
                          const dataToSend = this.getNodeParameter('dataToSend', i);
                          let body = {};
                          if (dataToSend === 'mapInput') {
                              const inputsToIgnore = this.getNodeParameter('inputsToIgnore', i)
                                  .split(',')
                                  .map((field) => field.trim());
                              body = Object.entries(items[i].json)
                                  .filter(([key]) => !inputsToIgnore.includes(key))
                                  .reduce((obj, [key, val]) => Object.assign(obj, { [key]: val }), {});
                          }
                          else if (dataToSend === 'columns') {
                              const fieldsToSend = this.getNodeParameter('fieldsToSend', i);
                              body = fieldsToSend.field.reduce((obj, field) => {
                                  obj[field.column] = field.value;
                                  return obj;
                              }, {});
                          }
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'POST', `/now/table/${tableName}`, body);
                          responseData = response.result;
                      }
                      else if (operation === 'delete') {
                          const tableName = this.getNodeParameter('tableName', i);
                          const id = this.getNodeParameter('id', i);
                          responseData = await GenericFunctions_1.serviceNowApiRequest.call(this, 'DELETE', `/now/table/${tableName}/${id}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const tableName = this.getNodeParameter('tableName', i);
                          const id = this.getNodeParameter('id', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', `/now/table/${tableName}/${id}`, {}, qs);
                          responseData = response.result;
                      }
                      else if (operation === 'getAll') {
                          const tableName = this.getNodeParameter('tableName', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', `/now/table/${tableName}`, {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', `/now/table/${tableName}`, {}, qs);
                          }
                      }
                      else if (operation === 'update') {
                          const tableName = this.getNodeParameter('tableName', i);
                          const id = this.getNodeParameter('id', i);
                          const dataToSend = this.getNodeParameter('dataToSend', i);
                          let body = {};
                          if (dataToSend === 'mapInput') {
                              const inputsToIgnore = this.getNodeParameter('inputsToIgnore', i)
                                  .split(',')
                                  .map((field) => field.trim());
                              body = Object.entries(items[i].json)
                                  .filter(([key]) => !inputsToIgnore.includes(key))
                                  .reduce((obj, [key, val]) => Object.assign(obj, { [key]: val }), {});
                          }
                          else if (dataToSend === 'columns') {
                              const fieldsToSend = this.getNodeParameter('fieldsToSend', i);
                              body = fieldsToSend.field.reduce((obj, field) => {
                                  obj[field.column] = field.value;
                                  return obj;
                              }, {});
                          }
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'PATCH', `/now/table/${tableName}/${id}`, body);
                          responseData = response.result;
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'create') {
                          const body = this.getNodeParameter('additionalFields', i);
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'POST', '/now/table/sys_user', body);
                          responseData = response.result;
                      }
                      else if (operation === 'delete') {
                          const id = this.getNodeParameter('id', i);
                          responseData = await GenericFunctions_1.serviceNowApiRequest.call(this, 'DELETE', `/now/table/sys_user/${id}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const getOption = this.getNodeParameter('getOption', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (getOption === 'id') {
                              const id = this.getNodeParameter('id', i);
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', `/now/table/sys_user/${id}`, {}, qs);
                              responseData = response.result;
                          }
                          else {
                              const userName = this.getNodeParameter('user_name', i);
                              qs.sysparm_query = `user_name=${userName}`;
                              qs.sysparm_limit = 1;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/sys_user', {}, qs);
                              responseData = response.result;
                          }
                      }
                      else if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/sys_user', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user', {}, qs);
                          }
                      }
                      else if (operation === 'update') {
                          const id = this.getNodeParameter('id', i);
                          const body = this.getNodeParameter('updateFields', i);
                          const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'PATCH', `/now/table/sys_user/${id}`, body);
                          responseData = response.result;
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'userGroup') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/sys_user_group', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_group', {}, qs);
                          }
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'userRole') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          qs = this.getNodeParameter('options', i);
                          if (qs.sysparm_fields && typeof qs.sysparm_fields !== 'string') {
                              qs.sysparm_fields = qs.sysparm_fields.join(',');
                          }
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.sysparm_limit = limit;
                              const response = await GenericFunctions_1.serviceNowApiRequest.call(this, 'GET', '/now/table/sys_user_role', {}, qs);
                              responseData = response.result;
                          }
                          else {
                              responseData = await GenericFunctions_1.serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_role', {}, qs);
                          }
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
                          itemIndex: i,
                      });
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          if (resource === 'attachment') {
              if (operation === 'get' || operation === 'getAll') {
                  return [returnData];
              }
          }
          return [returnData];
      }
  }
  exports.ServiceNow = ServiceNow;
  //# sourceMappingURL=ServiceNow.node.js.map

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


node_type: n8n-nodes-base.Set
name: Set
package_name: n8n-nodes-base
display_name: Set
description: Add or edit fields on an input item and optionally remove other fields
code_hash: 4414ad216090aa4ae629fc2ed5ae175c48bde7392d1133b82f472edcd1620065
source_location: node_modules/n8n-nodes-base/dist/nodes/Set/Set.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.Set = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SetV1_node_1 = require("./v1/SetV1.node");
  const SetV2_node_1 = require("./v2/SetV2.node");
  class Set extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Set',
              name: 'set',
              icon: 'fa:pen',
              group: ['input'],
              description: 'Add or edit fields on an input item and optionally remove other fields',
              defaultVersion: 3.2,
          };
          const nodeVersions = {
              1: new SetV1_node_1.SetV1(baseDescription),
              2: new SetV1_node_1.SetV1(baseDescription),
              3: new SetV2_node_1.SetV2(baseDescription),
              3.1: new SetV2_node_1.SetV2(baseDescription),
              3.2: new SetV2_node_1.SetV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Set = Set;
  //# sourceMappingURL=Set.node.js.map

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


node_type: n8n-nodes-base.Shopify
name: Shopify
package_name: n8n-nodes-base
display_name: Shopify
description: Consume Shopify API
code_hash: c9006b14af5d35b4e773b5812c0f324f95620663fb6b23c928b1c58ccc43a99c
source_location: node_modules/n8n-nodes-base/dist/nodes/Shopify/Shopify.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.Shopify = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const OrderDescription_1 = require("./OrderDescription");
  const ProductDescription_1 = require("./ProductDescription");
  class Shopify {
      constructor() {
          this.description = {
              displayName: 'Shopify',
              name: 'shopify',
              icon: 'file:shopify.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Shopify API',
              defaults: {
                  name: 'Shopify',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'shopifyApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['apiKey'],
                          },
                      },
                  },
                  {
                      name: 'shopifyAccessTokenApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                          },
                      },
                  },
                  {
                      name: 'shopifyOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                          {
                              name: 'API Key',
                              value: 'apiKey',
                          },
                      ],
                      default: 'apiKey',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Order',
                              value: 'order',
                          },
                          {
                              name: 'Product',
                              value: 'product',
                          },
                      ],
                      default: 'order',
                  },
                  ...OrderDescription_1.orderOperations,
                  ...OrderDescription_1.orderFields,
                  ...ProductDescription_1.productOperations,
                  ...ProductDescription_1.productFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getProducts() {
                      const returnData = [];
                      const products = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'products', 'GET', '/products.json', {}, { fields: 'id,title' });
                      for (const product of products) {
                          const productName = product.title;
                          const productId = product.id;
                          returnData.push({
                              name: productName,
                              value: productId,
                          });
                      }
                      return returnData;
                  },
                  async getLocations() {
                      const returnData = [];
                      const locations = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'locations', 'GET', '/locations.json', {}, { fields: 'id,name' });
                      for (const location of locations) {
                          const locationName = location.name;
                          const locationId = location.id;
                          returnData.push({
                              name: locationName,
                              value: locationId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'order') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const discount = additionalFields.discountCodesUi;
                          const billing = additionalFields.billingAddressUi;
                          const shipping = additionalFields.shippingAddressUi;
                          const lineItem = this.getNodeParameter('limeItemsUi', i)
                              .lineItemValues;
                          if (lineItem === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one line item has to be added', { itemIndex: i });
                          }
                          const body = {
                              test: true,
                              line_items: (0, GenericFunctions_1.keysToSnakeCase)(lineItem),
                          };
                          if (additionalFields.fulfillmentStatus) {
                              body.fulfillment_status = additionalFields.fulfillmentStatus;
                          }
                          if (additionalFields.inventoryBehaviour) {
                              body.inventory_behaviour = additionalFields.inventoryBehaviour;
                          }
                          if (additionalFields.locationId) {
                              body.location_id = additionalFields.locationId;
                          }
                          if (additionalFields.note) {
                              body.note = additionalFields.note;
                          }
                          if (additionalFields.sendFulfillmentReceipt) {
                              body.send_fulfillment_receipt = additionalFields.sendFulfillmentReceipt;
                          }
                          if (additionalFields.sendReceipt) {
                              body.send_receipt = additionalFields.sendReceipt;
                          }
                          if (additionalFields.sendReceipt) {
                              body.send_receipt = additionalFields.sendReceipt;
                          }
                          if (additionalFields.sourceName) {
                              body.source_name = additionalFields.sourceName;
                          }
                          if (additionalFields.tags) {
                              body.tags = additionalFields.tags;
                          }
                          if (additionalFields.test) {
                              body.test = additionalFields.test;
                          }
                          if (additionalFields.email) {
                              body.email = additionalFields.email;
                          }
                          if (discount) {
                              body.discount_codes = discount.discountCodesValues;
                          }
                          if (billing) {
                              body.billing_address = (0, GenericFunctions_1.keysToSnakeCase)(billing.billingAddressValues)[0];
                          }
                          if (shipping) {
                              body.shipping_address = (0, GenericFunctions_1.keysToSnakeCase)(shipping.shippingAddressValues)[0];
                          }
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'POST', '/orders.json', {
                              order: body,
                          });
                          responseData = responseData.order;
                      }
                      if (operation === 'delete') {
                          const orderId = this.getNodeParameter('orderId', i);
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'DELETE', `/orders/${orderId}.json`);
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const orderId = this.getNodeParameter('orderId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.fields) {
                              qs.fields = options.fields;
                          }
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/orders/${orderId}.json`, {}, qs);
                          responseData = responseData.order;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.fields) {
                              qs.fields = options.fields;
                          }
                          if (options.attributionAppId) {
                              qs.attribution_app_id = options.attributionAppId;
                          }
                          if (options.createdAtMin) {
                              qs.created_at_min = options.createdAtMin;
                          }
                          if (options.createdAtMax) {
                              qs.created_at_max = options.createdAtMax;
                          }
                          if (options.updatedAtMax) {
                              qs.updated_at_max = options.updatedAtMax;
                          }
                          if (options.updatedAtMin) {
                              qs.updated_at_min = options.updatedAtMin;
                          }
                          if (options.processedAtMin) {
                              qs.processed_at_min = options.processedAtMin;
                          }
                          if (options.processedAtMax) {
                              qs.processed_at_max = options.processedAtMax;
                          }
                          if (options.sinceId) {
                              qs.since_id = options.sinceId;
                          }
                          if (options.ids) {
                              qs.ids = options.ids;
                          }
                          if (options.status) {
                              qs.status = options.status;
                          }
                          if (options.financialStatus) {
                              qs.financial_status = options.financialStatus;
                          }
                          if (options.fulfillmentStatus) {
                              qs.fulfillment_status = options.fulfillmentStatus;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'orders', 'GET', '/orders.json', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', '/orders.json', {}, qs);
                              responseData = responseData.orders;
                          }
                      }
                      if (operation === 'update') {
                          const orderId = this.getNodeParameter('orderId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const shipping = updateFields.shippingAddressUi;
                          const body = {};
                          if (updateFields.locationId) {
                              body.location_id = updateFields.locationId;
                          }
                          if (updateFields.note) {
                              body.note = updateFields.note;
                          }
                          if (updateFields.sourceName) {
                              body.source_name = updateFields.sourceName;
                          }
                          if (updateFields.tags) {
                              body.tags = updateFields.tags;
                          }
                          if (updateFields.email) {
                              body.email = updateFields.email;
                          }
                          if (shipping) {
                              body.shipping_address = (0, GenericFunctions_1.keysToSnakeCase)(shipping.shippingAddressValues)[0];
                          }
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'PUT', `/orders/${orderId}.json`, {
                              order: body,
                          });
                          responseData = responseData.order;
                      }
                  }
                  else if (resource === 'product') {
                      const productId = this.getNodeParameter('productId', i, '');
                      let body = {};
                      if (operation === 'create') {
                          const title = this.getNodeParameter('title', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          if (additionalFields.productOptions) {
                              const metadata = additionalFields.productOptions
                                  .option;
                              additionalFields.options = {};
                              for (const data of metadata) {
                                  additionalFields.options[data.name] = data.value;
                              }
                              delete additionalFields.productOptions;
                          }
                          body = additionalFields;
                          body.title = title;
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'POST', '/products.json', {
                              product: body,
                          });
                          responseData = responseData.product;
                      }
                      if (operation === 'delete') {
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'DELETE', `/products/${productId}.json`);
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          Object.assign(qs, additionalFields);
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/products/${productId}.json`, {}, qs);
                          responseData = responseData.product;
                      }
                      if (operation === 'getAll') {
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          const returnAll = this.getNodeParameter('returnAll', i);
                          Object.assign(qs, additionalFields);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'products', 'GET', '/products.json', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', '/products.json', {}, qs);
                              responseData = responseData.products;
                          }
                      }
                      if (operation === 'update') {
                          const updateFields = this.getNodeParameter('updateFields', i, {});
                          if (updateFields.productOptions) {
                              const metadata = updateFields.productOptions.option;
                              updateFields.options = {};
                              for (const data of metadata) {
                                  updateFields.options[data.name] = data.value;
                              }
                              delete updateFields.productOptions;
                          }
                          body = updateFields;
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'PUT', `/products/${productId}.json`, { product: body });
                          responseData = responseData.product;
                      }
                  }
                  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.Shopify = Shopify;
  //# sourceMappingURL=Shopify.node.js.map

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


node_type: n8n-nodes-base.Signl4
name: Signl4
package_name: n8n-nodes-base
display_name: SIGNL4
description: Consume SIGNL4 API
code_hash: ecc751791e5a3ffc499f7d9a5a93314a13ff96290453d6af4f1d3438f6f0bf80
source_location: node_modules/n8n-nodes-base/dist/nodes/Signl4/Signl4.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.Signl4 = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Signl4 {
      constructor() {
          this.description = {
              displayName: 'SIGNL4',
              name: 'signl4',
              icon: 'file:signl4.png',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume SIGNL4 API',
              defaults: {
                  name: 'SIGNL4',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'signl4Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Alert',
                              value: 'alert',
                          },
                      ],
                      default: 'alert',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['alert'],
                          },
                      },
                      options: [
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Send an alert',
                              action: 'Send an alert',
                          },
                          {
                              name: 'Resolve',
                              value: 'resolve',
                              description: 'Resolve an alert',
                              action: 'Resolve an alert',
                          },
                      ],
                      default: 'send',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['alert'],
                          },
                      },
                      description: 'A more detailed description for the alert',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['alert'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Alerting Scenario',
                              name: 'alertingScenario',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Single ACK',
                                      value: 'single_ack',
                                      description: 'In case only one person needs to confirm this Signl',
                                  },
                                  {
                                      name: 'Multi ACK',
                                      value: 'multi_ack',
                                      description: 'In case this alert must be confirmed by the number of people who are on duty at the time this Singl is raised',
                                  },
                              ],
                              default: 'single_ack',
                          },
                          {
                              displayName: 'Attachments',
                              name: 'attachmentsUi',
                              placeholder: 'Add Attachments',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: false,
                              },
                              options: [
                                  {
                                      name: 'attachmentsBinary',
                                      displayName: 'Attachments Binary',
                                      values: [
                                          {
                                              displayName: 'Property Name',
                                              name: 'property',
                                              type: 'string',
                                              placeholder: 'data',
                                              default: '',
                                              description: 'Name of the binary properties which contain data which should be added as attachment',
                                          },
                                      ],
                                  },
                              ],
                              default: {},
                          },
                          {
                              displayName: 'External ID',
                              name: 'externalId',
                              type: 'string',
                              default: '',
                              description: 'If the event originates from a record in a 3rd party system, use this parameter to pass the unique ID of that record. That ID will be communicated in outbound webhook notifications from SIGNL4, which is great for correlation/synchronization of that record with the alert. If you resolve / close an alert you must use the same External ID as in the original alert.',
                          },
                          {
                              displayName: 'Filtering',
                              name: 'filtering',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to apply event filtering for this event, or not. If set to true, the event will only trigger a notification to the team, if it contains at least one keyword from one of your services and system categories (i.e. it is whitelisted)',
                          },
                          {
                              displayName: 'Location',
                              name: 'locationFieldsUi',
                              type: 'fixedCollection',
                              placeholder: 'Add Location',
                              default: {},
                              description: "Transmit location information ('latitude, longitude') with your event and display a map in the mobile app",
                              options: [
                                  {
                                      name: 'locationFieldsValues',
                                      displayName: 'Location',
                                      values: [
                                          {
                                              displayName: 'Latitude',
                                              name: 'latitude',
                                              type: 'string',
                                              required: true,
                                              description: 'The location latitude',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Longitude',
                                              name: 'longitude',
                                              type: 'string',
                                              required: true,
                                              description: 'The location longitude',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Service',
                              name: 'service',
                              type: 'string',
                              default: '',
                              description: 'Assigns the alert to the service/system category with the specified name',
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'The title or subject of this alert',
                          },
                      ],
                  },
                  {
                      displayName: 'External ID',
                      name: 'externalId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['resolve'],
                              resource: ['alert'],
                          },
                      },
                      description: 'If the event originates from a record in a 3rd party system, use this parameter to pass the unique ID of that record. That ID will be communicated in outbound webhook notifications from SIGNL4, which is great for correlation/synchronization of that record with the alert. If you resolve / close an alert you must use the same External ID as in the original alert.',
                  },
              ],
          };
      }
      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 === 'alert') {
                      if (operation === 'send') {
                          const message = this.getNodeParameter('message', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const data = {
                              message,
                          };
                          if (additionalFields.title) {
                              data.title = additionalFields.title;
                          }
                          if (additionalFields.service) {
                              data.service = additionalFields.service;
                          }
                          if (additionalFields.locationFieldsUi) {
                              const locationUi = additionalFields.locationFieldsUi
                                  .locationFieldsValues;
                              if (locationUi) {
                                  data['X-S4-Location'] = `${locationUi.latitude},${locationUi.longitude}`;
                              }
                          }
                          if (additionalFields.alertingScenario) {
                              data['X-S4-AlertingScenario'] = additionalFields.alertingScenario;
                          }
                          if (additionalFields.filtering) {
                              data['X-S4-Filtering'] = additionalFields.filtering.toString();
                          }
                          if (additionalFields.externalId) {
                              data['X-S4-ExternalID'] = additionalFields.externalId;
                          }
                          data['X-S4-Status'] = 'new';
                          data['X-S4-SourceSystem'] = 'n8n';
                          const attachments = additionalFields.attachmentsUi;
                          if (attachments === null || attachments === void 0 ? void 0 : attachments.attachmentsBinary) {
                              const propertyName = attachments.attachmentsBinary
                                  .property;
                              const binaryData = this.helpers.assertBinaryData(i, propertyName);
                              if (binaryData) {
                                  const supportedFileExtension = ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'mp3', 'wav'];
                                  if (!supportedFileExtension.includes(binaryData.fileExtension)) {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid extension, just ${supportedFileExtension.join(',')} are supported}`, { itemIndex: i });
                                  }
                                  const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, propertyName);
                                  data.attachment = {
                                      value: binaryDataBuffer,
                                      options: {
                                          filename: binaryData.fileName,
                                          contentType: binaryData.mimeType,
                                      },
                                  };
                              }
                          }
                          responseData = await GenericFunctions_1.SIGNL4ApiRequest.call(this, 'POST', '', {}, {
                              formData: data,
                          });
                      }
                      if (operation === 'resolve') {
                          const data = {};
                          data['X-S4-ExternalID'] = this.getNodeParameter('externalId', i);
                          data['X-S4-Status'] = 'resolved';
                          data['X-S4-SourceSystem'] = 'n8n';
                          responseData = await GenericFunctions_1.SIGNL4ApiRequest.call(this, 'POST', '', {}, {
                              formData: data,
                          });
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else if (responseData !== undefined) {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Signl4 = Signl4;
  //# sourceMappingURL=Signl4.node.js.map

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


node_type: n8n-nodes-base.Slack
name: Slack
package_name: n8n-nodes-base
display_name: Slack
description: Consume Slack API
code_hash: 0ed10d0646f3c595406359edfa2c293dac41991cee59ad4fb3ccf2bb70eca6fc
source_location: node_modules/n8n-nodes-base/dist/nodes/Slack/Slack.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.Slack = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SlackV1_node_1 = require("./V1/SlackV1.node");
  const SlackV2_node_1 = require("./V2/SlackV2.node");
  class Slack extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Slack',
              name: 'slack',
              icon: 'file:slack.svg',
              group: ['output'],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Slack API',
              defaultVersion: 2.1,
          };
          const nodeVersions = {
              1: new SlackV1_node_1.SlackV1(baseDescription),
              2: new SlackV2_node_1.SlackV2(baseDescription),
              2.1: new SlackV2_node_1.SlackV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Slack = Slack;
  //# sourceMappingURL=Slack.node.js.map

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


node_type: n8n-nodes-base.Sms77
name: Sms77
package_name: n8n-nodes-base
display_name: seven
description: Send SMS and make text-to-speech calls
code_hash: aa9de8dde48b46654d68fcb68dc969e66a6ebb93af370b08a8c8919f7d65d0fd
source_location: node_modules/n8n-nodes-base/dist/nodes/Sms77/Sms77.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Sms77 = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Sms77 {
      constructor() {
          this.description = {
              displayName: 'seven',
              name: 'sms77',
              icon: 'file:seven.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Send SMS and make text-to-speech calls',
              defaults: {
                  name: 'seven',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sms77Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'SMS',
                              value: 'sms',
                          },
                          {
                              name: 'Voice Call',
                              value: 'voice',
                          },
                      ],
                      default: 'sms',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['sms'],
                          },
                      },
                      options: [
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Send SMS',
                              action: 'Send an SMS',
                          },
                      ],
                      default: 'send',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['voice'],
                          },
                      },
                      options: [
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Converts text to voice and calls a given number',
                              action: 'Convert text to voice',
                          },
                      ],
                      default: 'send',
                  },
                  {
                      displayName: 'From',
                      name: 'from',
                      type: 'string',
                      default: '',
                      placeholder: '+4901234567890',
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms'],
                          },
                      },
                      description: 'The caller ID displayed in the receivers display. Max 16 numeric or 11 alphanumeric characters.',
                  },
                  {
                      displayName: 'To',
                      name: 'to',
                      type: 'string',
                      default: '',
                      placeholder: '+49876543210, MyGroup',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms', 'voice'],
                          },
                      },
                      description: 'The number of your recipient(s) separated by comma. Can be regular numbers or contact/groups from seven.',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms', 'voice'],
                          },
                      },
                      description: 'The message to send. Max. 1520 characters',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Opton',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Debug',
                              name: 'debug',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the API returns fake responses like in a sandbox',
                          },
                          {
                              displayName: 'Delay',
                              name: 'delay',
                              type: 'dateTime',
                              default: '',
                              description: 'Pick a date for time delayed dispatch',
                          },
                          {
                              displayName: 'Foreign ID',
                              name: 'foreign_id',
                              type: 'string',
                              default: '',
                              placeholder: 'MyCustomForeignID',
                              description: 'Custom foreign ID returned in DLR callbacks',
                          },
                          {
                              displayName: 'Flash',
                              name: 'flash',
                              type: 'boolean',
                              default: false,
                              description: "Send as flash message being displayed directly the receiver's display",
                          },
                          {
                              displayName: 'Label',
                              name: 'label',
                              type: 'string',
                              default: '',
                              placeholder: 'MyCustomLabel',
                              description: 'Custom label used to group analytics',
                          },
                          {
                              displayName: 'No Reload',
                              name: 'no_reload',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to disable reload lock to allow sending duplicate messages',
                          },
                          {
                              displayName: 'Performance Tracking',
                              name: 'performance_tracking',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to enable performance tracking for URLs found in the message text',
                          },
                          {
                              displayName: 'TTL',
                              name: 'ttl',
                              type: 'number',
                              default: 2880,
                              typeOptions: {
                                  minValue: 1,
                              },
                              description: 'Custom time to live specifying the validity period of a message in minutes',
                          },
                      ],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Opton',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['voice'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Debug',
                              name: 'debug',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the API returns fake responses like in a sandbox',
                          },
                          {
                              displayName: 'From',
                              name: 'from',
                              type: 'string',
                              default: '',
                              placeholder: '+4901234567890',
                              description: 'The caller ID. Please use only verified sender IDs, one of your virtual inbound numbers or one of our shared virtual numbers.',
                          },
                          {
                              displayName: 'XML',
                              name: 'xml',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the text is in XML format',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const returnData = [];
          for (let i = 0; i < this.getInputData().length; i++) {
              const resource = this.getNodeParameter('resource', i);
              const operation = this.getNodeParameter('operation', i);
              let responseData;
              try {
                  if (resource === 'sms') {
                      if (operation === 'send') {
                          const from = this.getNodeParameter('from', i);
                          const to = this.getNodeParameter('to', i);
                          const text = this.getNodeParameter('message', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              from,
                              to,
                              text,
                              ...options,
                          };
                          responseData = await GenericFunctions_1.sms77ApiRequest.call(this, 'POST', '/sms', body);
                      }
                  }
                  if (resource === 'voice') {
                      if (operation === 'send') {
                          const to = this.getNodeParameter('to', i);
                          const text = this.getNodeParameter('message', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              to,
                              text,
                              ...options,
                          };
                          responseData = await GenericFunctions_1.sms77ApiRequest.call(this, 'POST', '/voice', body);
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else if (responseData !== undefined) {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Sms77 = Sms77;
  //# sourceMappingURL=Sms77.node.js.map

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


node_type: n8n-nodes-base.Snowflake
name: Snowflake
package_name: n8n-nodes-base
display_name: Snowflake
description: Get, add and update data in Snowflake
code_hash: 500143dab0de2d112b6848ed3cc32c7b191fca0b0aa4323cb3c8b7da66b93cc4
source_location: node_modules/n8n-nodes-base/dist/nodes/Snowflake/Snowflake.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
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.Snowflake = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const snowflake_sdk_1 = __importDefault(require("snowflake-sdk"));
  const utilities_1 = require("../../utils/utilities");
  class Snowflake {
      constructor() {
          this.description = {
              displayName: 'Snowflake',
              name: 'snowflake',
              icon: 'file:snowflake.svg',
              group: ['input'],
              version: 1,
              description: 'Get, add and update data in Snowflake',
              defaults: {
                  name: 'Snowflake',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'snowflake',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Execute Query',
                              value: 'executeQuery',
                              description: 'Execute an SQL query',
                              action: 'Execute a SQL query',
                          },
                          {
                              name: 'Insert',
                              value: 'insert',
                              description: 'Insert rows in database',
                              action: 'Insert rows in database',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update rows in database',
                              action: 'Update rows in database',
                          },
                      ],
                      default: 'insert',
                  },
                  {
                      displayName: 'Query',
                      name: 'query',
                      type: 'string',
                      noDataExpression: true,
                      typeOptions: {
                          editor: 'sqlEditor',
                          rows: 5,
                      },
                      displayOptions: {
                          show: {
                              operation: ['executeQuery'],
                          },
                      },
                      default: '',
                      placeholder: 'SELECT id, name FROM product WHERE id < 40',
                      required: true,
                      description: 'The SQL query to execute',
                  },
                  {
                      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: 'Table',
                      name: 'table',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the table in which to update data in',
                  },
                  {
                      displayName: 'Update Key',
                      name: 'updateKey',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      default: 'id',
                      required: true,
                      description: 'Name of the property which decides which rows in the database should be updated. Normally that would be "id".',
                  },
                  {
                      displayName: 'Columns',
                      name: 'columns',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      default: '',
                      placeholder: 'name,description',
                      description: 'Comma-separated list of the properties which should used as columns for rows to update',
                  },
              ],
          };
      }
      async execute() {
          const credentials = (await this.getCredentials('snowflake'));
          const returnData = [];
          let responseData;
          const connection = snowflake_sdk_1.default.createConnection(credentials);
          await (0, GenericFunctions_1.connect)(connection);
          const items = this.getInputData();
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'executeQuery') {
              for (let i = 0; i < items.length; i++) {
                  let query = this.getNodeParameter('query', i);
                  for (const resolvable of (0, utilities_1.getResolvables)(query)) {
                      query = query.replace(resolvable, this.evaluateExpression(resolvable, i));
                  }
                  responseData = await (0, GenericFunctions_1.execute)(connection, query, []);
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
          }
          if (operation === 'insert') {
              const table = this.getNodeParameter('table', 0);
              const columnString = this.getNodeParameter('columns', 0);
              const columns = columnString.split(',').map((column) => column.trim());
              const query = `INSERT INTO ${table}(${columns.join(',')}) VALUES (${columns
                  .map((_column) => '?')
                  .join(',')})`;
              const data = this.helpers.copyInputItems(items, columns);
              const binds = data.map((element) => Object.values(element));
              await (0, GenericFunctions_1.execute)(connection, query, binds);
              data.forEach((d, i) => {
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(d), { itemData: { item: i } });
                  returnData.push(...executionData);
              });
          }
          if (operation === 'update') {
              const table = this.getNodeParameter('table', 0);
              const updateKey = this.getNodeParameter('updateKey', 0);
              const columnString = this.getNodeParameter('columns', 0);
              const columns = columnString.split(',').map((column) => column.trim());
              if (!columns.includes(updateKey)) {
                  columns.unshift(updateKey);
              }
              const query = `UPDATE ${table} SET ${columns
                  .map((column) => `${column} = ?`)
                  .join(',')} WHERE ${updateKey} = ?;`;
              const data = this.helpers.copyInputItems(items, columns);
              const binds = data.map((element) => Object.values(element).concat(element[updateKey]));
              for (let i = 0; i < binds.length; i++) {
                  await (0, GenericFunctions_1.execute)(connection, query, binds[i]);
              }
              data.forEach((d, i) => {
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(d), { itemData: { item: i } });
                  returnData.push(...executionData);
              });
          }
          await (0, GenericFunctions_1.destroy)(connection);
          return [returnData];
      }
  }
  exports.Snowflake = Snowflake;
  //# sourceMappingURL=Snowflake.node.js.map

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


node_type: n8n-nodes-base.SplitInBatches
name: SplitInBatches
package_name: n8n-nodes-base
display_name: Split In Batches
description: Split data into batches and iterate over each batch
code_hash: c751422a11e30bf361a6c4803376289740a40434aeb77f90e18cd4dd7ba5c019
source_location: node_modules/n8n-nodes-base/dist/nodes/SplitInBatches/SplitInBatches.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SplitInBatches = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SplitInBatchesV1_node_1 = require("./v1/SplitInBatchesV1.node");
  const SplitInBatchesV2_node_1 = require("./v2/SplitInBatchesV2.node");
  const SplitInBatchesV3_node_1 = require("./v3/SplitInBatchesV3.node");
  class SplitInBatches extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Split In Batches',
              name: 'splitInBatches',
              icon: 'fa:th-large',
              group: ['organization'],
              description: 'Split data into batches and iterate over each batch',
              defaultVersion: 3,
          };
          const nodeVersions = {
              1: new SplitInBatchesV1_node_1.SplitInBatchesV1(),
              2: new SplitInBatchesV2_node_1.SplitInBatchesV2(),
              3: new SplitInBatchesV3_node_1.SplitInBatchesV3(),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.SplitInBatches = SplitInBatches;
  //# sourceMappingURL=SplitInBatches.node.js.map

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


node_type: n8n-nodes-base.Splunk
name: Splunk
package_name: n8n-nodes-base
display_name: Splunk
description: Consume the Splunk Enterprise API
code_hash: 8970779a0ac1a63e37de3d5c596afa6149c66570fc8fc6f0f3a952c70a600f74
source_location: node_modules/n8n-nodes-base/dist/nodes/Splunk/Splunk.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Splunk = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  class Splunk {
      constructor() {
          this.description = {
              displayName: 'Splunk',
              name: 'splunk',
              icon: 'file:splunk.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Splunk Enterprise API',
              defaults: {
                  name: 'Splunk',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'splunkApi',
                      required: true,
                      testedBy: 'splunkApiTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Fired Alert',
                              value: 'firedAlert',
                          },
                          {
                              name: 'Search Configuration',
                              value: 'searchConfiguration',
                          },
                          {
                              name: 'Search Job',
                              value: 'searchJob',
                          },
                          {
                              name: 'Search Result',
                              value: 'searchResult',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'searchJob',
                  },
                  ...descriptions_1.firedAlertOperations,
                  ...descriptions_1.searchConfigurationOperations,
                  ...descriptions_1.searchConfigurationFields,
                  ...descriptions_1.searchJobOperations,
                  ...descriptions_1.searchJobFields,
                  ...descriptions_1.searchResultOperations,
                  ...descriptions_1.searchResultFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getRoles() {
                      const endpoint = '/services/authorization/roles';
                      const responseData = (await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint));
                      const { entry: entries } = responseData.feed;
                      return Array.isArray(entries)
                          ? entries.map((entry) => ({ name: entry.title, value: entry.title }))
                          : [{ name: entries.title, value: entries.title }];
                  },
              },
              credentialTest: {
                  async splunkApiTest(credential) {
                      const { authToken, baseUrl, allowUnauthorizedCerts } = credential.data;
                      const endpoint = '/services/alerts/fired_alerts';
                      const options = {
                          headers: {
                              Authorization: `Bearer ${authToken}`,
                              'Content-Type': 'application/x-www-form-urlencoded',
                          },
                          method: 'GET',
                          form: {},
                          qs: {},
                          uri: `${baseUrl}${endpoint}`,
                          json: true,
                          rejectUnauthorized: !allowUnauthorizedCerts,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          var _a;
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'firedAlert') {
                      if (operation === 'getReport') {
                          const endpoint = '/services/alerts/fired_alerts';
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatFeed);
                      }
                  }
                  else if (resource === 'searchConfiguration') {
                      if (operation === 'delete') {
                          const partialEndpoint = '/services/saved/searches/';
                          const searchConfigurationId = GenericFunctions_1.getId.call(this, i, 'searchConfigurationId', '/search/saved/searches/');
                          const endpoint = `${partialEndpoint}/${searchConfigurationId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const partialEndpoint = '/services/saved/searches/';
                          const searchConfigurationId = GenericFunctions_1.getId.call(this, i, 'searchConfigurationId', '/search/saved/searches/');
                          const endpoint = `${partialEndpoint}/${searchConfigurationId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatFeed);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const options = this.getNodeParameter('options', i);
                          (0, GenericFunctions_1.populate)(options, qs);
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = '/services/saved/searches';
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'GET', endpoint, {}, qs)
                              .then(GenericFunctions_1.formatFeed);
                      }
                  }
                  else if (resource === 'searchJob') {
                      if (operation === 'create') {
                          const body = {
                              search: this.getNodeParameter('search', i),
                          };
                          const { earliest_time, latest_time, index_earliest, index_latest, ...rest } = this.getNodeParameter('additionalFields', i);
                          (0, GenericFunctions_1.populate)({
                              ...(earliest_time && { earliest_time: (0, GenericFunctions_1.toUnixEpoch)(earliest_time) }),
                              ...(latest_time && { latest_time: (0, GenericFunctions_1.toUnixEpoch)(latest_time) }),
                              ...(index_earliest && { index_earliest: (0, GenericFunctions_1.toUnixEpoch)(index_earliest) }),
                              ...(index_latest && { index_latest: (0, GenericFunctions_1.toUnixEpoch)(index_latest) }),
                              ...rest,
                          }, body);
                          const endpoint = '/services/search/jobs';
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'POST', endpoint, body);
                          const getEndpoint = `/services/search/jobs/${responseData.response.sid}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', getEndpoint).then(GenericFunctions_1.formatSearch);
                      }
                      else if (operation === 'delete') {
                          const partialEndpoint = '/services/search/jobs/';
                          const searchJobId = GenericFunctions_1.getId.call(this, i, 'searchJobId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${searchJobId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const partialEndpoint = '/services/search/jobs/';
                          const searchJobId = GenericFunctions_1.getId.call(this, i, 'searchJobId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${searchJobId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatSearch);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const options = this.getNodeParameter('options', i);
                          (0, GenericFunctions_1.populate)(options, qs);
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = '/services/search/jobs';
                          responseData = (await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint, {}, qs));
                          responseData = (0, GenericFunctions_1.formatFeed)(responseData);
                      }
                  }
                  else if (resource === 'searchResult') {
                      if (operation === 'getAll') {
                          const searchJobId = this.getNodeParameter('searchJobId', i);
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          const options = this.getNodeParameter('options', i);
                          const keyValuePair = (_a = filters === null || filters === void 0 ? void 0 : filters.keyValueMatch) === null || _a === void 0 ? void 0 : _a.keyValuePair;
                          if ((keyValuePair === null || keyValuePair === void 0 ? void 0 : keyValuePair.key) && (keyValuePair === null || keyValuePair === void 0 ? void 0 : keyValuePair.value)) {
                              qs.search = `search ${keyValuePair.key}=${keyValuePair.value}`;
                          }
                          (0, GenericFunctions_1.populate)(options, qs);
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = `/services/search/jobs/${searchJobId}/results`;
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'GET', endpoint, {}, qs)
                              .then(GenericFunctions_1.formatResults);
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'create') {
                          const roles = this.getNodeParameter('roles', i);
                          const body = {
                              name: this.getNodeParameter('name', i),
                              roles,
                              password: this.getNodeParameter('password', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          (0, GenericFunctions_1.populate)(additionalFields, body);
                          const endpoint = '/services/authentication/users';
                          responseData = (await GenericFunctions_1.splunkApiRequest.call(this, 'POST', endpoint, body));
                          responseData = (0, GenericFunctions_1.formatFeed)(responseData);
                      }
                      else if (operation === 'delete') {
                          const partialEndpoint = '/services/authentication/users';
                          const userId = GenericFunctions_1.getId.call(this, i, 'userId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${userId}`;
                          await GenericFunctions_1.splunkApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const partialEndpoint = '/services/authentication/users/';
                          const userId = GenericFunctions_1.getId.call(this, i, 'userId', '/services/authentication/users/');
                          const endpoint = `${partialEndpoint}/${userId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatFeed);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = '/services/authentication/users';
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'GET', endpoint, {}, qs)
                              .then(GenericFunctions_1.formatFeed);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const { roles, ...rest } = this.getNodeParameter('updateFields', i);
                          (0, GenericFunctions_1.populate)({
                              ...(roles && { roles }),
                              ...rest,
                          }, body);
                          const partialEndpoint = '/services/authentication/users/';
                          const userId = GenericFunctions_1.getId.call(this, i, 'userId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${userId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'POST', endpoint, body)
                              .then(GenericFunctions_1.formatFeed);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.cause.error });
                      continue;
                  }
                  throw error;
              }
              Array.isArray(responseData)
                  ? returnData.push(...responseData)
                  : returnData.push(responseData);
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Splunk = Splunk;
  //# sourceMappingURL=Splunk.node.js.map

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


node_type: n8n-nodes-base.Spontit
name: Spontit
package_name: n8n-nodes-base
display_name: Spontit
description: Consume Spontit API
code_hash: 33769d94fd78408d188102c331b5795082646047dcc5544e182e4f3a11529f4d
source_location: node_modules/n8n-nodes-base/dist/nodes/Spontit/Spontit.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
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.Spontit = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const PushDescription_1 = require("./PushDescription");
  const moment_1 = __importDefault(require("moment"));
  class Spontit {
      constructor() {
          this.description = {
              displayName: 'Spontit',
              name: 'spontit',
              icon: 'file:spontit.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Spontit API',
              defaults: {
                  name: 'Spontit',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'spontitApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Push',
                              value: 'push',
                          },
                      ],
                      default: 'push',
                  },
                  ...PushDescription_1.pushOperations,
                  ...PushDescription_1.pushFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const timezone = this.getTimezone();
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'push') {
                      if (operation === 'create') {
                          const content = this.getNodeParameter('content', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              content,
                          };
                          Object.assign(body, additionalFields);
                          if (body.pushToFollowers) {
                              body.pushToFollowers = body.pushToFollowers.split(',');
                          }
                          if (body.pushToPhoneNumbers) {
                              body.pushToPhoneNumbers = body.pushToPhoneNumbers.split(',');
                          }
                          if (body.pushToEmails) {
                              body.pushToEmails = body.pushToEmails.split(',');
                          }
                          if (body.schedule) {
                              body.scheduled = moment_1.default.tz(body.schedule, timezone).unix();
                          }
                          if (body.expirationStamp) {
                              body.expirationStamp = moment_1.default.tz(body.expirationStamp, timezone).unix();
                          }
                          responseData = await GenericFunctions_1.spontitApiRequest.call(this, 'POST', '/push', body);
                          responseData = responseData.data;
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else if (responseData !== undefined) {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Spontit = Spontit;
  //# sourceMappingURL=Spontit.node.js.map

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


node_type: n8n-nodes-base.Spotify
name: Spotify
package_name: n8n-nodes-base
display_name: Spotify
description: Access public song data via the Spotify API
code_hash: 1a821c70bcb95f1080d2a7f8f2884b566c30771e6de24c0a9a28da9a76c8f677
source_location: node_modules/n8n-nodes-base/dist/nodes/Spotify/Spotify.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Spotify = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const IsoCountryCodes_1 = require("./IsoCountryCodes");
  class Spotify {
      constructor() {
          this.description = {
              displayName: 'Spotify',
              name: 'spotify',
              icon: 'file:spotify.svg',
              group: ['input'],
              version: 1,
              description: 'Access public song data via the Spotify API',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'Spotify',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'spotifyOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Album',
                              value: 'album',
                          },
                          {
                              name: 'Artist',
                              value: 'artist',
                          },
                          {
                              name: 'Library',
                              value: 'library',
                          },
                          {
                              name: 'My Data',
                              value: 'myData',
                          },
                          {
                              name: 'Player',
                              value: 'player',
                          },
                          {
                              name: 'Playlist',
                              value: 'playlist',
                          },
                          {
                              name: 'Track',
                              value: 'track',
                          },
                      ],
                      default: 'player',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                          },
                      },
                      options: [
                          {
                              name: 'Add Song to Queue',
                              value: 'addSongToQueue',
                              description: 'Add a song to your queue',
                              action: 'Add a song to a queue',
                          },
                          {
                              name: 'Currently Playing',
                              value: 'currentlyPlaying',
                              description: 'Get your currently playing track',
                              action: 'Get the currently playing track',
                          },
                          {
                              name: 'Next Song',
                              value: 'nextSong',
                              description: 'Skip to your next track',
                              action: 'Skip to the next track',
                          },
                          {
                              name: 'Pause',
                              value: 'pause',
                              description: 'Pause your music',
                              action: 'Pause the player',
                          },
                          {
                              name: 'Previous Song',
                              value: 'previousSong',
                              description: 'Skip to your previous song',
                              action: 'Skip to the previous song',
                          },
                          {
                              name: 'Recently Played',
                              value: 'recentlyPlayed',
                              description: 'Get your recently played tracks',
                              action: 'Get the recently played tracks',
                          },
                          {
                              name: 'Resume',
                              value: 'resume',
                              description: 'Resume playback on the current active device',
                              action: 'Resume the player',
                          },
                          {
                              name: 'Set Volume',
                              value: 'volume',
                              description: 'Set volume on the current active device',
                              action: 'Set volume on the player',
                          },
                          {
                              name: 'Start Music',
                              value: 'startMusic',
                              description: 'Start playing a playlist, artist, or album',
                              action: 'Start music on the player',
                          },
                      ],
                      default: 'addSongToQueue',
                  },
                  {
                      displayName: 'Resource ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                              operation: ['startMusic'],
                          },
                      },
                      placeholder: 'spotify:album:1YZ3k65Mqw3G8FzYlW1mmp',
                      description: 'Enter a playlist, artist, or album URI or ID',
                  },
                  {
                      displayName: 'Track ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                              operation: ['addSongToQueue'],
                          },
                      },
                      placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
                      description: 'Enter a track URI or ID',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['album'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get an album by URI or ID',
                              action: 'Get an album',
                          },
                          {
                              name: 'Get New Releases',
                              value: 'getNewReleases',
                              description: 'Get a list of new album releases',
                              action: 'Get new album releases',
                          },
                          {
                              name: 'Get Tracks',
                              value: 'getTracks',
                              description: "Get an album's tracks by URI or ID",
                              action: "Get an album's tracks by URI or ID",
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search albums by keyword',
                              action: 'Search albums by keyword',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Album ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['album'],
                              operation: ['get', 'getTracks'],
                          },
                          hide: {
                              operation: ['search'],
                          },
                      },
                      placeholder: 'spotify:album:1YZ3k65Mqw3G8FzYlW1mmp',
                      description: "The album's Spotify URI or ID",
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['album'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get an artist by URI or ID',
                              action: 'Get an artist',
                          },
                          {
                              name: 'Get Albums',
                              value: 'getAlbums',
                              description: "Get an artist's albums by URI or ID",
                              action: "Get an artist's albums by URI or ID",
                          },
                          {
                              name: 'Get Related Artists',
                              value: 'getRelatedArtists',
                              description: "Get an artist's related artists by URI or ID",
                              action: "Get an artist's related artists by URI or ID",
                          },
                          {
                              name: 'Get Top Tracks',
                              value: 'getTopTracks',
                              description: "Get an artist's top tracks by URI or ID",
                              action: "Get an artist's top tracks by URI or ID",
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search artists by keyword',
                              action: 'Search artists by keyword',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Artist ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                          },
                          hide: {
                              operation: ['search'],
                          },
                      },
                      placeholder: 'spotify:artist:4LLpKhyESsyAXpc4laK94U',
                      description: "The artist's Spotify URI or ID",
                  },
                  {
                      displayName: 'Country',
                      name: 'country',
                      type: 'string',
                      default: 'US',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                              operation: ['getTopTracks'],
                          },
                      },
                      placeholder: 'US',
                      description: 'Top tracks in which country? Enter the postal abbreviation',
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                          },
                      },
                      options: [
                          {
                              name: 'Add an Item',
                              value: 'add',
                              description: 'Add tracks to a playlist by track and playlist URI or ID',
                              action: 'Add an Item to a playlist',
                          },
                          {
                              name: 'Create a Playlist',
                              value: 'create',
                              description: 'Create a new playlist',
                              action: 'Create a playlist',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a playlist by URI or ID',
                              action: 'Get a playlist',
                          },
                          {
                              name: "Get the User's Playlists",
                              value: 'getUserPlaylists',
                              description: "Get a user's playlists",
                              action: "Get a user's playlists",
                          },
                          {
                              name: 'Get Tracks',
                              value: 'getTracks',
                              description: "Get a playlist's tracks by URI or ID",
                              action: "Get a playlist's tracks by URI or ID",
                          },
                          {
                              name: 'Remove an Item',
                              value: 'delete',
                              description: 'Remove tracks from a playlist by track and playlist URI or ID',
                              action: 'Remove an item from a playlist',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search playlists by keyword',
                              action: 'Search playlists by keyword',
                          },
                      ],
                      default: 'add',
                  },
                  {
                      displayName: 'Playlist ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['add', 'delete', 'get', 'getTracks'],
                          },
                      },
                      placeholder: 'spotify:playlist:37i9dQZF1DWUhI3iC1khPH',
                      description: "The playlist's Spotify URI or its ID",
                  },
                  {
                      displayName: 'Name',
                      name: 'name',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['create'],
                          },
                      },
                      placeholder: 'Favorite Songs',
                      description: 'Name of the playlist to create',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Description',
                              name: 'description',
                              type: 'string',
                              default: '',
                              placeholder: 'These are all my favorite songs.',
                              description: 'Description for the playlist to create',
                          },
                          {
                              displayName: 'Public',
                              name: 'public',
                              type: 'boolean',
                              default: true,
                              description: 'Whether the playlist is publicly accessible',
                          },
                      ],
                  },
                  {
                      displayName: 'Track ID',
                      name: 'trackID',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['add', 'delete'],
                          },
                      },
                      placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
                      description: "The track's Spotify URI or its ID. The track to add/delete from the playlist.",
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['add'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Position',
                              name: 'position',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              default: 0,
                              placeholder: '0',
                              description: "The new track's position in the playlist",
                          },
                      ],
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['track'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a track by its URI or ID',
                              action: 'Get a track',
                          },
                          {
                              name: 'Get Audio Features',
                              value: 'getAudioFeatures',
                              description: 'Get audio features for a track by URI or ID',
                              action: 'Get audio features of a track',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search tracks by keyword',
                              action: 'Search tracks by keyword',
                          },
                      ],
                      default: 'track',
                  },
                  {
                      displayName: 'Track ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['track'],
                          },
                          hide: {
                              operation: ['search'],
                          },
                      },
                      placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
                      description: "The track's Spotify URI or ID",
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['track'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['library'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Liked Tracks',
                              value: 'getLikedTracks',
                              description: "Get the user's liked tracks",
                              action: 'Get liked tracks',
                          },
                      ],
                      default: 'getLikedTracks',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['myData'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Following Artists',
                              value: 'getFollowingArtists',
                              description: 'Get your followed artists',
                              action: 'Get your followed artists',
                          },
                      ],
                      default: 'getFollowingArtists',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      default: false,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['album', 'artist', 'library', 'myData', 'playlist', 'track', 'player'],
                              operation: [
                                  'getTracks',
                                  'getAlbums',
                                  'getUserPlaylists',
                                  'getNewReleases',
                                  'getLikedTracks',
                                  'getFollowingArtists',
                                  'search',
                                  'recentlyPlayed',
                              ],
                          },
                      },
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      default: 50,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['album', 'artist', 'library', 'playlist', 'track'],
                              operation: [
                                  'getTracks',
                                  'getAlbums',
                                  'getUserPlaylists',
                                  'getNewReleases',
                                  'getLikedTracks',
                                  'search',
                              ],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      default: 50,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['myData', 'player'],
                              operation: ['getFollowingArtists', 'recentlyPlayed'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 50,
                      },
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Volume',
                      name: 'volumePercent',
                      type: 'number',
                      default: 50,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                              operation: ['volume'],
                          },
                      },
                      typeOptions: {
                          minValue: 0,
                          maxValue: 100,
                      },
                      description: 'The volume percentage to set',
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['album'],
                              operation: ['getNewReleases'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Country',
                              name: 'country',
                              type: 'options',
                              default: 'US',
                              options: IsoCountryCodes_1.isoCountryCodes.map(({ name, alpha2 }) => ({ name, value: alpha2 })),
                              description: 'Country to filter new releases by',
                          },
                      ],
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['playlist', 'artist', 'track', 'album'],
                              operation: ['search'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Country',
                              name: 'market',
                              type: 'options',
                              options: IsoCountryCodes_1.isoCountryCodes.map(({ name, alpha2 }) => ({ name, value: alpha2 })),
                              default: '',
                              description: 'If a country code is specified, only content that is playable in that market is returned',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const body = {};
          let qs;
          let requestMethod;
          let endpoint;
          let returnAll;
          let propertyName = '';
          let responseData;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          requestMethod = 'GET';
          endpoint = '';
          qs = {};
          returnAll = false;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'player') {
                      if (operation === 'pause') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/pause';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'recentlyPlayed') {
                          requestMethod = 'GET';
                          endpoint = '/me/player/recently-played';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'currentlyPlaying') {
                          requestMethod = 'GET';
                          endpoint = '/me/player/currently-playing';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'nextSong') {
                          requestMethod = 'POST';
                          endpoint = '/me/player/next';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'previousSong') {
                          requestMethod = 'POST';
                          endpoint = '/me/player/previous';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'startMusic') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/play';
                          const id = this.getNodeParameter('id', i);
                          body.context_uri = id;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'addSongToQueue') {
                          requestMethod = 'POST';
                          endpoint = '/me/player/queue';
                          const id = this.getNodeParameter('id', i);
                          qs = {
                              uri: id,
                          };
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'resume') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/play';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'volume') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/volume';
                          const volumePercent = this.getNodeParameter('volumePercent', i);
                          qs = {
                              volume_percent: volumePercent,
                          };
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                  }
                  else if (resource === 'album') {
                      if (operation === 'get') {
                          const uri = this.getNodeParameter('id', i);
                          const id = uri.replace('spotify:album:', '');
                          requestMethod = 'GET';
                          endpoint = `/albums/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'getNewReleases') {
                          endpoint = '/browse/new-releases';
                          requestMethod = 'GET';
                          propertyName = 'albums.items';
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.albums.items;
                          }
                      }
                      else if (operation === 'getTracks') {
                          const uri = this.getNodeParameter('id', i);
                          const id = uri.replace('spotify:album:', '');
                          requestMethod = 'GET';
                          endpoint = `/albums/${id}/tracks`;
                          propertyName = 'tracks';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'albums.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              type: 'album',
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.albums.items;
                          }
                      }
                  }
                  else if (resource === 'artist') {
                      const uri = this.getNodeParameter('id', i, '');
                      const id = uri.replace('spotify:artist:', '');
                      if (operation === 'getAlbums') {
                          endpoint = `/artists/${id}/albums`;
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'getRelatedArtists') {
                          endpoint = `/artists/${id}/related-artists`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = responseData.artists;
                      }
                      else if (operation === 'getTopTracks') {
                          const country = this.getNodeParameter('country', i);
                          qs = {
                              country,
                          };
                          endpoint = `/artists/${id}/top-tracks`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = responseData.tracks;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          endpoint = `/artists/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'artists.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              limit: 50,
                              type: 'artist',
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.artists.items;
                          }
                      }
                  }
                  else if (resource === 'playlist') {
                      if (['delete', 'get', 'getTracks', 'add'].includes(operation)) {
                          const uri = this.getNodeParameter('id', i);
                          const id = uri.replace('spotify:playlist:', '');
                          if (operation === 'delete') {
                              requestMethod = 'DELETE';
                              const trackId = this.getNodeParameter('trackID', i);
                              body.tracks = [
                                  {
                                      uri: trackId,
                                  },
                              ];
                              endpoint = `/playlists/${id}/tracks`;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = { success: true };
                          }
                          else if (operation === 'get') {
                              requestMethod = 'GET';
                              endpoint = `/playlists/${id}`;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          }
                          else if (operation === 'getTracks') {
                              requestMethod = 'GET';
                              endpoint = `/playlists/${id}/tracks`;
                              returnAll = this.getNodeParameter('returnAll', i);
                              propertyName = 'items';
                              if (!returnAll) {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs = {
                                      limit,
                                  };
                                  responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                                  responseData = responseData.items;
                              }
                          }
                          else if (operation === 'add') {
                              requestMethod = 'POST';
                              const trackId = this.getNodeParameter('trackID', i);
                              const additionalFields = this.getNodeParameter('additionalFields', i);
                              qs = {
                                  uris: trackId,
                              };
                              if (additionalFields.position !== undefined) {
                                  qs.position = additionalFields.position;
                              }
                              endpoint = `/playlists/${id}/tracks`;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          }
                      }
                      else if (operation === 'getUserPlaylists') {
                          requestMethod = 'GET';
                          endpoint = '/me/playlists';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'create') {
                          body.name = this.getNodeParameter('name', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, 'POST', '/me/playlists', body, qs);
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'playlists.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              type: 'playlist',
                              limit: 50,
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.playlists.items;
                          }
                      }
                  }
                  else if (resource === 'track') {
                      const uri = this.getNodeParameter('id', i, '');
                      const id = uri.replace('spotify:track:', '');
                      requestMethod = 'GET';
                      if (operation === 'getAudioFeatures') {
                          endpoint = `/audio-features/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'get') {
                          endpoint = `/tracks/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'tracks.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              type: 'track',
                              limit: 50,
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.tracks.items;
                          }
                      }
                  }
                  else if (resource === 'library') {
                      if (operation === 'getLikedTracks') {
                          requestMethod = 'GET';
                          endpoint = '/me/tracks';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                  }
                  else if (resource === 'myData') {
                      if (operation === 'getFollowingArtists') {
                          requestMethod = 'GET';
                          endpoint = '/me/following';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'artists.items';
                          qs = {
                              type: 'artist',
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  type: 'artist',
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.artists.items;
                          }
                      }
                  }
                  if (returnAll) {
                      responseData = await GenericFunctions_1.spotifyApiRequestAllItems.call(this, propertyName, requestMethod, endpoint, body, qs);
                  }
                  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.Spotify = Spotify;
  //# sourceMappingURL=Spotify.node.js.map

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


node_type: n8n-nodes-base.SpreadsheetFile
name: SpreadsheetFile
package_name: n8n-nodes-base
display_name: Spreadsheet File
description: Reads and writes data from a spreadsheet file like CSV, XLS, ODS, etc
code_hash: 6e655ee1172b11636b5c4634ce0a591a107d5056c258f5cdf9cda099aa7973ea
source_location: node_modules/n8n-nodes-base/dist/nodes/SpreadsheetFile/SpreadsheetFile.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SpreadsheetFile = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SpreadsheetFileV1_node_1 = require("./v1/SpreadsheetFileV1.node");
  const SpreadsheetFileV2_node_1 = require("./v2/SpreadsheetFileV2.node");
  class SpreadsheetFile extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Spreadsheet File',
              name: 'spreadsheetFile',
              icon: 'fa:table',
              group: ['transform'],
              description: 'Reads and writes data from a spreadsheet file like CSV, XLS, ODS, etc',
              defaultVersion: 2,
          };
          const nodeVersions = {
              1: new SpreadsheetFileV1_node_1.SpreadsheetFileV1(baseDescription),
              2: new SpreadsheetFileV2_node_1.SpreadsheetFileV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.SpreadsheetFile = SpreadsheetFile;
  //# sourceMappingURL=SpreadsheetFile.node.js.map

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


node_type: n8n-nodes-base.SseTrigger
name: SseTrigger
package_name: n8n-nodes-base
display_name: SSE Trigger
description: Triggers the workflow when Server-Sent Events occur
code_hash: 05f0871eb011af3c8b264d9249c442aca37fbbc12533aca5e843312cf67942fb
source_location: node_modules/n8n-nodes-base/dist/nodes/SseTrigger/SseTrigger.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
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.SseTrigger = void 0;
  const eventsource_1 = __importDefault(require("eventsource"));
  const n8n_workflow_1 = require("n8n-workflow");
  class SseTrigger {
      constructor() {
          this.description = {
              displayName: 'SSE Trigger',
              name: 'sseTrigger',
              icon: 'fa:cloud-download-alt',
              group: ['trigger'],
              version: 1,
              description: 'Triggers the workflow when Server-Sent Events occur',
              eventTriggerDescription: '',
              activationMessage: 'You can now make calls to your SSE URL to trigger executions.',
              defaults: {
                  name: 'SSE Trigger',
                  color: '#225577',
              },
              triggerPanel: {
                  header: '',
                  executionsHelp: {
                      inactive: "<b>While building your workflow</b>, click the 'listen' button, then trigger an SSE event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time a change is detected, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                      active: "<b>While building your workflow</b>, click the 'listen' button, then trigger an SSE event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time a change is detected, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                  },
                  activationHint: "Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).",
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'URL',
                      name: 'url',
                      type: 'string',
                      default: '',
                      placeholder: 'http://example.com',
                      description: 'The URL to receive the SSE from',
                      required: true,
                  },
              ],
          };
      }
      async trigger() {
          const url = this.getNodeParameter('url');
          const eventSource = new eventsource_1.default(url);
          eventSource.onmessage = (event) => {
              const eventData = (0, n8n_workflow_1.jsonParse)(event.data, {
                  errorMessage: 'Invalid JSON for event data',
              });
              this.emit([this.helpers.returnJsonArray([eventData])]);
          };
          async function closeFunction() {
              eventSource.close();
          }
          return {
              closeFunction,
          };
      }
  }
  exports.SseTrigger = SseTrigger;
  //# sourceMappingURL=SseTrigger.node.js.map

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


node_type: n8n-nodes-base.Ssh
name: Ssh
package_name: n8n-nodes-base
display_name: SSH
description: Execute commands via SSH
code_hash: 6cd745a1e989a5652e95fb4e93213461aba20bf8defb942f71286257ab9372eb
source_location: node_modules/n8n-nodes-base/dist/nodes/Ssh/Ssh.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Ssh = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const utilities_1 = require("../../utils/utilities");
  const promises_1 = require("fs/promises");
  const tmp_promise_1 = require("tmp-promise");
  const node_ssh_1 = require("node-ssh");
  async function resolveHomeDir(path, ssh, itemIndex) {
      if (path.startsWith('~/')) {
          let homeDir = (await ssh.execCommand('echo $HOME')).stdout;
          if (homeDir.charAt(homeDir.length - 1) !== '/') {
              homeDir += '/';
          }
          return path.replace('~/', homeDir);
      }
      if (path.startsWith('~')) {
          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid path. Replace "~" with home directory or "~/"', {
              itemIndex,
          });
      }
      return path;
  }
  class Ssh {
      constructor() {
          this.description = {
              displayName: 'SSH',
              name: 'ssh',
              icon: 'fa:terminal',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Execute commands via SSH',
              defaults: {
                  name: 'SSH',
                  color: '#000000',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sshPassword',
                      required: true,
                      testedBy: 'sshConnectionTest',
                      displayOptions: {
                          show: {
                              authentication: ['password'],
                          },
                      },
                  },
                  {
                      name: 'sshPrivateKey',
                      required: true,
                      testedBy: 'sshConnectionTest',
                      displayOptions: {
                          show: {
                              authentication: ['privateKey'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Password',
                              value: 'password',
                          },
                          {
                              name: 'Private Key',
                              value: 'privateKey',
                          },
                      ],
                      default: 'password',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Command',
                              value: 'command',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                      ],
                      default: 'command',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['command'],
                          },
                      },
                      options: [
                          {
                              name: 'Execute',
                              value: 'execute',
                              description: 'Execute a command',
                              action: 'Execute a command',
                          },
                      ],
                      default: 'execute',
                  },
                  {
                      displayName: 'Command',
                      name: 'command',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['command'],
                              operation: ['execute'],
                          },
                      },
                      default: '',
                      description: 'The command to be executed on a remote device',
                  },
                  {
                      displayName: 'Working Directory',
                      name: 'cwd',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['command'],
                              operation: ['execute'],
                          },
                      },
                      default: '/',
                      required: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'Download',
                              value: 'download',
                              description: 'Download a file',
                              action: 'Download a file',
                          },
                          {
                              name: 'Upload',
                              value: 'upload',
                              description: 'Upload a file',
                              action: 'Upload a file',
                          },
                      ],
                      default: 'upload',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property which contains the data for the file to be uploaded',
                  },
                  {
                      displayName: 'Target Directory',
                      name: 'path',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['upload'],
                          },
                      },
                      default: '',
                      required: true,
                      placeholder: '/home/user',
                      description: 'The directory to upload the file to. The name of the file does not need to be specified, it\'s taken from the binary data file name. To override this behavior, set the parameter "File Name" under options.',
                  },
                  {
                      displayName: 'Path',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['download'],
                          },
                      },
                      name: 'path',
                      type: 'string',
                      default: '',
                      placeholder: '/home/user/invoice.txt',
                      description: 'The file path of the file to download. Has to contain the full path including file name.',
                      required: true,
                  },
                  {
                      displayName: 'Binary Property',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['download'],
                          },
                      },
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      description: 'Object property name which holds binary data',
                      required: true,
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['upload', 'download'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'File Name',
                              name: 'fileName',
                              type: 'string',
                              default: '',
                              description: 'Overrides the binary data file name',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async sshConnectionTest(credential) {
                      const credentials = credential.data;
                      const ssh = new node_ssh_1.NodeSSH();
                      const temporaryFiles = [];
                      try {
                          if (!credentials.privateKey) {
                              await ssh.connect({
                                  host: credentials.host,
                                  username: credentials.username,
                                  port: credentials.port,
                                  password: credentials.password,
                              });
                          }
                          else {
                              const options = {
                                  host: credentials.host,
                                  username: credentials.username,
                                  port: credentials.port,
                                  privateKey: (0, utilities_1.formatPrivateKey)(credentials.privateKey),
                              };
                              if (credentials.passphrase) {
                                  options.passphrase = credentials.passphrase;
                              }
                              await ssh.connect(options);
                          }
                      }
                      catch (error) {
                          const message = `SSH connection failed: ${error.message}`;
                          return {
                              status: 'Error',
                              message,
                          };
                      }
                      finally {
                          ssh.dispose();
                          for (const tempFile of temporaryFiles)
                              await (0, promises_1.rm)(tempFile);
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnItems = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const authentication = this.getNodeParameter('authentication', 0);
          const temporaryFiles = [];
          const ssh = new node_ssh_1.NodeSSH();
          try {
              if (authentication === 'password') {
                  const credentials = await this.getCredentials('sshPassword');
                  await ssh.connect({
                      host: credentials.host,
                      username: credentials.username,
                      port: credentials.port,
                      password: credentials.password,
                  });
              }
              else if (authentication === 'privateKey') {
                  const credentials = await this.getCredentials('sshPrivateKey');
                  const options = {
                      host: credentials.host,
                      username: credentials.username,
                      port: credentials.port,
                      privateKey: (0, utilities_1.formatPrivateKey)(credentials.privateKey),
                  };
                  if (credentials.passphrase) {
                      options.passphrase = credentials.passphrase;
                  }
                  await ssh.connect(options);
              }
              for (let i = 0; i < items.length; i++) {
                  try {
                      if (resource === 'command') {
                          if (operation === 'execute') {
                              const command = this.getNodeParameter('command', i);
                              const cwd = await resolveHomeDir.call(this, this.getNodeParameter('cwd', i), ssh, i);
                              returnItems.push({
                                  json: (await ssh.execCommand(command, { cwd })),
                                  pairedItem: {
                                      item: i,
                                  },
                              });
                          }
                      }
                      if (resource === 'file') {
                          if (operation === 'download') {
                              const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                              const parameterPath = await resolveHomeDir.call(this, this.getNodeParameter('path', i), ssh, i);
                              const { path } = await (0, tmp_promise_1.file)({ prefix: 'n8n-ssh-' });
                              temporaryFiles.push(path);
                              await ssh.getFile(path, parameterPath);
                              const newItem = {
                                  json: items[i].json,
                                  binary: {},
                                  pairedItem: {
                                      item: i,
                                  },
                              };
                              if (items[i].binary !== undefined && newItem.binary) {
                                  Object.assign(newItem.binary, items[i].binary);
                              }
                              items[i] = newItem;
                              const fileName = this.getNodeParameter('options.fileName', i, '');
                              items[i].binary[dataPropertyNameDownload] = await this.nodeHelpers.copyBinaryFile(path, fileName || parameterPath);
                          }
                          if (operation === 'upload') {
                              const parameterPath = await resolveHomeDir.call(this, this.getNodeParameter('path', i), ssh, i);
                              const fileName = this.getNodeParameter('options.fileName', i, '');
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              let uploadData;
                              if (binaryData.id) {
                                  uploadData = await this.helpers.getBinaryStream(binaryData.id);
                              }
                              else {
                                  uploadData = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                              }
                              const { path } = await (0, tmp_promise_1.file)({ prefix: 'n8n-ssh-' });
                              temporaryFiles.push(path);
                              await (0, promises_1.writeFile)(path, uploadData);
                              await ssh.putFile(path, `${parameterPath}${parameterPath.charAt(parameterPath.length - 1) === '/' ? '' : '/'}${fileName || binaryData.fileName}`);
                              returnItems.push({
                                  json: {
                                      success: true,
                                  },
                                  pairedItem: {
                                      item: i,
                                  },
                              });
                          }
                      }
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          if (resource === 'file' && operation === 'download') {
                              items[i] = {
                                  json: {
                                      error: error.message,
                                  },
                              };
                          }
                          else {
                              returnItems.push({
                                  json: {
                                      error: error.message,
                                  },
                                  pairedItem: {
                                      item: i,
                                  },
                              });
                          }
                          continue;
                      }
                      throw error;
                  }
              }
          }
          catch (error) {
              ssh.dispose();
              for (const tempFile of temporaryFiles)
                  await (0, promises_1.rm)(tempFile);
              throw error;
          }
          for (const tempFile of temporaryFiles)
              await (0, promises_1.rm)(tempFile);
          ssh.dispose();
          if (resource === 'file' && operation === 'download') {
              return [items];
          }
          else {
              return [returnItems];
          }
      }
  }
  exports.Ssh = Ssh;
  //# sourceMappingURL=Ssh.node.js.map

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


node_type: n8n-nodes-base.Stackby
name: Stackby
package_name: n8n-nodes-base
display_name: Stackby
description: Read, write, and delete data in Stackby
code_hash: 01e67da38c6f9be77eccfb21b9551d9c8fc64893991b678ddd9b4f56e2a8f463
source_location: node_modules/n8n-nodes-base/dist/nodes/Stackby/Stackby.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Stackby = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunction_1 = require("./GenericFunction");
  const utilities_1 = require("../../utils/utilities");
  class Stackby {
      constructor() {
          this.description = {
              displayName: 'Stackby',
              name: 'stackby',
              icon: 'file:stackby.png',
              group: ['transform'],
              version: 1,
              description: 'Read, write, and delete data in Stackby',
              defaults: {
                  name: 'Stackby',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'stackbyApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Append',
                              value: 'append',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                          },
                          {
                              name: 'List',
                              value: 'list',
                          },
                          {
                              name: 'Read',
                              value: 'read',
                          },
                      ],
                      default: 'append',
                      placeholder: 'Action to perform',
                  },
                  {
                      displayName: 'Stack ID',
                      name: 'stackId',
                      type: 'string',
                      default: '',
                      required: true,
                      description: 'The ID of the stack to access',
                  },
                  {
                      displayName: 'Table',
                      name: 'table',
                      type: 'string',
                      default: '',
                      placeholder: 'Stories',
                      required: true,
                      description: 'Enter Table Name',
                  },
                  {
                      displayName: 'ID',
                      name: 'id',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['read', 'delete'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'ID of the record to return',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                          },
                      },
                      default: true,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 1000,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                          },
                      },
                      default: {},
                      placeholder: 'Add Field',
                      options: [
                          {
                              displayName: 'View',
                              name: 'view',
                              type: 'string',
                              default: '',
                              placeholder: 'All Stories',
                              description: 'The name or ID of a view in the Stories table. If set, only the records in that view will be returned. The records will be sorted according to the order of the view.',
                          },
                      ],
                  },
                  {
                      displayName: 'Columns',
                      name: 'columns',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['append'],
                          },
                      },
                      default: '',
                      required: true,
                      placeholder: 'id,name,description',
                      description: 'Comma-separated list of the properties which should used as columns for the new rows',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'read') {
              for (let i = 0; i < length; i++) {
                  try {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const rowIds = this.getNodeParameter('id', i);
                      qs.rowIds = [rowIds];
                      responseData = await GenericFunction_1.apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
                      returnData.push.apply(returnData, responseData.map((data) => data.field));
                  }
                  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;
                  }
              }
          }
          if (operation === 'delete') {
              for (let i = 0; i < length; i++) {
                  try {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const rowIds = this.getNodeParameter('id', i);
                      qs.rowIds = [rowIds];
                      responseData = await GenericFunction_1.apiRequest.call(this, 'DELETE', `/rowdelete/${stackId}/${table}`, {}, qs);
                      responseData = responseData.records;
                      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;
                  }
              }
          }
          if (operation === 'append') {
              try {
                  const records = {};
                  let key = '';
                  for (let i = 0; i < length; i++) {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      const record = {};
                      for (const column of columnList) {
                          if (items[i].json[column] === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Column ${column} does not exist on input`, { itemIndex: i });
                          }
                          else {
                              record[column] = items[i].json[column];
                          }
                      }
                      key = `${stackId}/${table}`;
                      if (records[key] === undefined) {
                          records[key] = [];
                      }
                      records[key].push({ field: record });
                  }
                  for (const recordKey of Object.keys(records)) {
                      responseData = await GenericFunction_1.apiRequest.call(this, 'POST', `/rowcreate/${recordKey}`, {
                          records: records[recordKey],
                      });
                  }
                  returnData.push.apply(returnData, responseData.map((data) => data.field));
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const itemData = (0, utilities_1.generatePairedItemData)(items.length);
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData });
                      returnData.push(...executionErrorData);
                  }
                  else {
                      throw error;
                  }
              }
          }
          if (operation === 'list') {
              for (let i = 0; i < length; i++) {
                  try {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      const additionalFields = this.getNodeParameter('additionalFields', i, {});
                      if (additionalFields.view) {
                          qs.view = additionalFields.view;
                      }
                      if (returnAll) {
                          responseData = await GenericFunction_1.apiRequestAllItems.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
                      }
                      else {
                          qs.maxrecord = this.getNodeParameter('limit', 0);
                          responseData = await GenericFunction_1.apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
                      }
                      returnData.push.apply(returnData, responseData.map((data) => data.field));
                  }
                  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.Stackby = Stackby;
  //# sourceMappingURL=Stackby.node.js.map

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


node_type: n8n-nodes-base.Start
name: Start
package_name: n8n-nodes-base
display_name: Start
description: Starts the workflow execution from this node
code_hash: 327ac4d08639ec3324f54dd7f64f0b4df659eb5c371c63fa6ce8c346517717e8
source_location: node_modules/n8n-nodes-base/dist/nodes/Start/Start.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Start = void 0;
  class Start {
      constructor() {
          this.description = {
              displayName: 'Start',
              name: 'start',
              icon: 'fa:play',
              group: ['input'],
              version: 1,
              description: 'Starts the workflow execution from this node',
              maxNodes: 1,
              hidden: true,
              defaults: {
                  name: 'Start',
                  color: '#00e000',
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'This node is where a manual workflow execution starts. To make one, go back to the canvas and click ‘execute workflow’',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          return [items];
      }
  }
  exports.Start = Start;
  //# sourceMappingURL=Start.node.js.map

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


node_type: n8n-nodes-base.StickyNote
name: StickyNote
package_name: n8n-nodes-base
display_name: Sticky Note
description: Make your workflow easier to understand
code_hash: 71536993abcfd47e981e96d368c60bcc43b74fc57c1cb59cf8688071356f8bf0
source_location: node_modules/n8n-nodes-base/dist/nodes/StickyNote/StickyNote.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.StickyNote = void 0;
  class StickyNote {
      constructor() {
          this.description = {
              displayName: 'Sticky Note',
              name: 'stickyNote',
              icon: 'fa:sticky-note',
              group: ['input'],
              version: 1,
              description: 'Make your workflow easier to understand',
              defaults: {
                  name: 'Sticky Note',
                  color: '#FFD233',
              },
              inputs: [],
              outputs: [],
              properties: [
                  {
                      displayName: 'Content',
                      name: 'content',
                      type: 'string',
                      required: true,
                      default: "## I'm a note \n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)",
                  },
                  {
                      displayName: 'Height',
                      name: 'height',
                      type: 'number',
                      required: true,
                      default: 160,
                  },
                  {
                      displayName: 'Width',
                      name: 'width',
                      type: 'number',
                      required: true,
                      default: 240,
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          return [items];
      }
  }
  exports.StickyNote = StickyNote;
  //# sourceMappingURL=StickyNote.node.js.map

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


node_type: n8n-nodes-base.StopAndError
name: StopAndError
package_name: n8n-nodes-base
display_name: Stop and Error
description: Throw an error in the workflow
code_hash: 79f3b665f4ccdb01a1faacf08233e29fbd6878e69d5d611b5dd2bf0bf9b25308
source_location: node_modules/n8n-nodes-base/dist/nodes/StopAndError/StopAndError.node.js
extracted_at: 2025-06-07 19:36:44
updated_at: 2025-06-07 19:36:44
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.StopAndError = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const errorObjectPlaceholder = `{
  	"code": "404",
  	"description": "The resource could not be fetched"
  }`;
  class StopAndError {
      constructor() {
          this.description = {
              displayName: 'Stop and Error',
              name: 'stopAndError',
              icon: 'fa:exclamation-triangle',
              group: ['input'],
              version: 1,
              description: 'Throw an error in the workflow',
              defaults: {
                  name: 'Stop and Error',
                  color: '#ff0000',
              },
              inputs: ['main'],
              outputs: [],
              properties: [
                  {
                      displayName: 'Error Type',
                      name: 'errorType',
                      type: 'options',
                      options: [
                          {
                              name: 'Error Message',
                              value: 'errorMessage',
                          },
                          {
                              name: 'Error Object',
                              value: 'errorObject',
                          },
                      ],
                      default: 'errorMessage',
                      description: 'Type of error to throw',
                  },
                  {
                      displayName: 'Error Message',
                      name: 'errorMessage',
                      type: 'string',
                      placeholder: 'An error occurred!',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              errorType: ['errorMessage'],
                          },
                      },
                  },
                  {
                      displayName: 'Error Object',
                      name: 'errorObject',
                      type: 'json',
                      description: 'Object containing error properties',
                      default: '',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      placeholder: errorObjectPlaceholder,
                      required: true,
                      displayOptions: {
                          show: {
                              errorType: ['errorObject'],
                          },
                      },
                  },
              ],
          };
      }
      async execute() {
          const errorType = this.getNodeParameter('errorType', 0);
          const { id: workflowId, name: workflowName } = this.getWorkflow();
          let toThrow;
          if (errorType === 'errorMessage') {
              toThrow = this.getNodeParameter('errorMessage', 0);
          }
          else {
              const json = this.getNodeParameter('errorObject', 0);
              const errorObject = (0, n8n_workflow_1.jsonParse)(json);
              toThrow = {
                  name: 'User-thrown error',
                  message: `Workflow ID ${workflowId} "${workflowName}" has failed`,
                  ...errorObject,
              };
          }
          throw new n8n_workflow_1.NodeOperationError(this.getNode(), toThrow);
      }
  }
  exports.StopAndError = StopAndError;
  //# sourceMappingURL=StopAndError.node.js.map

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


