UNPKG

n8n-nodes-smartsuite

Version:
31 lines 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const utils_1 = require("../../helpers/utils"); const smartSuiteApi_1 = require("../../transport/smartSuiteApi"); const validation_1 = require("../../helpers/validation"); async function execute() { const solutionId = await validation_1.getSolutionId.call(this, 0); const tableId = await validation_1.getTableId.call(this, 0); (0, utils_1.debugLog)('[Record] getRecord.execute called', this.getNode().parameters, 2); const items = this.getInputData(); const returnData = []; for (let i = 0; i < items.length; i++) { const recordId = this.getNodeParameter('recordId', i); if (!recordId.trim()) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Record ID is required for Get Record operation.', { itemIndex: i }); } const hydrated = this.getNodeParameter('hydrated', i); const qs = {}; if (hydrated) { qs.hydrated = true; } (0, utils_1.debugLog)('[Record] getRecord.request', { solutionId, tableId, recordId, hydrated }, 2); const response = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/records/${recordId}`, {}, qs)); (0, utils_1.debugLog)('[Record] getRecord.response', response, 2); returnData.push(...this.helpers.returnJsonArray([response])); } return returnData; } //# sourceMappingURL=getRecord.operation.js.map