UNPKG

n8n-nodes-rd-station-crm

Version:

n8n community node for RD Station CRM: API v1 (private token) and API v2 (OAuth2) — contacts, deals, organizations, tasks, notes, pipelines, stages, products, custom fields, sources, campaigns, loss reasons, users, teams and a real webhook trigger.

137 lines 7.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resourcePropertiesV2 = exports.resourceOptionsV2 = exports.resourceProperties = exports.resourceOptions = void 0; exports.executeResource = executeResource; const n8n_workflow_1 = require("n8n-workflow"); const Campaign_1 = require("./campaign/Campaign"); const Contact_1 = require("./contact/Contact"); const CustomField_1 = require("./customField/CustomField"); const Deal_1 = require("./deal/Deal"); const DealProduct_1 = require("./dealProduct/DealProduct"); const LossReason_1 = require("./lossReason/LossReason"); const Note_1 = require("./note/Note"); const Organization_1 = require("./organization/Organization"); const Pipeline_1 = require("./pipeline/Pipeline"); const Product_1 = require("./product/Product"); const Source_1 = require("./source/Source"); const Stage_1 = require("./stage/Stage"); const Task_1 = require("./task/Task"); const Team_1 = require("./team/Team"); const User_1 = require("./user/User"); const Webhook_1 = require("./webhook/Webhook"); // v2 (OAuth2) resources — separate values (…V2) so they never collide with v1. const ContactV2_1 = require("./v2/ContactV2"); const CustomFieldV2_1 = require("./v2/CustomFieldV2"); const DealV2_1 = require("./v2/DealV2"); const NoteV2_1 = require("./v2/NoteV2"); const OrganizationV2_1 = require("./v2/OrganizationV2"); const TaskV2_1 = require("./v2/TaskV2"); // The Resource dropdown (alphabetically sorted by name). exports.resourceOptions = [ { name: 'Campaign', value: 'campaign', description: 'A marketing campaign that deals can be linked to' }, { name: 'Contact', value: 'contact', description: 'A person or lead, with name, emails and phones' }, { name: 'Custom Field', value: 'customField', description: 'A custom field definition for contacts, deals or organizations' }, { name: 'Deal', value: 'deal', description: 'A sales opportunity or negotiation moving through a pipeline' }, { name: 'Deal Product', value: 'dealProduct', description: 'A product line item (price, quantity, discount) attached to a deal' }, { name: 'Loss Reason', value: 'lossReason', description: 'A reason a deal was marked as lost' }, { name: 'Note', value: 'note', description: 'A text note attached to a deal or contact' }, { name: 'Organization', value: 'organization', description: 'A company or account that contacts and deals belong to' }, { name: 'Pipeline', value: 'pipeline', description: 'A sales funnel made up of ordered stages' }, { name: 'Product', value: 'product', description: 'A catalog product with a name and base price' }, { name: 'Source', value: 'source', description: 'The origin (source) a deal came from' }, { name: 'Stage', value: 'stage', description: 'A stage inside a pipeline funnel' }, { name: 'Task', value: 'task', description: 'An activity or to-do linked to a deal or contact' }, { name: 'Team', value: 'team', description: 'A group of CRM users' }, { name: 'User', value: 'user', description: 'A CRM user or account member' }, { name: 'Webhook', value: 'webhook', description: 'Manage RD Station CRM webhook subscriptions' }, ]; // Concatenated per-resource property definitions (operations + fields). exports.resourceProperties = [ ...Campaign_1.campaignDescription, ...Contact_1.contactDescription, ...CustomField_1.customFieldDescription, ...Deal_1.dealDescription, ...DealProduct_1.dealProductDescription, ...LossReason_1.lossReasonDescription, ...Note_1.noteDescription, ...Organization_1.organizationDescription, ...Pipeline_1.pipelineDescription, ...Product_1.productDescription, ...Source_1.sourceDescription, ...Stage_1.stageDescription, ...Task_1.taskDescription, ...Team_1.teamDescription, ...User_1.userDescription, ...Webhook_1.webhookDescription, ]; // The v2 (OAuth2) Resource dropdown — shown when Authentication = OAuth2. exports.resourceOptionsV2 = [ { name: 'Contact', value: 'contactV2', description: 'A person or lead in RD Station CRM API v2' }, { name: 'Custom Field', value: 'customFieldV2', description: 'A custom field definition in RD Station CRM API v2' }, { name: 'Deal', value: 'dealV2', description: 'A sales opportunity in RD Station CRM API v2' }, { name: 'Note', value: 'noteV2', description: 'A text note attached to a deal or contact in RD Station CRM API v2' }, { name: 'Organization', value: 'organizationV2', description: 'A company or account in RD Station CRM API v2' }, { name: 'Task', value: 'taskV2', description: 'An activity or to-do in RD Station CRM API v2' }, ]; // Concatenated v2 per-resource property definitions. exports.resourcePropertiesV2 = [ ...ContactV2_1.contactV2Description, ...CustomFieldV2_1.customFieldV2Description, ...DealV2_1.dealV2Description, ...NoteV2_1.noteV2Description, ...OrganizationV2_1.organizationV2Description, ...TaskV2_1.taskV2Description, ]; // Dispatch to the right resource implementation. async function executeResource(resource, operation, i) { switch (resource) { case 'campaign': return Campaign_1.executeCampaign.call(this, operation, i); case 'contact': return Contact_1.executeContact.call(this, operation, i); case 'customField': return CustomField_1.executeCustomField.call(this, operation, i); case 'deal': return Deal_1.executeDeal.call(this, operation, i); case 'dealProduct': return DealProduct_1.executeDealProduct.call(this, operation, i); case 'lossReason': return LossReason_1.executeLossReason.call(this, operation, i); case 'note': return Note_1.executeNote.call(this, operation, i); case 'organization': return Organization_1.executeOrganization.call(this, operation, i); case 'pipeline': return Pipeline_1.executePipeline.call(this, operation, i); case 'product': return Product_1.executeProduct.call(this, operation, i); case 'source': return Source_1.executeSource.call(this, operation, i); case 'stage': return Stage_1.executeStage.call(this, operation, i); case 'task': return Task_1.executeTask.call(this, operation, i); case 'team': return Team_1.executeTeam.call(this, operation, i); case 'user': return User_1.executeUser.call(this, operation, i); case 'webhook': return Webhook_1.executeWebhook.call(this, operation, i); // v2 (OAuth2) resources case 'contactV2': return ContactV2_1.executeContactV2.call(this, operation, i); case 'customFieldV2': return CustomFieldV2_1.executeCustomFieldV2.call(this, operation, i); case 'dealV2': return DealV2_1.executeDealV2.call(this, operation, i); case 'noteV2': return NoteV2_1.executeNoteV2.call(this, operation, i); case 'organizationV2': return OrganizationV2_1.executeOrganizationV2.call(this, operation, i); case 'taskV2': return TaskV2_1.executeTaskV2.call(this, operation, i); default: throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not supported`); } } //# sourceMappingURL=index.js.map