UNPKG

n8n-nodes-smartsuite

Version:
41 lines 1.44 kB
"use strict"; // src/nodes/SmartSuite/helpers/validation.ts Object.defineProperty(exports, "__esModule", { value: true }); exports.getSolutionId = getSolutionId; exports.getTableId = getTableId; const n8n_workflow_1 = require("n8n-workflow"); const utils_1 = require("./utils"); const smartSuiteApi_1 = require("../transport/smartSuiteApi"); /** * Ensures solutionId is present, then verifies it exists. */ async function getSolutionId(itemIndex = 0) { const id = utils_1.requireParam.call(this, 'solutionId', 'Solution', itemIndex); try { await smartSuiteApi_1.apiRequest.call(this, 'GET', `/solutions/${id}/`); } catch (err) { if (err.message.includes('404')) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Solution not found for ID "${id}".`, { itemIndex }); } throw err; } return id; } /** * Ensures tableId is present, then verifies it exists. */ async function getTableId(itemIndex = 0) { const id = utils_1.requireParam.call(this, 'tableId', 'Table', itemIndex); try { await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${id}`); } catch (err) { if (err.message.includes('404')) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Table not found for ID "${id}".`, { itemIndex }); } throw err; } return id; } //# sourceMappingURL=validation.js.map