n8n-core 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BinaryData/BinaryData.service.d.ts +24 -0
- package/dist/BinaryData/BinaryData.service.js +209 -0
- package/dist/BinaryData/BinaryData.service.js.map +1 -0
- package/dist/BinaryData/FileSystem.manager.d.ts +30 -0
- package/dist/BinaryData/FileSystem.manager.js +116 -0
- package/dist/BinaryData/FileSystem.manager.js.map +1 -0
- package/dist/BinaryData/errors.d.ts +6 -0
- package/dist/BinaryData/errors.js +17 -0
- package/dist/BinaryData/errors.js.map +1 -0
- package/dist/BinaryData/types.d.ts +39 -0
- package/dist/BinaryData/types.js +3 -0
- package/dist/BinaryData/types.js.map +1 -0
- package/dist/BinaryData/utils.d.ts +8 -0
- package/dist/BinaryData/utils.js +32 -0
- package/dist/BinaryData/utils.js.map +1 -0
- package/dist/Interfaces.d.ts +1 -26
- package/dist/LoadNodeDetails.d.ts +2 -2
- package/dist/LoadNodeDetails.js.map +1 -1
- package/dist/NodeExecuteFunctions.d.ts +6 -5
- package/dist/NodeExecuteFunctions.js +225 -33
- package/dist/NodeExecuteFunctions.js.map +1 -1
- package/dist/ObjectStore/ObjectStore.service.ee.d.ts +42 -0
- package/dist/ObjectStore/ObjectStore.service.ee.js +153 -0
- package/dist/ObjectStore/ObjectStore.service.ee.js.map +1 -0
- package/dist/ObjectStore/errors.d.ts +4 -0
- package/dist/ObjectStore/errors.js +11 -0
- package/dist/ObjectStore/errors.js.map +1 -0
- package/dist/ObjectStore/types.d.ts +32 -0
- package/dist/ObjectStore/types.js +3 -0
- package/dist/ObjectStore/types.js.map +1 -0
- package/dist/ObjectStore/utils.d.ts +4 -0
- package/dist/ObjectStore/utils.js +20 -0
- package/dist/ObjectStore/utils.js.map +1 -0
- package/dist/WorkflowExecute.d.ts +4 -2
- package/dist/WorkflowExecute.js +57 -33
- package/dist/WorkflowExecute.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -0
- package/dist/decorators/LogCatch.decorator.d.ts +1 -0
- package/dist/decorators/LogCatch.decorator.js +27 -0
- package/dist/decorators/LogCatch.decorator.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -5
- package/dist/BinaryDataManager/FileSystem.d.ts +0 -34
- package/dist/BinaryDataManager/FileSystem.js +0 -157
- package/dist/BinaryDataManager/FileSystem.js.map +0 -1
- package/dist/BinaryDataManager/index.d.ts +0 -28
- package/dist/BinaryDataManager/index.js +0 -180
- package/dist/BinaryDataManager/index.js.map +0 -1
- package/dist/BinaryDataManager/utils.d.ts +0 -2
- package/dist/BinaryDataManager/utils.js +0 -15
- package/dist/BinaryDataManager/utils.js.map +0 -1
|
@@ -45,14 +45,14 @@ const path_1 = __importDefault(require("path"));
|
|
|
45
45
|
const qs_1 = require("qs");
|
|
46
46
|
const stream_1 = require("stream");
|
|
47
47
|
const url_1 = __importStar(require("url"));
|
|
48
|
-
const
|
|
49
|
-
const utils_1 = require("./BinaryDataManager/utils");
|
|
48
|
+
const BinaryData_service_1 = require("./BinaryData/BinaryData.service");
|
|
50
49
|
const Constants_1 = require("./Constants");
|
|
51
50
|
const ExtractValue_1 = require("./ExtractValue");
|
|
52
51
|
const OAuth2Helper_1 = require("./OAuth2Helper");
|
|
52
|
+
const WorkflowExecutionMetadata_1 = require("./WorkflowExecutionMetadata");
|
|
53
53
|
const Secrets_1 = require("./Secrets");
|
|
54
54
|
const UserSettings_1 = require("./UserSettings");
|
|
55
|
-
const
|
|
55
|
+
const typedi_1 = __importDefault(require("typedi"));
|
|
56
56
|
axios_1.default.defaults.timeout = 300000;
|
|
57
57
|
axios_1.default.defaults.headers.post = {};
|
|
58
58
|
axios_1.default.defaults.headers.put = {};
|
|
@@ -540,7 +540,9 @@ async function proxyRequestToAxios(workflow, additionalData, node, uriOrObject,
|
|
|
540
540
|
n8n_workflow_1.LoggerProxy.debug('Request proxied to Axios failed', { status: response.status });
|
|
541
541
|
let responseData = response.data;
|
|
542
542
|
if (Buffer.isBuffer(responseData) || responseData instanceof stream_1.Readable) {
|
|
543
|
-
responseData = await
|
|
543
|
+
responseData = await typedi_1.default.get(BinaryData_service_1.BinaryDataService)
|
|
544
|
+
.toBuffer(responseData)
|
|
545
|
+
.then((buffer) => buffer.toString('utf-8'));
|
|
544
546
|
}
|
|
545
547
|
if (configObject.simple === false) {
|
|
546
548
|
if (configObject.resolveWithFullResponse) {
|
|
@@ -674,15 +676,15 @@ async function httpRequest(requestOptions) {
|
|
|
674
676
|
return result.data;
|
|
675
677
|
}
|
|
676
678
|
function getBinaryPath(binaryDataId) {
|
|
677
|
-
return
|
|
679
|
+
return typedi_1.default.get(BinaryData_service_1.BinaryDataService).getPath(binaryDataId);
|
|
678
680
|
}
|
|
679
681
|
exports.getBinaryPath = getBinaryPath;
|
|
680
682
|
async function getBinaryMetadata(binaryDataId) {
|
|
681
|
-
return
|
|
683
|
+
return typedi_1.default.get(BinaryData_service_1.BinaryDataService).getMetadata(binaryDataId);
|
|
682
684
|
}
|
|
683
685
|
exports.getBinaryMetadata = getBinaryMetadata;
|
|
684
|
-
function getBinaryStream(binaryDataId, chunkSize) {
|
|
685
|
-
return
|
|
686
|
+
async function getBinaryStream(binaryDataId, chunkSize) {
|
|
687
|
+
return typedi_1.default.get(BinaryData_service_1.BinaryDataService).getAsStream(binaryDataId, chunkSize);
|
|
686
688
|
}
|
|
687
689
|
exports.getBinaryStream = getBinaryStream;
|
|
688
690
|
function assertBinaryData(inputData, node, itemIndex, propertyName, inputIndex) {
|
|
@@ -703,14 +705,14 @@ function assertBinaryData(inputData, node, itemIndex, propertyName, inputIndex)
|
|
|
703
705
|
exports.assertBinaryData = assertBinaryData;
|
|
704
706
|
async function getBinaryDataBuffer(inputData, itemIndex, propertyName, inputIndex) {
|
|
705
707
|
const binaryData = inputData.main[inputIndex][itemIndex].binary[propertyName];
|
|
706
|
-
return
|
|
708
|
+
return typedi_1.default.get(BinaryData_service_1.BinaryDataService).getAsBuffer(binaryData);
|
|
707
709
|
}
|
|
708
710
|
exports.getBinaryDataBuffer = getBinaryDataBuffer;
|
|
709
|
-
async function setBinaryDataBuffer(
|
|
710
|
-
return
|
|
711
|
+
async function setBinaryDataBuffer(binaryData, bufferOrStream, workflowId, executionId) {
|
|
712
|
+
return typedi_1.default.get(BinaryData_service_1.BinaryDataService).store(workflowId, executionId, bufferOrStream, binaryData);
|
|
711
713
|
}
|
|
712
714
|
exports.setBinaryDataBuffer = setBinaryDataBuffer;
|
|
713
|
-
async function copyBinaryFile(executionId, filePath, fileName, mimeType) {
|
|
715
|
+
async function copyBinaryFile(workflowId, executionId, filePath, fileName, mimeType) {
|
|
714
716
|
let fileExtension;
|
|
715
717
|
if (!mimeType) {
|
|
716
718
|
if (filePath) {
|
|
@@ -745,10 +747,10 @@ async function copyBinaryFile(executionId, filePath, fileName, mimeType) {
|
|
|
745
747
|
else if (filePath) {
|
|
746
748
|
returnData.fileName = path_1.default.parse(filePath).base;
|
|
747
749
|
}
|
|
748
|
-
return
|
|
750
|
+
return typedi_1.default.get(BinaryData_service_1.BinaryDataService).copyBinaryFile(workflowId, executionId, returnData, filePath);
|
|
749
751
|
}
|
|
750
752
|
exports.copyBinaryFile = copyBinaryFile;
|
|
751
|
-
async function prepareBinaryData(binaryData, executionId, filePath, mimeType) {
|
|
753
|
+
async function prepareBinaryData(binaryData, executionId, workflowId, filePath, mimeType) {
|
|
752
754
|
var _a, _b, _c, _d, _e;
|
|
753
755
|
let fileExtension;
|
|
754
756
|
if (binaryData instanceof http_1.IncomingMessage) {
|
|
@@ -812,7 +814,7 @@ async function prepareBinaryData(binaryData, executionId, filePath, mimeType) {
|
|
|
812
814
|
returnData.fileExtension = fileExtension;
|
|
813
815
|
}
|
|
814
816
|
}
|
|
815
|
-
return setBinaryDataBuffer(returnData, binaryData, executionId);
|
|
817
|
+
return setBinaryDataBuffer(returnData, binaryData, workflowId, executionId);
|
|
816
818
|
}
|
|
817
819
|
async function requestOAuth2(credentialsType, requestOptions, node, additionalData, oAuth2Options, isN8nRequest = false) {
|
|
818
820
|
var _a, _b;
|
|
@@ -1401,6 +1403,7 @@ const validateValueAgainstSchema = (node, nodeType, parameterValue, parameterNam
|
|
|
1401
1403
|
};
|
|
1402
1404
|
exports.validateValueAgainstSchema = validateValueAgainstSchema;
|
|
1403
1405
|
function getNodeParameter(workflow, runExecutionData, runIndex, connectionInputData, node, parameterName, itemIndex, mode, timezone, additionalKeys, executeData, fallbackValue, options) {
|
|
1406
|
+
var _a;
|
|
1404
1407
|
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
1405
1408
|
if (nodeType === undefined) {
|
|
1406
1409
|
throw new Error(`Node type "${node.type}" is not known so can not return parameter value!`);
|
|
@@ -1414,7 +1417,7 @@ function getNodeParameter(workflow, runExecutionData, runIndex, connectionInputD
|
|
|
1414
1417
|
}
|
|
1415
1418
|
let returnData;
|
|
1416
1419
|
try {
|
|
1417
|
-
returnData = workflow.expression.getParameterValue(value, runExecutionData, runIndex, itemIndex, node.name, connectionInputData, mode, timezone, additionalKeys, executeData);
|
|
1420
|
+
returnData = workflow.expression.getParameterValue(value, runExecutionData, runIndex, itemIndex, node.name, connectionInputData, mode, timezone, additionalKeys, executeData, false, {}, (_a = options === null || options === void 0 ? void 0 : options.contextNode) === null || _a === void 0 ? void 0 : _a.name);
|
|
1418
1421
|
cleanupParameterData(returnData);
|
|
1419
1422
|
}
|
|
1420
1423
|
catch (e) {
|
|
@@ -1476,6 +1479,80 @@ function getWebhookDescription(name, workflow, node) {
|
|
|
1476
1479
|
return undefined;
|
|
1477
1480
|
}
|
|
1478
1481
|
exports.getWebhookDescription = getWebhookDescription;
|
|
1482
|
+
const addExecutionDataFunctions = async (type, nodeName, data, runExecutionData, connectionType, additionalData, sourceNodeName, sourceNodeRunIndex, currentNodeRunIndex) => {
|
|
1483
|
+
if (connectionType === 'main') {
|
|
1484
|
+
throw new Error(`Setting the ${type} is not supported for the main connection!`);
|
|
1485
|
+
}
|
|
1486
|
+
let taskData;
|
|
1487
|
+
if (type === 'input') {
|
|
1488
|
+
taskData = {
|
|
1489
|
+
startTime: new Date().getTime(),
|
|
1490
|
+
executionTime: 0,
|
|
1491
|
+
executionStatus: 'running',
|
|
1492
|
+
source: [null],
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
else {
|
|
1496
|
+
taskData = (0, get_1.default)(runExecutionData, ['resultData', 'runData', nodeName, currentNodeRunIndex], undefined);
|
|
1497
|
+
if (taskData === undefined) {
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
taskData = taskData;
|
|
1502
|
+
if (data instanceof Error) {
|
|
1503
|
+
taskData.executionStatus = 'error';
|
|
1504
|
+
taskData.error = data;
|
|
1505
|
+
}
|
|
1506
|
+
else {
|
|
1507
|
+
if (type === 'output') {
|
|
1508
|
+
taskData.executionStatus = 'success';
|
|
1509
|
+
}
|
|
1510
|
+
taskData.data = {
|
|
1511
|
+
[connectionType]: data,
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
if (type === 'input') {
|
|
1515
|
+
if (!(data instanceof Error)) {
|
|
1516
|
+
taskData.inputOverride = {
|
|
1517
|
+
[connectionType]: data,
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
if (!runExecutionData.resultData.runData.hasOwnProperty(nodeName)) {
|
|
1521
|
+
runExecutionData.resultData.runData[nodeName] = [];
|
|
1522
|
+
}
|
|
1523
|
+
runExecutionData.resultData.runData[nodeName][currentNodeRunIndex] = taskData;
|
|
1524
|
+
if (additionalData.sendDataToUI) {
|
|
1525
|
+
additionalData.sendDataToUI('nodeExecuteBefore', {
|
|
1526
|
+
executionId: additionalData.executionId,
|
|
1527
|
+
nodeName,
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
else {
|
|
1532
|
+
taskData.executionTime = new Date().getTime() - taskData.startTime;
|
|
1533
|
+
if (additionalData.sendDataToUI) {
|
|
1534
|
+
additionalData.sendDataToUI('nodeExecuteAfter', {
|
|
1535
|
+
executionId: additionalData.executionId,
|
|
1536
|
+
nodeName,
|
|
1537
|
+
data: taskData,
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
let sourceTaskData = (0, get_1.default)(runExecutionData, `executionData.metadata[${sourceNodeName}]`);
|
|
1541
|
+
if (!sourceTaskData) {
|
|
1542
|
+
runExecutionData.executionData.metadata[sourceNodeName] = [];
|
|
1543
|
+
sourceTaskData = runExecutionData.executionData.metadata[sourceNodeName];
|
|
1544
|
+
}
|
|
1545
|
+
if (!sourceTaskData[sourceNodeRunIndex]) {
|
|
1546
|
+
sourceTaskData[sourceNodeRunIndex] = {
|
|
1547
|
+
subRun: [],
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
sourceTaskData[sourceNodeRunIndex].subRun.push({
|
|
1551
|
+
node: nodeName,
|
|
1552
|
+
runIndex: currentNodeRunIndex,
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1479
1556
|
const getCommonWorkflowFunctions = (workflow, node, additionalData) => ({
|
|
1480
1557
|
logger: n8n_workflow_1.LoggerProxy,
|
|
1481
1558
|
getExecutionId: () => additionalData.executionId,
|
|
@@ -1488,6 +1565,7 @@ const getCommonWorkflowFunctions = (workflow, node, additionalData) => ({
|
|
|
1488
1565
|
getWorkflowStaticData: (type) => workflow.getStaticData(type, node),
|
|
1489
1566
|
getRestApiUrl: () => additionalData.restApiUrl,
|
|
1490
1567
|
getInstanceBaseUrl: () => additionalData.instanceBaseUrl,
|
|
1568
|
+
getInstanceId: async () => (0, UserSettings_1.getInstanceId)(),
|
|
1491
1569
|
getTimezone: () => getTimezone(workflow, additionalData),
|
|
1492
1570
|
prepareOutputData: async (outputData) => [outputData],
|
|
1493
1571
|
});
|
|
@@ -1591,16 +1669,16 @@ const getFileSystemHelperFunctions = (node) => ({
|
|
|
1591
1669
|
return (0, promises_1.writeFile)(filePath, content, { encoding: 'binary', flag });
|
|
1592
1670
|
},
|
|
1593
1671
|
});
|
|
1594
|
-
const getNodeHelperFunctions = ({ executionId,
|
|
1595
|
-
copyBinaryFile: async (filePath, fileName, mimeType) => copyBinaryFile(executionId, filePath, fileName, mimeType),
|
|
1672
|
+
const getNodeHelperFunctions = ({ executionId }, workflowId) => ({
|
|
1673
|
+
copyBinaryFile: async (filePath, fileName, mimeType) => copyBinaryFile(workflowId, executionId, filePath, fileName, mimeType),
|
|
1596
1674
|
});
|
|
1597
|
-
const getBinaryHelperFunctions = ({ executionId,
|
|
1675
|
+
const getBinaryHelperFunctions = ({ executionId }, workflowId) => ({
|
|
1598
1676
|
getBinaryPath,
|
|
1599
1677
|
getBinaryStream,
|
|
1600
1678
|
getBinaryMetadata,
|
|
1601
|
-
binaryToBuffer:
|
|
1602
|
-
prepareBinaryData: async (binaryData, filePath, mimeType) => prepareBinaryData(binaryData, executionId, filePath, mimeType),
|
|
1603
|
-
setBinaryDataBuffer: async (data, binaryData) => setBinaryDataBuffer(data, binaryData, executionId),
|
|
1679
|
+
binaryToBuffer: async (body) => typedi_1.default.get(BinaryData_service_1.BinaryDataService).toBuffer(body),
|
|
1680
|
+
prepareBinaryData: async (binaryData, filePath, mimeType) => prepareBinaryData(binaryData, executionId, workflowId, filePath, mimeType),
|
|
1681
|
+
setBinaryDataBuffer: async (data, binaryData) => setBinaryDataBuffer(data, binaryData, workflowId, executionId),
|
|
1604
1682
|
copyBinaryFile: async () => {
|
|
1605
1683
|
throw new Error('copyBinaryFile has been removed. Please upgrade this node');
|
|
1606
1684
|
},
|
|
@@ -1628,7 +1706,7 @@ function getExecutePollFunctions(workflow, node, additionalData, mode, activatio
|
|
|
1628
1706
|
helpers: {
|
|
1629
1707
|
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
1630
1708
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
|
1631
|
-
...getBinaryHelperFunctions(additionalData),
|
|
1709
|
+
...getBinaryHelperFunctions(additionalData, workflow.id),
|
|
1632
1710
|
returnJsonArray,
|
|
1633
1711
|
},
|
|
1634
1712
|
};
|
|
@@ -1658,7 +1736,7 @@ function getExecuteTriggerFunctions(workflow, node, additionalData, mode, activa
|
|
|
1658
1736
|
helpers: {
|
|
1659
1737
|
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
1660
1738
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
|
1661
|
-
...getBinaryHelperFunctions(additionalData),
|
|
1739
|
+
...getBinaryHelperFunctions(additionalData, workflow.id),
|
|
1662
1740
|
returnJsonArray,
|
|
1663
1741
|
},
|
|
1664
1742
|
};
|
|
@@ -1684,11 +1762,106 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1684
1762
|
inputData,
|
|
1685
1763
|
parentWorkflowSettings: workflow.settings,
|
|
1686
1764
|
})
|
|
1687
|
-
.then(async (result) =>
|
|
1765
|
+
.then(async (result) => typedi_1.default.get(BinaryData_service_1.BinaryDataService).duplicateBinaryData(workflow.id, additionalData.executionId, result));
|
|
1688
1766
|
},
|
|
1689
1767
|
getContext(type) {
|
|
1690
1768
|
return n8n_workflow_1.NodeHelpers.getContext(runExecutionData, type, node);
|
|
1691
1769
|
},
|
|
1770
|
+
async getInputConnectionData(inputName, itemIndex, inputIndex) {
|
|
1771
|
+
var _a;
|
|
1772
|
+
const node = this.getNode();
|
|
1773
|
+
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
1774
|
+
const inputs = n8n_workflow_1.NodeHelpers.getNodeInputs(workflow, node, nodeType.description);
|
|
1775
|
+
let inputConfiguration = inputs.find((input) => {
|
|
1776
|
+
if (typeof input === 'string') {
|
|
1777
|
+
return input === inputName;
|
|
1778
|
+
}
|
|
1779
|
+
return input.type === inputName;
|
|
1780
|
+
});
|
|
1781
|
+
if (inputConfiguration === undefined) {
|
|
1782
|
+
throw new Error(`The node "${node.name}" does not have an input of type "${inputName}"`);
|
|
1783
|
+
}
|
|
1784
|
+
if (typeof inputConfiguration === 'string') {
|
|
1785
|
+
inputConfiguration = {
|
|
1786
|
+
type: inputConfiguration,
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
const parentNodes = workflow.getParentNodes(node.name, inputName, 1);
|
|
1790
|
+
if (parentNodes.length === 0) {
|
|
1791
|
+
return inputConfiguration.maxConnections === 1 ? undefined : [];
|
|
1792
|
+
}
|
|
1793
|
+
const constParentNodes = parentNodes
|
|
1794
|
+
.map((nodeName) => {
|
|
1795
|
+
return workflow.getNode(nodeName);
|
|
1796
|
+
})
|
|
1797
|
+
.filter((connectedNode) => connectedNode.disabled !== true)
|
|
1798
|
+
.map(async (connectedNode) => {
|
|
1799
|
+
const nodeType = workflow.nodeTypes.getByNameAndVersion(connectedNode.type, connectedNode.typeVersion);
|
|
1800
|
+
if (!nodeType.supplyData) {
|
|
1801
|
+
throw new Error(`The node "${connectedNode.name}" does not have a "supplyData" method defined!`);
|
|
1802
|
+
}
|
|
1803
|
+
const context = Object.assign({}, this);
|
|
1804
|
+
context.getNodeParameter = (parameterName, itemIndex, fallbackValue, options) => {
|
|
1805
|
+
return getNodeParameter(workflow, runExecutionData, runIndex, connectionInputData, connectedNode, parameterName, itemIndex, mode, additionalData.timezone, getAdditionalKeys(additionalData, mode, runExecutionData), executeData, fallbackValue, { ...(options || {}), contextNode: node });
|
|
1806
|
+
};
|
|
1807
|
+
context.getNode = () => {
|
|
1808
|
+
return (0, n8n_workflow_1.deepCopy)(connectedNode);
|
|
1809
|
+
};
|
|
1810
|
+
context.getCredentials = async (key) => {
|
|
1811
|
+
try {
|
|
1812
|
+
return await getCredentials(workflow, connectedNode, key, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
|
|
1813
|
+
}
|
|
1814
|
+
catch (error) {
|
|
1815
|
+
let currentNodeRunIndex = 0;
|
|
1816
|
+
if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
|
|
1817
|
+
currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
|
|
1818
|
+
}
|
|
1819
|
+
await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
|
|
1820
|
+
throw error;
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
try {
|
|
1824
|
+
return await nodeType.supplyData.call(context);
|
|
1825
|
+
}
|
|
1826
|
+
catch (error) {
|
|
1827
|
+
if (!(error instanceof n8n_workflow_1.ExecutionBaseError)) {
|
|
1828
|
+
error = new n8n_workflow_1.NodeOperationError(connectedNode, error, {
|
|
1829
|
+
itemIndex,
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
let currentNodeRunIndex = 0;
|
|
1833
|
+
if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
|
|
1834
|
+
currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
|
|
1835
|
+
}
|
|
1836
|
+
await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
|
|
1837
|
+
throw new n8n_workflow_1.NodeOperationError(connectedNode, `Error on node "${connectedNode.name}" which is connected via input "${inputName}"`, {
|
|
1838
|
+
itemIndex,
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
const nodes = await Promise.all(constParentNodes);
|
|
1843
|
+
if (inputConfiguration.required && nodes.length === 0) {
|
|
1844
|
+
throw new n8n_workflow_1.NodeOperationError(node, `A ${inputName} processor node must be connected!`);
|
|
1845
|
+
}
|
|
1846
|
+
if (inputConfiguration.maxConnections !== undefined &&
|
|
1847
|
+
nodes.length > inputConfiguration.maxConnections) {
|
|
1848
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Only ${inputConfiguration.maxConnections} ${inputName} processor nodes are/is allowed to be connected!`);
|
|
1849
|
+
}
|
|
1850
|
+
return inputConfiguration.maxConnections === 1
|
|
1851
|
+
? (_a = (nodes || [])[0]) === null || _a === void 0 ? void 0 : _a.response
|
|
1852
|
+
: nodes.map((node) => node.response);
|
|
1853
|
+
},
|
|
1854
|
+
getNodeOutputs() {
|
|
1855
|
+
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
1856
|
+
return n8n_workflow_1.NodeHelpers.getNodeOutputs(workflow, node, nodeType.description).map((output) => {
|
|
1857
|
+
if (typeof output === 'string') {
|
|
1858
|
+
return {
|
|
1859
|
+
type: output,
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
return output;
|
|
1863
|
+
});
|
|
1864
|
+
},
|
|
1692
1865
|
getInputData: (inputIndex = 0, inputName = 'main') => {
|
|
1693
1866
|
if (!inputData.hasOwnProperty(inputName)) {
|
|
1694
1867
|
return [];
|
|
@@ -1714,7 +1887,7 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1714
1887
|
const dataProxy = new n8n_workflow_1.WorkflowDataProxy(workflow, runExecutionData, runIndex, itemIndex, node.name, connectionInputData, {}, mode, additionalData.timezone, getAdditionalKeys(additionalData, mode, runExecutionData), executeData);
|
|
1715
1888
|
return dataProxy.getDataProxy();
|
|
1716
1889
|
},
|
|
1717
|
-
binaryToBuffer:
|
|
1890
|
+
binaryToBuffer: async (body) => typedi_1.default.get(BinaryData_service_1.BinaryDataService).toBuffer(body),
|
|
1718
1891
|
async putExecutionToWait(waitTill) {
|
|
1719
1892
|
runExecutionData.waitTill = waitTill;
|
|
1720
1893
|
if (additionalData.setExecutionStatus) {
|
|
@@ -1726,7 +1899,7 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1726
1899
|
return;
|
|
1727
1900
|
}
|
|
1728
1901
|
try {
|
|
1729
|
-
if (additionalData.
|
|
1902
|
+
if (additionalData.sendDataToUI) {
|
|
1730
1903
|
args = args.map((arg) => {
|
|
1731
1904
|
if (arg.isLuxonDateTime && arg.invalidReason)
|
|
1732
1905
|
return { ...arg };
|
|
@@ -1736,7 +1909,10 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1736
1909
|
return arg.toString();
|
|
1737
1910
|
return arg;
|
|
1738
1911
|
});
|
|
1739
|
-
additionalData.
|
|
1912
|
+
additionalData.sendDataToUI('sendConsoleMessage', {
|
|
1913
|
+
source: `[Node: "${node.name}"]`,
|
|
1914
|
+
messages: args,
|
|
1915
|
+
});
|
|
1740
1916
|
}
|
|
1741
1917
|
}
|
|
1742
1918
|
catch (error) {
|
|
@@ -1747,18 +1923,34 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1747
1923
|
var _a;
|
|
1748
1924
|
await ((_a = additionalData.hooks) === null || _a === void 0 ? void 0 : _a.executeHookFunctions('sendResponse', [response]));
|
|
1749
1925
|
},
|
|
1926
|
+
addInputData(connectionType, data) {
|
|
1927
|
+
const nodeName = this.getNode().name;
|
|
1928
|
+
let currentNodeRunIndex = 0;
|
|
1929
|
+
if (runExecutionData.resultData.runData.hasOwnProperty(nodeName)) {
|
|
1930
|
+
currentNodeRunIndex = runExecutionData.resultData.runData[nodeName].length;
|
|
1931
|
+
}
|
|
1932
|
+
addExecutionDataFunctions('input', this.getNode().name, data, runExecutionData, connectionType, additionalData, node.name, runIndex, currentNodeRunIndex).catch((error) => {
|
|
1933
|
+
n8n_workflow_1.LoggerProxy.warn(`There was a problem logging input data of node "${this.getNode().name}": ${error.message}`);
|
|
1934
|
+
});
|
|
1935
|
+
return { index: currentNodeRunIndex };
|
|
1936
|
+
},
|
|
1937
|
+
addOutputData(connectionType, currentNodeRunIndex, data) {
|
|
1938
|
+
addExecutionDataFunctions('output', this.getNode().name, data, runExecutionData, connectionType, additionalData, node.name, runIndex, currentNodeRunIndex).catch((error) => {
|
|
1939
|
+
n8n_workflow_1.LoggerProxy.warn(`There was a problem logging output data of node "${this.getNode().name}": ${error.message}`);
|
|
1940
|
+
});
|
|
1941
|
+
},
|
|
1750
1942
|
helpers: {
|
|
1751
1943
|
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
1752
1944
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
|
1753
1945
|
...getFileSystemHelperFunctions(node),
|
|
1754
|
-
...getBinaryHelperFunctions(additionalData),
|
|
1946
|
+
...getBinaryHelperFunctions(additionalData, workflow.id),
|
|
1755
1947
|
assertBinaryData: (itemIndex, propertyName) => assertBinaryData(inputData, node, itemIndex, propertyName, 0),
|
|
1756
1948
|
getBinaryDataBuffer: async (itemIndex, propertyName) => getBinaryDataBuffer(inputData, itemIndex, propertyName, 0),
|
|
1757
1949
|
returnJsonArray,
|
|
1758
1950
|
normalizeItems,
|
|
1759
1951
|
constructExecutionMetaData,
|
|
1760
1952
|
},
|
|
1761
|
-
nodeHelpers: getNodeHelperFunctions(additionalData),
|
|
1953
|
+
nodeHelpers: getNodeHelperFunctions(additionalData, workflow.id),
|
|
1762
1954
|
};
|
|
1763
1955
|
})(workflow, runExecutionData, connectionInputData, inputData, node);
|
|
1764
1956
|
}
|
|
@@ -1811,7 +2003,7 @@ function getExecuteSingleFunctions(workflow, runExecutionData, runIndex, connect
|
|
|
1811
2003
|
helpers: {
|
|
1812
2004
|
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
1813
2005
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
|
1814
|
-
...getBinaryHelperFunctions(additionalData),
|
|
2006
|
+
...getBinaryHelperFunctions(additionalData, workflow.id),
|
|
1815
2007
|
assertBinaryData: (propertyName, inputIndex = 0) => assertBinaryData(inputData, node, itemIndex, propertyName, inputIndex),
|
|
1816
2008
|
getBinaryDataBuffer: async (propertyName, inputIndex = 0) => getBinaryDataBuffer(inputData, itemIndex, propertyName, inputIndex),
|
|
1817
2009
|
},
|
|
@@ -1946,10 +2138,10 @@ function getExecuteWebhookFunctions(workflow, node, additionalData, mode, webhoo
|
|
|
1946
2138
|
helpers: {
|
|
1947
2139
|
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
1948
2140
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
|
1949
|
-
...getBinaryHelperFunctions(additionalData),
|
|
2141
|
+
...getBinaryHelperFunctions(additionalData, workflow.id),
|
|
1950
2142
|
returnJsonArray,
|
|
1951
2143
|
},
|
|
1952
|
-
nodeHelpers: getNodeHelperFunctions(additionalData),
|
|
2144
|
+
nodeHelpers: getNodeHelperFunctions(additionalData, workflow.id),
|
|
1953
2145
|
};
|
|
1954
2146
|
})(workflow, node);
|
|
1955
2147
|
}
|