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.

123 lines 5.45 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: 'Workspace: Name', name: 'workspaceName', type: 'string', required: true, default: '', description: 'Name of the workspace to be built or configured', }, { displayName: 'Workspace: URL', name: 'workspaceUrl', type: 'string', default: '', description: 'URL of the workspace (e.g., https://octave.com) (optional)', }, { displayName: 'Workspace: Add Existing Users', name: 'workspaceAddExistingUsers', type: 'boolean', default: true, description: 'Whether to add existing users to the workspace (optional, defaults to true)', }, { displayName: 'Workspace: Agent OIds (JSON Array)', name: 'workspaceAgentOIds', type: 'json', default: '[]', description: 'JSON array of Agent OIds to associate (e.g., ["id1", "id2"]) (optional)', }, { displayName: 'Offering: Name', name: 'offeringName', type: 'string', required: true, default: '', description: 'Name of the offering/product', }, { displayName: 'Offering: Differentiated Value', name: 'offeringDifferentiatedValue', type: 'string', required: true, default: '', description: 'The differentiated value proposition of the offering', }, { displayName: 'Offering: Additional URLs (JSON Array)', name: 'offeringAdditionalUrls', type: 'json', default: '[]', description: 'JSON array of additional URLs (e.g., ["https://docs.octave.com"]) (optional)', }, { displayName: 'Offering: Status Quo', name: 'offeringStatusQuo', type: 'string', default: '', description: 'Description of the status quo that the offering addresses (optional)', }, { displayName: 'Offering: References (JSON Array of Objects)', name: 'offeringReferences', type: 'json', default: '[]', description: 'JSON array of reference objects, e.g., [{ "URL": "string", "details": "string" }] (optional)', placeholder: '[{\n "url": "https://casestudy.example.com/customer-a",\n "details": "Customer A achieved X results..."\n}]', }, { displayName: 'Runtime Context (JSON for Build Workspace)', name: 'buildWorkspaceRuntimeContext', type: 'json', default: '{}', description: 'Optional JSON runtime context for the workspace build process (optional)', }, ]; const displayOptions = { show: { resource: ['agent'], operation: ['buildWorkspace'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const body = {}; const workspace = { name: this.getNodeParameter('workspaceName', itemIndex, ''), }; const workspaceUrl = this.getNodeParameter('workspaceUrl', itemIndex); if (workspaceUrl) workspace.url = workspaceUrl; workspace.addExistingUsers = this.getNodeParameter('workspaceAddExistingUsers', itemIndex, true); workspace.agentOIds = utils_1.parseJsonParameter.call(this, 'workspaceAgentOIds', itemIndex, '[]'); const offering = { name: this.getNodeParameter('offeringName', itemIndex, ''), differentiatedValue: this.getNodeParameter('offeringDifferentiatedValue', itemIndex, ''), }; offering.additionalUrls = utils_1.parseJsonParameter.call(this, 'offeringAdditionalUrls', itemIndex, '[]'); const offeringStatusQuo = this.getNodeParameter('offeringStatusQuo', itemIndex); if (offeringStatusQuo) offering.statusQuo = offeringStatusQuo; offering.references = utils_1.parseJsonParameter.call(this, 'offeringReferences', itemIndex, '[]'); body.workspace = workspace; body.offering = offering; const buildWorkspaceRuntimeContextString = this.getNodeParameter('buildWorkspaceRuntimeContext', itemIndex, '{}'); if (buildWorkspaceRuntimeContextString && buildWorkspaceRuntimeContextString.trim() !== '{}' && buildWorkspaceRuntimeContextString.trim() !== '') { body.runtimeContext = utils_1.parseJsonParameter.call(this, 'buildWorkspaceRuntimeContext', itemIndex, '{}'); } Object.keys(body).forEach(key => (body[key] === undefined) && delete body[key]); Object.keys(workspace).forEach(key => (workspace[key] === undefined) && delete workspace[key]); Object.keys(offering).forEach(key => (offering[key] === undefined) && delete offering[key]); const responseDataOuter = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/agents/workspace/build', body); const responseDataInner = (responseDataOuter === null || responseDataOuter === void 0 ? void 0 : responseDataOuter.data) !== undefined ? responseDataOuter.data : responseDataOuter; const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseDataInner || responseDataOuter || {}), { itemData: { item: itemIndex } }); return [executionData]; } //# sourceMappingURL=buildWorkspace.operation.js.map