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.

117 lines 4.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.exportedProperties = void 0; exports.execute = execute; const OctaveApiRequest_1 = require("../../transport/OctaveApiRequest"); const utils_1 = require("../utils"); const properties = [ { displayName: 'Status Quo Input', name: 'statusQuoInput', type: 'string', default: '', description: 'Input describing the current status quo (optional)', }, { displayName: 'Differentiated Value Input', name: 'differentiatedValueInput', type: 'string', default: '', description: 'Input describing the differentiated value (optional)', }, { displayName: 'Product Generation Requests', name: 'products', type: 'collection', placeholder: 'Add Product', typeOptions: { multipleValues: true, }, default: [{}], description: 'Array of product generation requests. Each generates one product.', options: [ { displayName: 'Name', name: 'name', type: 'string', default: '', description: 'Optional name for the product - if provided, will be used as the entity name', placeholder: 'AI-Powered Sales Platform' }, { displayName: 'Sources', name: 'sources', type: 'fixedCollection', placeholder: 'Add Source', typeOptions: { multipleValues: true, }, default: {}, description: 'Source materials to generate the product from (at least one required)', options: [ { displayName: 'Source', name: 'source', values: [ { displayName: 'Type', name: 'type', type: 'options', options: [ { name: 'Text', value: 'TEXT', description: 'Text-based source material' }, { name: 'URL', value: 'URL', description: 'URL-based source material' } ], default: 'TEXT', description: 'The type of source material' }, { displayName: 'Value', name: 'value', type: 'string', default: '', description: 'The source content (text or URL)', placeholder: 'Lead generation and qualification for enterprise sales', typeOptions: { rows: 3 } } ] } ] } ] } ]; const displayOptions = { show: { resource: ['product'], operation: ['generate'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const body = {}; body.statusQuoInput = this.getNodeParameter('statusQuoInput', itemIndex); body.differentiatedValueInput = this.getNodeParameter('differentiatedValueInput', itemIndex); const productsRaw = this.getNodeParameter('products', itemIndex); body.products = productsRaw.map(product => { var _a; return ({ name: product.name, sources: ((_a = product.sources) === null || _a === void 0 ? void 0 : _a.source) || [] }); }); Object.keys(body).forEach(key => (body[key] === undefined) && delete body[key]); const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/product/generate', body); const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } }); return [executionData]; } //# sourceMappingURL=generate.operation.js.map