Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

n8n-workflow

Package Overview
Dependencies
Maintainers
2
Versions
284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n8n-workflow - npm Package Compare versions

Comparing version 1.30.1 to 1.31.0

dist/errors/trigger-close.error.d.ts

3

dist/errors/application.error.d.ts
import type { Event } from '@sentry/node';
type Level = 'warning' | 'error' | 'fatal' | 'info';
export type Level = 'warning' | 'error' | 'fatal' | 'info';
export type ReportingOptions = {

@@ -13,2 +13,1 @@ level?: Level;

}
export {};
import { ExecutionBaseError } from './abstract/execution-base.error';
export interface ExpressionErrorOptions {
cause?: Error;
causeDetailed?: string;
description?: string;
descriptionTemplate?: string;
functionality?: 'pairedItem';
itemIndex?: number;
messageTemplate?: string;
nodeCause?: string;
parameter?: string;
runIndex?: number;
type?: 'no_execution_data' | 'no_node_execution_data' | 'no_input_connection' | 'internal' | 'paired_item_invalid_info' | 'paired_item_no_info' | 'paired_item_multiple_matches' | 'paired_item_no_connection' | 'paired_item_intermediate_nodes';
}
export declare class ExpressionError extends ExecutionBaseError {
constructor(message: string, options?: {
cause?: Error;
causeDetailed?: string;
description?: string;
descriptionTemplate?: string;
functionality?: 'pairedItem';
itemIndex?: number;
messageTemplate?: string;
nodeCause?: string;
parameter?: string;
runIndex?: number;
type?: string;
});
constructor(message: string, options?: ExpressionErrorOptions);
}

@@ -13,4 +13,5 @@ export { ApplicationError } from './application.error';

export { CliWorkflowOperationError } from './cli-subworkflow-operation.error';
export { TriggerCloseError } from './trigger-close.error';
export { NodeError } from './abstract/node.error';
export { ExecutionBaseError } from './abstract/execution-base.error';
export { ExpressionExtensionError } from './expression-extension.error';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpressionExtensionError = exports.ExecutionBaseError = exports.NodeError = exports.CliWorkflowOperationError = exports.SubworkflowOperationError = exports.WorkflowOperationError = exports.WorkflowDeactivationError = exports.WorkflowActivationError = exports.WebhookPathTakenError = exports.NodeSslError = exports.NodeOperationError = exports.NodeApiError = exports.CredentialAccessError = exports.ExpressionError = exports.ApplicationError = void 0;
exports.ExpressionExtensionError = exports.ExecutionBaseError = exports.NodeError = exports.TriggerCloseError = exports.CliWorkflowOperationError = exports.SubworkflowOperationError = exports.WorkflowOperationError = exports.WorkflowDeactivationError = exports.WorkflowActivationError = exports.WebhookPathTakenError = exports.NodeSslError = exports.NodeOperationError = exports.NodeApiError = exports.CredentialAccessError = exports.ExpressionError = exports.ApplicationError = void 0;
var application_error_1 = require("./application.error");

@@ -28,2 +28,4 @@ Object.defineProperty(exports, "ApplicationError", { enumerable: true, get: function () { return application_error_1.ApplicationError; } });

Object.defineProperty(exports, "CliWorkflowOperationError", { enumerable: true, get: function () { return cli_subworkflow_operation_error_1.CliWorkflowOperationError; } });
var trigger_close_error_1 = require("./trigger-close.error");
Object.defineProperty(exports, "TriggerCloseError", { enumerable: true, get: function () { return trigger_close_error_1.TriggerCloseError; } });
var node_error_1 = require("./abstract/node.error");

@@ -30,0 +32,0 @@ Object.defineProperty(exports, "NodeError", { enumerable: true, get: function () { return node_error_1.NodeError; } });

