UNPKG

n8n-nodes-powerbi

Version:
32 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.get = void 0; const n8n_workflow_1 = require("n8n-workflow"); const GenericFunctions_1 = require("../../GenericFunctions"); async function get(index) { const groupId = this.getNodeParameter('groupId', index); const dataflowId = this.getNodeParameter('dataflowId', index); if (!groupId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Workspace ID is required!'); } if (!dataflowId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Dataflow ID is required!'); } try { const endpoint = `/groups/${groupId}/dataflows/${dataflowId}`; const responseData = await GenericFunctions_1.powerBiApiRequest.call(this, 'GET', endpoint); const executionData = this.helpers.constructExecutionMetaData([{ json: responseData }], { itemData: { item: index } }); return executionData; } catch (error) { if (error.statusCode === 403) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Access denied. Please verify that you have permissions to access this dataflow.'); } if (error.statusCode === 404) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Dataflow not found. Please verify that the ID is correct.'); } throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Error getting dataflow: ${error.message}`); } } exports.get = get; //# sourceMappingURL=get.js.map