n8n-core 1.9.1 → 1.11.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.js +14 -7
- package/dist/BinaryData/BinaryData.service.js.map +1 -1
- package/dist/BinaryData/FileSystem.manager.d.ts +6 -7
- package/dist/BinaryData/FileSystem.manager.js +50 -39
- package/dist/BinaryData/FileSystem.manager.js.map +1 -1
- package/dist/BinaryData/ObjectStore.manager.d.ts +27 -0
- package/dist/BinaryData/ObjectStore.manager.js +90 -0
- package/dist/BinaryData/ObjectStore.manager.js.map +1 -0
- package/dist/BinaryData/errors.d.ts +3 -3
- package/dist/BinaryData/errors.js +7 -6
- package/dist/BinaryData/errors.js.map +1 -1
- package/dist/BinaryData/types.d.ts +16 -13
- package/dist/BinaryData/utils.d.ts +4 -3
- package/dist/BinaryData/utils.js +12 -7
- package/dist/BinaryData/utils.js.map +1 -1
- package/dist/NodeExecuteFunctions.d.ts +1 -0
- package/dist/NodeExecuteFunctions.js +210 -4
- package/dist/NodeExecuteFunctions.js.map +1 -1
- package/dist/ObjectStore/ObjectStore.service.ee.d.ts +18 -17
- package/dist/ObjectStore/ObjectStore.service.ee.js +53 -23
- package/dist/ObjectStore/ObjectStore.service.ee.js.map +1 -1
- package/dist/ObjectStore/types.d.ts +14 -8
- package/dist/ObjectStore/utils.d.ts +1 -0
- package/dist/ObjectStore/utils.js +5 -1
- package/dist/ObjectStore/utils.js.map +1 -1
- package/dist/WorkflowExecute.d.ts +2 -1
- package/dist/WorkflowExecute.js +56 -33
- package/dist/WorkflowExecute.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/ObjectStore/errors.d.ts +0 -4
- package/dist/ObjectStore/errors.js +0 -11
- package/dist/ObjectStore/errors.js.map +0 -1
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getExecuteWebhookFunctions = exports.getExecuteHookFunctions = exports.getLoadOptionsFunctions = exports.getCredentialTestFunctions = exports.getExecuteSingleFunctions = exports.getExecuteFunctions = exports.getExecuteTriggerFunctions = exports.getExecutePollFunctions = exports.getWebhookDescription = exports.getTimezone = exports.getNodeWebhookUrl = exports.continueOnFail = exports.getNodeParameter = exports.validateValueAgainstSchema = exports.getCredentials = exports.getAdditionalKeys = exports.requestWithAuthentication = exports.normalizeItems = exports.constructExecutionMetaData = exports.returnJsonArray = exports.httpRequestWithAuthentication = exports.requestOAuth1 = exports.requestOAuth2 = exports.copyBinaryFile = exports.setBinaryDataBuffer = exports.getBinaryDataBuffer = exports.assertBinaryData = exports.getBinaryStream = exports.getBinaryMetadata = exports.getBinaryPath = exports.proxyRequestToAxios = exports.parseIncomingMessage = void 0;
|
|
29
|
+
exports.getExecuteWebhookFunctions = exports.getExecuteHookFunctions = exports.getLoadOptionsFunctions = exports.getCredentialTestFunctions = exports.getExecuteSingleFunctions = exports.getExecuteFunctions = exports.getExecuteTriggerFunctions = exports.getExecutePollFunctions = exports.copyInputItems = exports.getWebhookDescription = exports.getTimezone = exports.getNodeWebhookUrl = exports.continueOnFail = exports.getNodeParameter = exports.validateValueAgainstSchema = exports.getCredentials = exports.getAdditionalKeys = exports.requestWithAuthentication = exports.normalizeItems = exports.constructExecutionMetaData = exports.returnJsonArray = exports.httpRequestWithAuthentication = exports.requestOAuth1 = exports.requestOAuth2 = exports.copyBinaryFile = exports.setBinaryDataBuffer = exports.getBinaryDataBuffer = exports.assertBinaryData = exports.getBinaryStream = exports.getBinaryMetadata = exports.getBinaryPath = exports.proxyRequestToAxios = exports.parseIncomingMessage = void 0;
|
|
30
30
|
const client_oauth2_1 = require("@n8n/client-oauth2");
|
|
31
31
|
const axios_1 = __importDefault(require("axios"));
|
|
32
32
|
const crypto_1 = __importStar(require("crypto"));
|
|
@@ -1403,6 +1403,7 @@ const validateValueAgainstSchema = (node, nodeType, parameterValue, parameterNam
|
|
|
1403
1403
|
};
|
|
1404
1404
|
exports.validateValueAgainstSchema = validateValueAgainstSchema;
|
|
1405
1405
|
function getNodeParameter(workflow, runExecutionData, runIndex, connectionInputData, node, parameterName, itemIndex, mode, timezone, additionalKeys, executeData, fallbackValue, options) {
|
|
1406
|
+
var _a;
|
|
1406
1407
|
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
1407
1408
|
if (nodeType === undefined) {
|
|
1408
1409
|
throw new Error(`Node type "${node.type}" is not known so can not return parameter value!`);
|
|
@@ -1416,7 +1417,7 @@ function getNodeParameter(workflow, runExecutionData, runIndex, connectionInputD
|
|
|
1416
1417
|
}
|
|
1417
1418
|
let returnData;
|
|
1418
1419
|
try {
|
|
1419
|
-
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);
|
|
1420
1421
|
cleanupParameterData(returnData);
|
|
1421
1422
|
}
|
|
1422
1423
|
catch (e) {
|
|
@@ -1478,6 +1479,80 @@ function getWebhookDescription(name, workflow, node) {
|
|
|
1478
1479
|
return undefined;
|
|
1479
1480
|
}
|
|
1480
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
|
+
};
|
|
1481
1556
|
const getCommonWorkflowFunctions = (workflow, node, additionalData) => ({
|
|
1482
1557
|
logger: n8n_workflow_1.LoggerProxy,
|
|
1483
1558
|
getExecutionId: () => additionalData.executionId,
|
|
@@ -1490,6 +1565,7 @@ const getCommonWorkflowFunctions = (workflow, node, additionalData) => ({
|
|
|
1490
1565
|
getWorkflowStaticData: (type) => workflow.getStaticData(type, node),
|
|
1491
1566
|
getRestApiUrl: () => additionalData.restApiUrl,
|
|
1492
1567
|
getInstanceBaseUrl: () => additionalData.instanceBaseUrl,
|
|
1568
|
+
getInstanceId: async () => (0, UserSettings_1.getInstanceId)(),
|
|
1493
1569
|
getTimezone: () => getTimezone(workflow, additionalData),
|
|
1494
1570
|
prepareOutputData: async (outputData) => [outputData],
|
|
1495
1571
|
});
|
|
@@ -1607,6 +1683,21 @@ const getBinaryHelperFunctions = ({ executionId }, workflowId) => ({
|
|
|
1607
1683
|
throw new Error('copyBinaryFile has been removed. Please upgrade this node');
|
|
1608
1684
|
},
|
|
1609
1685
|
});
|
|
1686
|
+
function copyInputItems(items, properties) {
|
|
1687
|
+
return items.map((item) => {
|
|
1688
|
+
const newItem = {};
|
|
1689
|
+
for (const property of properties) {
|
|
1690
|
+
if (item.json[property] === undefined) {
|
|
1691
|
+
newItem[property] = null;
|
|
1692
|
+
}
|
|
1693
|
+
else {
|
|
1694
|
+
newItem[property] = (0, n8n_workflow_1.deepCopy)(item.json[property]);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return newItem;
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
exports.copyInputItems = copyInputItems;
|
|
1610
1701
|
function getExecutePollFunctions(workflow, node, additionalData, mode, activation) {
|
|
1611
1702
|
return ((workflow, node) => {
|
|
1612
1703
|
return {
|
|
@@ -1691,6 +1782,101 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1691
1782
|
getContext(type) {
|
|
1692
1783
|
return n8n_workflow_1.NodeHelpers.getContext(runExecutionData, type, node);
|
|
1693
1784
|
},
|
|
1785
|
+
async getInputConnectionData(inputName, itemIndex, inputIndex) {
|
|
1786
|
+
var _a;
|
|
1787
|
+
const node = this.getNode();
|
|
1788
|
+
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
1789
|
+
const inputs = n8n_workflow_1.NodeHelpers.getNodeInputs(workflow, node, nodeType.description);
|
|
1790
|
+
let inputConfiguration = inputs.find((input) => {
|
|
1791
|
+
if (typeof input === 'string') {
|
|
1792
|
+
return input === inputName;
|
|
1793
|
+
}
|
|
1794
|
+
return input.type === inputName;
|
|
1795
|
+
});
|
|
1796
|
+
if (inputConfiguration === undefined) {
|
|
1797
|
+
throw new Error(`The node "${node.name}" does not have an input of type "${inputName}"`);
|
|
1798
|
+
}
|
|
1799
|
+
if (typeof inputConfiguration === 'string') {
|
|
1800
|
+
inputConfiguration = {
|
|
1801
|
+
type: inputConfiguration,
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
const parentNodes = workflow.getParentNodes(node.name, inputName, 1);
|
|
1805
|
+
if (parentNodes.length === 0) {
|
|
1806
|
+
return inputConfiguration.maxConnections === 1 ? undefined : [];
|
|
1807
|
+
}
|
|
1808
|
+
const constParentNodes = parentNodes
|
|
1809
|
+
.map((nodeName) => {
|
|
1810
|
+
return workflow.getNode(nodeName);
|
|
1811
|
+
})
|
|
1812
|
+
.filter((connectedNode) => connectedNode.disabled !== true)
|
|
1813
|
+
.map(async (connectedNode) => {
|
|
1814
|
+
const nodeType = workflow.nodeTypes.getByNameAndVersion(connectedNode.type, connectedNode.typeVersion);
|
|
1815
|
+
if (!nodeType.supplyData) {
|
|
1816
|
+
throw new Error(`The node "${connectedNode.name}" does not have a "supplyData" method defined!`);
|
|
1817
|
+
}
|
|
1818
|
+
const context = Object.assign({}, this);
|
|
1819
|
+
context.getNodeParameter = (parameterName, itemIndex, fallbackValue, options) => {
|
|
1820
|
+
return getNodeParameter(workflow, runExecutionData, runIndex, connectionInputData, connectedNode, parameterName, itemIndex, mode, additionalData.timezone, getAdditionalKeys(additionalData, mode, runExecutionData), executeData, fallbackValue, { ...(options || {}), contextNode: node });
|
|
1821
|
+
};
|
|
1822
|
+
context.getNode = () => {
|
|
1823
|
+
return (0, n8n_workflow_1.deepCopy)(connectedNode);
|
|
1824
|
+
};
|
|
1825
|
+
context.getCredentials = async (key) => {
|
|
1826
|
+
try {
|
|
1827
|
+
return await getCredentials(workflow, connectedNode, key, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
|
|
1828
|
+
}
|
|
1829
|
+
catch (error) {
|
|
1830
|
+
let currentNodeRunIndex = 0;
|
|
1831
|
+
if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
|
|
1832
|
+
currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
|
|
1833
|
+
}
|
|
1834
|
+
await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
|
|
1835
|
+
throw error;
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1838
|
+
try {
|
|
1839
|
+
return await nodeType.supplyData.call(context);
|
|
1840
|
+
}
|
|
1841
|
+
catch (error) {
|
|
1842
|
+
if (!(error instanceof n8n_workflow_1.ExecutionBaseError)) {
|
|
1843
|
+
error = new n8n_workflow_1.NodeOperationError(connectedNode, error, {
|
|
1844
|
+
itemIndex,
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
let currentNodeRunIndex = 0;
|
|
1848
|
+
if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
|
|
1849
|
+
currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
|
|
1850
|
+
}
|
|
1851
|
+
await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
|
|
1852
|
+
throw new n8n_workflow_1.NodeOperationError(connectedNode, `Error on node "${connectedNode.name}" which is connected via input "${inputName}"`, {
|
|
1853
|
+
itemIndex,
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
const nodes = await Promise.all(constParentNodes);
|
|
1858
|
+
if (inputConfiguration.required && nodes.length === 0) {
|
|
1859
|
+
throw new n8n_workflow_1.NodeOperationError(node, `A ${inputName} processor node must be connected!`);
|
|
1860
|
+
}
|
|
1861
|
+
if (inputConfiguration.maxConnections !== undefined &&
|
|
1862
|
+
nodes.length > inputConfiguration.maxConnections) {
|
|
1863
|
+
throw new n8n_workflow_1.NodeOperationError(node, `Only ${inputConfiguration.maxConnections} ${inputName} processor nodes are/is allowed to be connected!`);
|
|
1864
|
+
}
|
|
1865
|
+
return inputConfiguration.maxConnections === 1
|
|
1866
|
+
? (_a = (nodes || [])[0]) === null || _a === void 0 ? void 0 : _a.response
|
|
1867
|
+
: nodes.map((node) => node.response);
|
|
1868
|
+
},
|
|
1869
|
+
getNodeOutputs() {
|
|
1870
|
+
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
1871
|
+
return n8n_workflow_1.NodeHelpers.getNodeOutputs(workflow, node, nodeType.description).map((output) => {
|
|
1872
|
+
if (typeof output === 'string') {
|
|
1873
|
+
return {
|
|
1874
|
+
type: output,
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
return output;
|
|
1878
|
+
});
|
|
1879
|
+
},
|
|
1694
1880
|
getInputData: (inputIndex = 0, inputName = 'main') => {
|
|
1695
1881
|
if (!inputData.hasOwnProperty(inputName)) {
|
|
1696
1882
|
return [];
|
|
@@ -1728,7 +1914,7 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1728
1914
|
return;
|
|
1729
1915
|
}
|
|
1730
1916
|
try {
|
|
1731
|
-
if (additionalData.
|
|
1917
|
+
if (additionalData.sendDataToUI) {
|
|
1732
1918
|
args = args.map((arg) => {
|
|
1733
1919
|
if (arg.isLuxonDateTime && arg.invalidReason)
|
|
1734
1920
|
return { ...arg };
|
|
@@ -1738,7 +1924,10 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1738
1924
|
return arg.toString();
|
|
1739
1925
|
return arg;
|
|
1740
1926
|
});
|
|
1741
|
-
additionalData.
|
|
1927
|
+
additionalData.sendDataToUI('sendConsoleMessage', {
|
|
1928
|
+
source: `[Node: "${node.name}"]`,
|
|
1929
|
+
messages: args,
|
|
1930
|
+
});
|
|
1742
1931
|
}
|
|
1743
1932
|
}
|
|
1744
1933
|
catch (error) {
|
|
@@ -1749,8 +1938,25 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
|
|
|
1749
1938
|
var _a;
|
|
1750
1939
|
await ((_a = additionalData.hooks) === null || _a === void 0 ? void 0 : _a.executeHookFunctions('sendResponse', [response]));
|
|
1751
1940
|
},
|
|
1941
|
+
addInputData(connectionType, data) {
|
|
1942
|
+
const nodeName = this.getNode().name;
|
|
1943
|
+
let currentNodeRunIndex = 0;
|
|
1944
|
+
if (runExecutionData.resultData.runData.hasOwnProperty(nodeName)) {
|
|
1945
|
+
currentNodeRunIndex = runExecutionData.resultData.runData[nodeName].length;
|
|
1946
|
+
}
|
|
1947
|
+
addExecutionDataFunctions('input', this.getNode().name, data, runExecutionData, connectionType, additionalData, node.name, runIndex, currentNodeRunIndex).catch((error) => {
|
|
1948
|
+
n8n_workflow_1.LoggerProxy.warn(`There was a problem logging input data of node "${this.getNode().name}": ${error.message}`);
|
|
1949
|
+
});
|
|
1950
|
+
return { index: currentNodeRunIndex };
|
|
1951
|
+
},
|
|
1952
|
+
addOutputData(connectionType, currentNodeRunIndex, data) {
|
|
1953
|
+
addExecutionDataFunctions('output', this.getNode().name, data, runExecutionData, connectionType, additionalData, node.name, runIndex, currentNodeRunIndex).catch((error) => {
|
|
1954
|
+
n8n_workflow_1.LoggerProxy.warn(`There was a problem logging output data of node "${this.getNode().name}": ${error.message}`);
|
|
1955
|
+
});
|
|
1956
|
+
},
|
|
1752
1957
|
helpers: {
|
|
1753
1958
|
createDeferredPromise: n8n_workflow_1.createDeferredPromise,
|
|
1959
|
+
copyInputItems,
|
|
1754
1960
|
...getRequestHelperFunctions(workflow, node, additionalData),
|
|
1755
1961
|
...getFileSystemHelperFunctions(node),
|
|
1756
1962
|
...getBinaryHelperFunctions(additionalData, workflow.id),
|