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.
131 lines • 4.93 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: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
description: 'External name of the service',
},
{
displayName: 'Internal Name',
name: 'internalName',
type: 'string',
default: '',
description: 'Internal name of the service (optional)',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the service (optional)',
},
{
displayName: 'Summary',
name: 'summary',
type: 'string',
default: '',
description: 'Brief summary of the service (optional)',
},
{
displayName: 'Primary URL',
name: 'primaryUrl',
type: 'string',
default: '',
description: 'Primary URL for the service (optional)',
},
{
displayName: 'Deliverables (JSON Array)',
name: 'deliverables',
type: 'json',
default: '[]',
description: 'JSON array of key deliverables (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Competencies (JSON Array)',
name: 'competencies',
type: 'json',
default: '[]',
description: 'JSON array of competencies required (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Customer Benefits (JSON Array)',
name: 'customerBenefits',
type: 'json',
default: '[]',
description: 'JSON array of customer benefits (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Challenges Addressed (JSON Array)',
name: 'challengesAddressed',
type: 'json',
default: '[]',
description: 'JSON array of challenges addressed (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Comparative Advantage (JSON Array)',
name: 'comparativeAdvantage',
type: 'json',
default: '[]',
description: 'JSON array of comparative advantages (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Likely Alternative (JSON Array)',
name: 'likelyAlternative',
type: 'json',
default: '[]',
description: 'JSON array of likely alternatives (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: ['service'],
operation: ['create'],
},
};
exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties);
async function execute(itemIndex) {
const body = {};
body.name = this.getNodeParameter('name', itemIndex);
if (!body.name) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Name is required to create a service.', { itemIndex });
}
body.internalName = this.getNodeParameter('internalName', itemIndex);
body.description = this.getNodeParameter('description', itemIndex);
body.summary = this.getNodeParameter('summary', itemIndex);
body.primaryUrl = this.getNodeParameter('primaryUrl', itemIndex);
body.deliverables = utils_1.parseJsonParameter.call(this, 'deliverables', itemIndex, '[]');
body.competencies = utils_1.parseJsonParameter.call(this, 'competencies', itemIndex, '[]');
body.customerBenefits = utils_1.parseJsonParameter.call(this, 'customerBenefits', itemIndex, '[]');
body.challengesAddressed = utils_1.parseJsonParameter.call(this, 'challengesAddressed', itemIndex, '[]');
body.comparativeAdvantage = utils_1.parseJsonParameter.call(this, 'comparativeAdvantage', itemIndex, '[]');
body.likelyAlternative = utils_1.parseJsonParameter.call(this, 'likelyAlternative', 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, 'POST', '/api/v2/service/create', body);
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } });
return [executionData];
}
//# sourceMappingURL=create.operation.js.map