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.

171 lines 5.65 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: 'Agent OId', name: 'oId', type: 'string', required: true, default: '', description: 'The OId of the agent to update', }, { displayName: 'Name', name: 'name', type: 'string', default: '', }, { displayName: 'Description', name: 'description', type: 'string', default: '', typeOptions: { rows: 3 }, }, { displayName: 'Model', name: 'model', type: 'options', options: [ { name: '(Unchanged)', value: '' }, { name: 'Chorus', value: 'CHORUS' }, { name: 'Echo', value: 'ECHO' }, { name: 'Harmony', value: 'HARMONY' }, { name: 'Note', value: 'NOTE' }, { name: 'Pulse', value: 'PULSE' }, { name: 'Symphony', value: 'SYMPHONY' }, ], default: '', }, { displayName: 'Product Name or ID', name: 'productOId', type: 'options', typeOptions: { loadOptionsMethod: 'getProducts' }, default: '', description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>', }, { displayName: 'Playbook Name or ID', name: 'playbookOId', type: 'options', typeOptions: { loadOptionsMethod: 'getPlaybooks' }, default: '', description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>', }, { displayName: 'Persona OIds', name: 'personaOIds', type: 'string', default: '', description: 'Comma-separated persona OIds', }, { displayName: 'Use Case OIds', name: 'useCaseOIds', type: 'string', default: '', description: 'Comma-separated use case OIds', }, { displayName: 'Segment OIds', name: 'segmentOIds', type: 'string', default: '', description: 'Comma-separated segment OIds', }, { displayName: 'Competitor OIds', name: 'competitorOIds', type: 'string', default: '', description: 'Comma-separated competitor OIds', }, { displayName: 'Reference OIds', name: 'referenceOIds', type: 'string', default: '', description: 'Comma-separated reference OIds', }, { displayName: 'Proof Point OIds', name: 'proofPointOIds', type: 'string', default: '', description: 'Comma-separated proof point OIds', }, { displayName: 'Sequence Settings (JSON)', name: 'sequenceSettings', type: 'json', default: '{}', description: 'EMAIL agents only — sequence-level settings', typeOptions: { rows: 5 }, }, { displayName: 'Step Patches (JSON)', name: 'stepPatches', type: 'json', default: '{}', description: 'EMAIL agents only — partial email builder config per step index', typeOptions: { rows: 5 }, }, { displayName: 'Data Passthrough (JSON)', name: 'data', type: 'json', default: '{}', description: 'Full agent configuration data passthrough (merged with other fields)', typeOptions: { rows: 5 }, }, ]; const displayOptions = { show: { resource: ['agent'], operation: ['update'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); function csv(s) { if (!s) return undefined; const arr = s.split(',').map(v => v.trim()).filter(Boolean); return arr.length > 0 ? arr : undefined; } async function execute(itemIndex) { const oId = this.getNodeParameter('oId', itemIndex); if (!oId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'OId is required.', { itemIndex }); } const body = { oId }; const optionalScalars = ['name', 'description', 'model', 'productOId', 'playbookOId']; for (const f of optionalScalars) { const v = this.getNodeParameter(f, itemIndex, ''); if (v) body[f] = v; } const arrFields = ['personaOIds', 'useCaseOIds', 'segmentOIds', 'competitorOIds', 'referenceOIds', 'proofPointOIds']; for (const f of arrFields) { const v = csv(this.getNodeParameter(f, itemIndex, '')); if (v) body[f] = v; } const ss = utils_1.parseJsonParameter.call(this, 'sequenceSettings', itemIndex, '{}'); if (ss && Object.keys(ss).length > 0) body.sequenceSettings = ss; const sp = utils_1.parseJsonParameter.call(this, 'stepPatches', itemIndex, '{}'); if (sp && Object.keys(sp).length > 0) body.stepPatches = sp; const data = utils_1.parseJsonParameter.call(this, 'data', itemIndex, '{}'); if (data && Object.keys(data).length > 0) body.data = data; const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/agents/update', body); return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })]; } //# sourceMappingURL=update.operation.js.map