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.

158 lines 5.87 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: 'Playbook OId', name: 'oId', type: 'string', required: true, default: '', description: 'OId of the playbook to update', }, { displayName: 'Name', name: 'name', type: 'string', default: '', description: 'Name of the playbook (optional)', }, { displayName: 'Description', name: 'description', type: 'string', default: '', description: 'Description of the playbook (optional)', }, { displayName: 'Key Insight (JSON Array)', name: 'keyInsight', type: 'json', default: '[]', description: 'JSON array of key insights (optional)', typeOptions: { rows: 3 }, }, { displayName: 'Approach Angle (JSON Array)', name: 'approachAngle', type: 'json', default: '[]', description: 'JSON array of approach angles (optional)', typeOptions: { rows: 3 }, }, { displayName: 'Differentiated Value (JSON Array)', name: 'differentiatedValue', type: 'json', default: '[]', description: 'JSON array of differentiated value propositions (optional)', typeOptions: { rows: 3 }, }, { displayName: 'Strategic Narrative (JSON Array)', name: 'strategicNarrative', type: 'json', default: '[]', description: 'JSON array of strategic narrative points (optional)', typeOptions: { rows: 3 }, }, { displayName: 'Status Quo (JSON Array)', name: 'statusQuo', type: 'json', default: '[]', description: 'JSON array of status quo descriptions (optional)', typeOptions: { rows: 3 }, }, { displayName: 'ICP Concerns (JSON Array)', name: 'icpConcerns', type: 'json', default: '[]', description: 'JSON array of ICP concerns (optional)', typeOptions: { rows: 3 }, }, { displayName: 'ICP Priorities (JSON Array)', name: 'icpPriorities', type: 'json', default: '[]', description: 'JSON array of ICP priorities (optional)', typeOptions: { rows: 3 }, }, { displayName: 'Explanation', name: 'explanation', type: 'string', default: '', description: 'Explanation of the playbook (optional)', }, { displayName: 'Example Description', name: 'exampleDescription', type: 'string', default: '', description: 'Example description (optional)', }, { displayName: 'Example Domains (JSON Array)', name: 'exampleDomains', type: 'json', default: '[]', description: 'JSON array of example domains (optional)', typeOptions: { rows: 3 }, }, { displayName: 'Attributes (JSON)', name: 'attributes', type: 'json', default: '{}', description: 'Attributes object (optional)', typeOptions: { rows: 3 } }, { displayName: 'Custom Fields (JSON Array)', name: 'customFields', type: 'json', default: '[]', description: 'JSON array of custom fields: [{"title": "field", "value": ["item1", "item2"]}] (optional)', typeOptions: { rows: 5 } }, ]; const displayOptions = { show: { resource: ['playbook'], operation: ['update'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const body = {}; body.oId = this.getNodeParameter('oId', itemIndex); if (!body.oId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Playbook OId is required to update a playbook.', { itemIndex }); } body.name = this.getNodeParameter('name', itemIndex); body.description = this.getNodeParameter('description', itemIndex); body.keyInsight = utils_1.parseJsonParameter.call(this, 'keyInsight', itemIndex, '[]'); body.approachAngle = utils_1.parseJsonParameter.call(this, 'approachAngle', itemIndex, '[]'); body.differentiatedValue = utils_1.parseJsonParameter.call(this, 'differentiatedValue', itemIndex, '[]'); body.strategicNarrative = utils_1.parseJsonParameter.call(this, 'strategicNarrative', itemIndex, '[]'); body.statusQuo = utils_1.parseJsonParameter.call(this, 'statusQuo', itemIndex, '[]'); body.icpConcerns = utils_1.parseJsonParameter.call(this, 'icpConcerns', itemIndex, '[]'); body.icpPriorities = utils_1.parseJsonParameter.call(this, 'icpPriorities', itemIndex, '[]'); body.explanation = this.getNodeParameter('explanation', itemIndex); body.exampleDescription = this.getNodeParameter('exampleDescription', itemIndex); body.exampleDomains = utils_1.parseJsonParameter.call(this, 'exampleDomains', itemIndex, '[]'); body.attributes = utils_1.parseJsonParameter.call(this, 'attributes', itemIndex, '{}'); body.customFields = utils_1.parseJsonParameter.call(this, 'customFields', itemIndex, '[]'); Object.keys(body).forEach(key => (body[key] === undefined) && delete body[key]); const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'PUT', '/api/v2/playbook/update', body); const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } }); return [executionData]; } //# sourceMappingURL=update.operation.js.map