UNPKG

n8n-nodes-octavehq

Version:

Octave is the AI-powered messaging brain for B2B go-to-market teams, helping articulate product value, synthesize customer interaction data, and deploy consistent, effective messaging across all channels.

128 lines 4.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.exportedProperties = void 0; exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const OctaveApiRequest_1 = require("../../transport/OctaveApiRequest"); const utils_1 = require("../utils"); const properties = [ { displayName: 'Name', name: 'name', type: 'string', required: true, default: '', description: 'Solution name', }, { displayName: 'Solution Data (JSON)', name: 'solutionData', type: 'json', default: '{}', description: 'Optional additional fields: internalName, summary, description, capabilities, keyOutcomes, customerBenefits, challengesAddressed, statusQuo, differentiatedValue, customFields', typeOptions: { rows: 6 }, }, { displayName: 'Sources', name: 'sources', type: 'fixedCollection', placeholder: 'Add Source', typeOptions: { multipleValues: true }, default: {}, description: 'Source materials (at least one required)', options: [ { displayName: 'Source', name: 'source', values: [ { displayName: 'Type', name: 'type', type: 'options', options: [ { name: 'Company Name', value: 'COMPANY_NAME' }, { name: 'Generative Name', value: 'GENERATIVE_NAME' }, { name: 'OId', value: 'OID' }, { name: 'Resource', value: 'RESOURCE' }, { name: 'Text', value: 'TEXT' }, { name: 'URL', value: 'URL' }, ], default: 'TEXT', }, { displayName: 'Value', name: 'value', type: 'string', default: '', typeOptions: { rows: 3 }, }, { displayName: 'Name', name: 'name', type: 'string', default: '', }, { displayName: 'Details', name: 'details', type: 'string', default: '', }, ], }, ], }, { displayName: 'Active', name: 'active', type: 'boolean', default: true, }, { displayName: 'Enable RAG Enrichment', name: 'enableRagEnrichment', type: 'boolean', default: false, }, { displayName: 'Linked Entity OIds (JSON)', name: 'linkedEntities', type: 'json', default: '{}', description: 'Optional object with OId arrays: offeringOIds, useCaseOIds, personaOIds, segmentOIds, referenceOIds, collateralOIds, competitorOIds, alternativeOIds, buyingTriggerOIds, proofPointOIds, genericTextEntityOIds', typeOptions: { rows: 6 }, }, ]; const displayOptions = { show: { resource: ['solution'], operation: ['create'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const name = this.getNodeParameter('name', itemIndex); if (!name) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Name is required.', { itemIndex }); } const solutionData = utils_1.parseJsonParameter.call(this, 'solutionData', itemIndex, '{}'); const sourcesRaw = this.getNodeParameter('sources', itemIndex); const sources = (sourcesRaw === null || sourcesRaw === void 0 ? void 0 : sourcesRaw.source) || []; if (sources.length === 0) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one source is required.', { itemIndex }); } const body = { solution: { name, ...solutionData }, sources, active: this.getNodeParameter('active', itemIndex), enableRagEnrichment: this.getNodeParameter('enableRagEnrichment', itemIndex), }; const linked = utils_1.parseJsonParameter.call(this, 'linkedEntities', itemIndex, '{}'); for (const k of Object.keys(linked || {})) { if (Array.isArray(linked[k]) && linked[k].length > 0) body[k] = linked[k]; } const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/solution/create', body); return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })]; } //# sourceMappingURL=create.operation.js.map