@@ -112,3 +112,6 @@ "use strict";

}
if (node.type === 'n8n-nodes-base.httpRequest' && node.typeVersion === 1) {
if (node.type === '@n8n/n8n-nodes-langchain.agent') {
nodeItem.agent = node.parameters.agent || 'conversationalAgent';
}
else if (node.type === 'n8n-nodes-base.httpRequest' && node.typeVersion === 1) {
try {

@@ -115,0 +118,0 @@ nodeItem.domain = new URL(node.parameters.url).hostname;

@@ -84,2 +84,3 @@ "use strict";

itemIndex: that.itemIndex,
type: 'no_execution_data',
});

@@ -196,9 +197,3 @@ }

}
if (!that.runExecutionData.resultData.runData.hasOwnProperty(nodeName)) {
if (that.workflow.getNode(nodeName)) {
throw new expression_error_1.ExpressionError(`no data, execute "${nodeName}" node first`, {
runIndex: that.runIndex,
itemIndex: that.itemIndex,
});
}
if (!that.workflow.getNode(nodeName)) {
throw new expression_error_1.ExpressionError(`"${nodeName}" node doesn't exist`, {

@@ -209,2 +204,11 @@ runIndex: that.runIndex,

}
if (!that.runExecutionData.resultData.runData.hasOwnProperty(nodeName) &&
!that.workflow.getPinDataOfNode(nodeName)) {
throw new expression_error_1.ExpressionError(`no data, execute "${nodeName}" node first`, {
runIndex: that.runIndex,
itemIndex: that.itemIndex,
type: 'no_node_execution_data',
nodeCause: nodeName,
});
}
runIndex = runIndex === undefined ? that.defaultReturnRunIndex : runIndex;

@@ -267,2 +271,19 @@ runIndex =

const executionData = that.getNodeExecutionData(nodeName, shortSyntax, undefined);
if (executionData.length === 0) {
if (that.workflow.getParentNodes(nodeName).length === 0) {
throw new expression_error_1.ExpressionError('No execution data available', {
messageTemplate: 'No execution data available to expression under ‘%%PARAMETER%%’',
description: 'This node has no input data. Please make sure this node is connected to another node.',
nodeCause: nodeName,
runIndex: that.runIndex,
itemIndex: that.itemIndex,
type: 'no_input_connection',
});
}
throw new expression_error_1.ExpressionError('No execution data available', {
runIndex: that.runIndex,
itemIndex: that.itemIndex,
type: 'no_execution_data',
});
}
if (executionData.length <= that.itemIndex) {

@@ -479,2 +500,3 @@ throw new expression_error_1.ExpressionError(`No data found for item-index: "${that.itemIndex}"`, {

const getPairedItem = (destinationNodeName, incomingSourceData, pairedItem) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
let taskData;

@@ -493,6 +515,7 @@ let sourceData = incomingSourceData;

while (sourceData !== null && destinationNodeName !== sourceData.previousNode) {
const runIndex = (sourceData === null || sourceData === void 0 ? void 0 : sourceData.previousNodeRun) || 0;
const previousNodeOutput = sourceData.previousNodeOutput || 0;
taskData =
that.runExecutionData.resultData.runData[sourceData.previousNode][(sourceData === null || sourceData === void 0 ? void 0 : sourceData.previousNodeRun) || 0];
const previousNodeOutput = sourceData.previousNodeOutput || 0;
if (previousNodeOutput >= taskData.data.main.length) {
(_d = (_c = (_b = (_a = that.runExecutionData) === null || _a === void 0 ? void 0 : _a.resultData) === null || _b === void 0 ? void 0 : _b.runData) === null || _c === void 0 ? void 0 : _c[sourceData.previousNode]) === null || _d === void 0 ? void 0 : _d[runIndex];
if (((_e = taskData === null || taskData === void 0 ? void 0 : taskData.data) === null || _e === void 0 ? void 0 : _e.main) && previousNodeOutput >= taskData.data.main.length) {
throw createExpressionError('Can’t get data for expression', {

@@ -509,3 +532,5 @@ messageTemplate: 'Can’t get data for expression under ‘%%PARAMETER%%’ field',

}
if (pairedItem.item >= taskData.data.main[previousNodeOutput].length) {
const previousNodeOutputData = (_h = (_g = (_f = taskData === null || taskData === void 0 ? void 0 : taskData.data) === null || _f === void 0 ? void 0 : _f.main) === null || _g === void 0 ? void 0 : _g[previousNodeOutput]) !== null && _h !== void 0 ? _h : that.workflow.getPinDataOfNode(sourceData.previousNode);
const source = (_j = taskData === null || taskData === void 0 ? void 0 : taskData.source) !== null && _j !== void 0 ? _j : [];
if (pairedItem.item >= previousNodeOutputData.length) {
throw createExpressionError('Can’t get data for expression', {

@@ -521,7 +546,7 @@ messageTemplate: 'Can’t get data for expression under ‘%%PARAMETER%%’ field',

: ''}points to an input item on node ‘<strong>${sourceData.previousNode}</strong>‘ that doesn’t exist.`,
type: 'invalid pairing info',
type: 'paired_item_invalid_info',
moreInfoLink: true,
});
}
const itemPreviousNode = taskData.data.main[previousNodeOutput][pairedItem.item];
const itemPreviousNode = previousNodeOutputData[pairedItem.item];
if (itemPreviousNode.pairedItem === undefined) {

@@ -537,3 +562,3 @@ throw createExpressionError('Can’t get data for expression', {

causeDetailed: `Missing pairedItem data (node ‘${sourceData.previousNode}’ probably didn’t supply it)`,
type: 'no pairing info',
type: 'paired_item_no_info',
moreInfoLink: true,

@@ -547,6 +572,6 @@ });

const itemInput = item.input || 0;
if (itemInput >= taskData.source.length) {
if (itemInput >= source.length) {
throw new application_error_1.ApplicationError('Not found');
}
return getPairedItem(destinationNodeName, taskData.source[itemInput], item);
return getPairedItem(destinationNodeName, source[itemInput], item);
}

@@ -571,3 +596,3 @@ catch (error) {

description: `The expression uses data in the node ‘<strong>${destinationNodeName}</strong>’ but there is more than one matching item in that node`,
type: 'multiple matches',
type: 'paired_item_multiple_matches',
});

@@ -587,4 +612,4 @@ }

const itemInput = pairedItem.input || 0;
if (itemInput >= taskData.source.length) {
if (taskData.source.length === 0) {
if (itemInput >= source.length) {
if (source.length === 0) {
throw createExpressionError('Invalid expression', {

@@ -598,3 +623,3 @@ messageTemplate: 'Invalid expression under ‘%%PARAMETER%%’',

description: `The expression uses data in the node ‘<strong>${destinationNodeName}</strong>’ but there is no path back to it. Please check this node is connected to it (there can be other nodes in between).`,
type: 'no connection',
type: 'paired_item_no_connection',
moreInfoLink: true,

@@ -613,7 +638,7 @@ });

: ''}points to a branch that doesn’t exist.`,
type: 'invalid pairing info',
type: 'paired_item_invalid_info',
});
}
nodeBeforeLast = sourceData.previousNode;
sourceData = taskData.source[pairedItem.input || 0] || null;
sourceData = source[pairedItem.input || 0] || null;
if (pairedItem.sourceOverwrite) {

@@ -632,3 +657,3 @@ sourceData = pairedItem.sourceOverwrite;

description: 'Could not resolve, probably no pairedItem exists',
type: 'no pairing info',
type: 'paired_item_no_info',
moreInfoLink: true,

@@ -649,3 +674,3 @@ });

causeDetailed: `The sourceData points to a node output ‘${previousNodeOutput}‘ which does not exist on node ‘${sourceData.previousNode}‘ (output node did probably supply a wrong one)`,
type: 'invalid pairing info',
type: 'paired_item_invalid_info',
});

@@ -664,3 +689,3 @@ }

: ''}points to an input item on node ‘<strong>${sourceData.previousNode}</strong>‘ that doesn’t exist.`,
type: 'invalid pairing info',
type: 'paired_item_invalid_info',
moreInfoLink: true,

@@ -680,2 +705,12 @@ });

}
const ensureNodeExecutionData = () => {
var _a, _b;
if (!((_b = (_a = that === null || that === void 0 ? void 0 : that.runExecutionData) === null || _a === void 0 ? void 0 : _a.resultData) === null || _b === void 0 ? void 0 : _b.runData.hasOwnProperty(nodeName)) &&
!that.workflow.getPinDataOfNode(nodeName)) {
throw createExpressionError(`no data, execute "${nodeName}" node first`, {
type: 'no_node_execution_data',
nodeCause: nodeName,
});
}
};
return new Proxy({}, {

@@ -697,15 +732,32 @@ has: () => true,

get(target, property, receiver) {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
if (property === 'isProxy')
return true;
if (!((_b = (_a = that === null || that === void 0 ? void 0 : that.runExecutionData) === null || _a === void 0 ? void 0 : _a.resultData) === null || _b === void 0 ? void 0 : _b.runData.hasOwnProperty(nodeName))) {
if (property === 'isExecuted')
return false;
throw createExpressionError(`no data, execute "${nodeName}" node first`);
if (property === 'isExecuted') {
return ((_c = (_b = (_a = that === null || that === void 0 ? void 0 : that.runExecutionData) === null || _a === void 0 ? void 0 : _a.resultData) === null || _b === void 0 ? void 0 : _b.runData.hasOwnProperty(nodeName)) !== null && _c !== void 0 ? _c : false);
}
if (property === 'isExecuted')
return true;
if (['pairedItem', 'itemMatching', 'item'].includes(property)) {
const activeNode = that.workflow.getNode(that.activeNodeName);
let contextNode = that.contextNodeName;
if (activeNode) {
const parentMainInputNode = that.workflow.getParentMainInputNode(activeNode);
contextNode = (_d = parentMainInputNode.name) !== null && _d !== void 0 ? _d : contextNode;
}
const parentNodes = that.workflow.getParentNodes(contextNode);
if (!parentNodes.includes(nodeName)) {
throw createExpressionError('Invalid expression', {
messageTemplate: 'Invalid expression under ‘%%PARAMETER%%’',
functionality: 'pairedItem',
functionOverrides: {
description: `The code uses data in the node <strong>‘${nodeName}’</strong> but there is no path back to it. Please check this node is connected to it (there can be other nodes in between).`,
message: `No path back to node ‘${nodeName}’`,
},
description: `The expression uses data in the node <strong>‘${nodeName}’</strong> but there is no path back to it. Please check this node is connected to it (there can be other nodes in between).`,
nodeCause: nodeName,
type: 'paired_item_no_connection',
});
}
ensureNodeExecutionData();
const pairedItemMethod = (itemIndex) => {
var _a, _b, _c;
var _a, _b;
if (itemIndex === undefined) {

@@ -720,3 +772,18 @@ if (property === 'itemMatching') {

const executionData = that.connectionInputData;
const pairedItem = executionData[itemIndex].pairedItem;
const input = executionData[itemIndex];
if (!input) {
throw createExpressionError('Can’t get data for expression', {
messageTemplate: 'Can’t get data for expression under ‘%%PARAMETER%%’ field',
functionality: 'pairedItem',
functionOverrides: {
description: `Some intermediate nodes between ‘<strong>${nodeName}</strong>‘ and ‘<strong>${that.activeNodeName}</strong>‘ have not executed yet.`,
message: 'Can’t get data',
},
description: `Some intermediate nodes between ‘<strong>${nodeName}</strong>‘ and ‘<strong>${that.activeNodeName}</strong>‘ have not executed yet.`,
causeDetailed: `pairedItem can\'t be found when intermediate nodes between ‘<strong>${nodeName}</strong>‘ and ‘<strong>${that.activeNodeName}</strong> have not executed yet.`,
itemIndex,
type: 'paired_item_intermediate_nodes',
});
}
const pairedItem = input.pairedItem;
if (pairedItem === undefined) {

@@ -747,22 +814,3 @@ throw createExpressionError('Can’t get data for expression', {

}
const activeNode = that.workflow.getNode(that.activeNodeName);
let contextNode = that.contextNodeName;
if (activeNode) {
const parentMainInputNode = that.workflow.getParentMainInputNode(activeNode);
contextNode = (_b = parentMainInputNode.name) !== null && _b !== void 0 ? _b : contextNode;
}
const parentNodes = that.workflow.getParentNodes(contextNode);
if (!parentNodes.includes(nodeName)) {
throw createExpressionError('Invalid expression', {
messageTemplate: 'Invalid expression under ‘%%PARAMETER%%’',
functionality: 'pairedItem',
functionOverrides: {
description: `The code uses data in the node <strong>‘${nodeName}’</strong> but there is no path back to it. Please check this node is connected to it (there can be other nodes in between).`,
message: `No path back to node ‘${nodeName}’`,
},
description: `The expression uses data in the node <strong>‘${nodeName}’</strong> but there is no path back to it. Please check this node is connected to it (there can be other nodes in between).`,
itemIndex,
});
}
const sourceData = (_c = that.executeData.source.main[pairedItem.input || 0]) !== null && _c !== void 0 ? _c : that.executeData.source.main[0];
const sourceData = (_b = that.executeData.source.main[pairedItem.input || 0]) !== null && _b !== void 0 ? _b : that.executeData.source.main[0];
return getPairedItem(nodeName, sourceData, pairedItem);

@@ -776,2 +824,3 @@ };

if (property === 'first') {
ensureNodeExecutionData();
return (branchIndex, runIndex) => {

@@ -785,2 +834,3 @@ const executionData = getNodeOutput(nodeName, branchIndex, runIndex);

if (property === 'last') {
ensureNodeExecutionData();
return (branchIndex, runIndex) => {

@@ -797,2 +847,3 @@ const executionData = getNodeOutput(nodeName, branchIndex, runIndex);

if (property === 'all') {
ensureNodeExecutionData();
return (branchIndex, runIndex) => getNodeOutput(nodeName, branchIndex, runIndex);

@@ -804,3 +855,3 @@ }

if (property === 'params') {
return (_c = that.workflow.getNode(nodeName)) === null || _c === void 0 ? void 0 : _c.parameters;
return (_e = that.workflow.getNode(nodeName)) === null || _e === void 0 ? void 0 : _e.parameters;
}

@@ -826,2 +877,9 @@ return Reflect.get(target, property, receiver);

return true;
if (that.connectionInputData.length === 0) {
throw createExpressionError('No execution data available', {
runIndex: that.runIndex,
itemIndex: that.itemIndex,
type: 'no_execution_data',
});
}
if (property === 'item') {

@@ -828,0 +886,0 @@ return that.connectionInputData[that.itemIndex];

{
"name": "n8n-workflow",
"version": "1.30.1",
"version": "1.31.0",
"description": "Workflow base code of n8n",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc