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.
120 lines • 4.5 kB
JavaScript
;
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: 'Reference OId',
name: 'oId',
type: 'string',
required: true,
default: '',
description: 'OId of the reference to update',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the reference (optional)',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the reference (optional)',
},
{
displayName: 'Internal Name',
name: 'internalName',
type: 'string',
default: '',
description: 'Internal name of the reference (optional)',
},
{
displayName: 'How We Impacted Their Business (JSON Array)',
name: 'howWeImpactedTheirBusiness',
type: 'json',
default: '[]',
description: 'JSON array of how we impacted their business (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'How They Benefit From Product',
name: 'howTheyBenefitFromProduct',
type: 'string',
default: '',
description: 'How they benefit from the product (optional)',
},
{
displayName: 'How They Make Money',
name: 'howTheyMakeMoney',
type: 'string',
default: '',
description: 'How they make money (optional)',
},
{
displayName: 'How They Use Product',
name: 'howTheyUseProduct',
type: 'string',
default: '',
description: 'How they use the product (optional)',
},
{
displayName: 'Key Stats (JSON Array)',
name: 'keyStats',
type: 'json',
default: '[]',
description: 'JSON array of key statistics (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Email Snippets (JSON Array)',
name: 'emailSnippets',
type: 'json',
default: '[]',
description: 'JSON array of email snippets (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: ['reference'],
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(), 'Reference OId is required to update a reference.', { itemIndex });
}
body.name = this.getNodeParameter('name', itemIndex);
body.description = this.getNodeParameter('description', itemIndex);
body.internalName = this.getNodeParameter('internalName', itemIndex);
body.howWeImpactedTheirBusiness = utils_1.parseJsonParameter.call(this, 'howWeImpactedTheirBusiness', itemIndex, '[]');
body.howTheyBenefitFromProduct = this.getNodeParameter('howTheyBenefitFromProduct', itemIndex);
body.howTheyMakeMoney = this.getNodeParameter('howTheyMakeMoney', itemIndex);
body.howTheyUseProduct = this.getNodeParameter('howTheyUseProduct', itemIndex);
body.keyStats = utils_1.parseJsonParameter.call(this, 'keyStats', itemIndex, '[]');
body.emailSnippets = utils_1.parseJsonParameter.call(this, 'emailSnippets', 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/reference/update', body);
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } });
return [executionData];
}
//# sourceMappingURL=update.operation.js.map