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

n8n-workflow

Package Overview
Dependencies
Maintainers
1
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 0.65.0 to 0.66.0

2

dist/src/Expression.d.ts

@@ -1,2 +0,2 @@

import { INode, INodeExecutionData, INodeParameters, IRunExecutionData, IWorkflowDataProxyAdditionalKeys, NodeParameterValue, Workflow, WorkflowExecuteMode } from './';
import { INode, INodeExecutionData, INodeParameters, IRunExecutionData, IWorkflowDataProxyAdditionalKeys, NodeParameterValue, Workflow, WorkflowExecuteMode } from '.';
export declare class Expression {

@@ -3,0 +3,0 @@ workflow: Workflow;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Expression = void 0;
const _1 = require("./");
const tmpl = require("riot-tmpl");
const _1 = require(".");
tmpl.brackets.set('{{ }}');

@@ -29,3 +29,3 @@ tmpl.tmpl.errorHandler = () => { };

else if (returnValue !== null && typeof returnValue === 'object') {
if (returnObjectAsString === true) {
if (returnObjectAsString) {
return this.convertObjectValueToString(returnValue);

@@ -77,5 +77,3 @@ }

}
else {
return this.resolveSimpleParameterValue(value, siblingParameters, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, additionalKeys, returnObjectAsString, selfData);
}
return this.resolveSimpleParameterValue(value, siblingParameters, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, additionalKeys, returnObjectAsString, selfData);
};

@@ -90,3 +88,3 @@ if (!isComplexParameter(parameterValue)) {

}
if (returnObjectAsString === true && typeof returnData === 'object') {
if (returnObjectAsString && typeof returnData === 'object') {
return this.convertObjectValueToString(returnData);

@@ -96,15 +94,13 @@ }

}
else if (parameterValue === null || parameterValue === undefined) {
if (parameterValue === null || parameterValue === undefined) {
return parameterValue;
}
else {
const returnData = {};
for (const key of Object.keys(parameterValue)) {
returnData[key] = resolveParameterValue(parameterValue[key], parameterValue);
}
if (returnObjectAsString === true && typeof returnData === 'object') {
return this.convertObjectValueToString(returnData);
}
return returnData;
const returnData = {};
for (const key of Object.keys(parameterValue)) {
returnData[key] = resolveParameterValue(parameterValue[key], parameterValue);
}
if (returnObjectAsString && typeof returnData === 'object') {
return this.convertObjectValueToString(returnData);
}
return returnData;
}

@@ -111,0 +107,0 @@ }

@@ -0,1 +1,4 @@

import * as LoggerProxy from './LoggerProxy';
import * as NodeHelpers from './NodeHelpers';
import * as ObservableObject from './ObservableObject';
export * from './Interfaces';

@@ -8,5 +11,2 @@ export * from './Expression';

export * from './WorkflowHooks';
import * as LoggerProxy from './LoggerProxy';
import * as NodeHelpers from './NodeHelpers';
import * as ObservableObject from './ObservableObject';
export { LoggerProxy, NodeHelpers, ObservableObject, };
export { LoggerProxy, NodeHelpers, ObservableObject };

@@ -10,6 +10,12 @@ "use strict";

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObservableObject = exports.NodeHelpers = exports.LoggerProxy = void 0;
const LoggerProxy = require("./LoggerProxy");
exports.LoggerProxy = LoggerProxy;
const NodeHelpers = require("./NodeHelpers");
exports.NodeHelpers = NodeHelpers;
const ObservableObject = require("./ObservableObject");
exports.ObservableObject = ObservableObject;
__exportStar(require("./Interfaces"), exports);

@@ -22,8 +28,2 @@ __exportStar(require("./Expression"), exports);

__exportStar(require("./WorkflowHooks"), exports);
const LoggerProxy = require("./LoggerProxy");
exports.LoggerProxy = LoggerProxy;
const NodeHelpers = require("./NodeHelpers");
exports.NodeHelpers = NodeHelpers;
const ObservableObject = require("./ObservableObject");
exports.ObservableObject = ObservableObject;
//# sourceMappingURL=index.js.map

@@ -0,1 +1,2 @@

import * as express from 'express';
import { Workflow } from './Workflow';

@@ -5,3 +6,2 @@ import { WorkflowHooks } from './WorkflowHooks';

import { NodeApiError, NodeOperationError } from './NodeErrors';
import * as express from 'express';
export declare type IAllExecuteFunctions = IExecuteFunctions | IExecuteSingleFunctions | IHookFunctions | ILoadOptionsFunctions | IPollFunctions | ITriggerFunctions | IWebhookFunctions;

@@ -577,7 +577,7 @@ export interface IBinaryData {

export interface IWorkflowExecuteHooks {
[key: string]: Array<((...args: any[]) => Promise<void>)> | undefined;
nodeExecuteAfter?: Array<((nodeName: string, data: ITaskData, executionData: IRunExecutionData) => Promise<void>)>;
nodeExecuteBefore?: Array<((nodeName: string) => Promise<void>)>;
workflowExecuteAfter?: Array<((data: IRun, newStaticData: IDataObject) => Promise<void>)>;
workflowExecuteBefore?: Array<((workflow: Workflow, data: IRunExecutionData) => Promise<void>)>;
[key: string]: Array<(...args: any[]) => Promise<void>> | undefined;
nodeExecuteAfter?: Array<(nodeName: string, data: ITaskData, executionData: IRunExecutionData) => Promise<void>>;
nodeExecuteBefore?: Array<(nodeName: string) => Promise<void>>;
workflowExecuteAfter?: Array<(data: IRun, newStaticData: IDataObject) => Promise<void>>;
workflowExecuteBefore?: Array<(workflow: Workflow, data: IRunExecutionData) => Promise<void>>;
}

@@ -584,0 +584,0 @@ export interface IWorkflowExecuteAdditionalData {

@@ -17,3 +17,3 @@ import { INode, JsonObject } from '.';

httpCode: string | null;
constructor(node: INode, error: JsonObject, { message, description, httpCode, parseXml }?: {
constructor(node: INode, error: JsonObject, { message, description, httpCode, parseXml, }?: {
message?: string;

@@ -20,0 +20,0 @@ description?: string;

@@ -30,3 +30,10 @@ "use strict";

];
const ERROR_STATUS_PROPERTIES = ['statusCode', 'status', 'code', 'status_code', 'errorCode', 'error_code'];
const ERROR_STATUS_PROPERTIES = [
'statusCode',
'status',
'code',
'status_code',
'errorCode',
'error_code',
];
const ERROR_NESTING_PROPERTIES = ['error', 'err', 'response', 'body', 'data'];

@@ -52,3 +59,4 @@ class NodeError extends Error {

if (Array.isArray(error[key])) {
const resolvedErrors = error[key].map((error) => {
const resolvedErrors = error[key]
.map((error) => {
if (typeof error === 'string')

@@ -88,3 +96,3 @@ return error;

isTraversableObject(value) {
return value && typeof value === 'object' && !Array.isArray(value) && !!Object.keys(value).length;
return (value && typeof value === 'object' && !Array.isArray(value) && !!Object.keys(value).length);
}

@@ -95,3 +103,5 @@ removeCircularRefs(obj, seen = new Set()) {

if (this.isTraversableObject(value)) {
seen.has(value) ? obj[key] = { circularReference: true } : this.removeCircularRefs(value, seen);
seen.has(value)
? (obj[key] = { circularReference: true })
: this.removeCircularRefs(value, seen);
return;

@@ -139,3 +149,3 @@ }

class NodeApiError extends NodeError {
constructor(node, error, { message, description, httpCode, parseXml } = {}) {
constructor(node, error, { message, description, httpCode, parseXml, } = {}) {
super(node, error);

@@ -142,0 +152,0 @@ if (error.error) {

@@ -111,5 +111,5 @@ import { IContextObject, INode, INodeCredentialDescription, INodeExecutionData, INodeIssues, INodeParameters, INodeProperties, INodeType, IParameterDependencies, IRunExecutionData, IWebhookData, IWorkflowExecuteAdditionalData, NodeParameterValue } from './Interfaces';

export declare function addToIssuesIfMissing(foundIssues: INodeIssues, nodeProperties: INodeProperties, value: NodeParameterValue): void;
export declare function getParameterValueByPath(nodeValues: INodeParameters, parameterName: string, path: string): string | number | boolean | INodeParameters | NodeParameterValue[] | INodeParameters[] | null | undefined;
export declare function getParameterValueByPath(nodeValues: INodeParameters, parameterName: string, path: string): INodeParameters | NodeParameterValue | NodeParameterValue[] | INodeParameters[];
export declare function getParameterIssues(nodeProperties: INodeProperties, nodeValues: INodeParameters, path: string): INodeIssues;
export declare function mergeIssues(destination: INodeIssues, source: INodeIssues | null): void;
export declare function mergeNodeProperties(mainProperties: INodeProperties[], addProperties: INodeProperties[]): void;

@@ -71,8 +71,3 @@ "use strict";

hide: {
mode: [
'custom',
'everyHour',
'everyMinute',
'everyX',
],
mode: ['custom', 'everyHour', 'everyMinute', 'everyX'],
},

@@ -93,7 +88,3 @@ },

hide: {
mode: [
'custom',
'everyMinute',
'everyX',
],
mode: ['custom', 'everyMinute', 'everyX'],
},

@@ -110,5 +101,3 @@ },

show: {
mode: [
'everyMonth',
],
mode: ['everyMonth'],
},

@@ -129,5 +118,3 @@ },

show: {
mode: [
'everyWeek',
],
mode: ['everyWeek'],
},

@@ -174,5 +161,3 @@ },

show: {
mode: [
'custom',
],
mode: ['custom'],
},

@@ -193,5 +178,3 @@ },

show: {
mode: [
'everyX',
],
mode: ['everyX'],
},

@@ -208,5 +191,3 @@ },

show: {
mode: [
'everyX',
],
mode: ['everyX'],
},

@@ -258,6 +239,7 @@ },

}
if (values.some(v => (typeof v) === 'string' && v.charAt(0) === '=')) {
if (values.some((v) => typeof v === 'string' && v.charAt(0) === '=')) {
return true;
}
if (values.length === 0 || !parameter.displayOptions.show[propertyName].some(v => values.includes(v))) {
if (values.length === 0 ||
!parameter.displayOptions.show[propertyName].some((v) => values.includes(v))) {
return false;

@@ -282,3 +264,4 @@ }

}
if (values.length !== 0 && parameter.displayOptions.hide[propertyName].some(v => values.includes(v))) {
if (values.length !== 0 &&
parameter.displayOptions.hide[propertyName].some((v) => values.includes(v))) {
return false;

@@ -356,5 +339,5 @@ }

let lastIndexReduction = -1;
let itterations = 0;
let iterations = 0;
while (indexToResolve.length !== 0) {
itterations += 1;
iterations += 1;
index = indexToResolve.shift();

@@ -379,6 +362,6 @@ property = nodePropertiesArray[index];

if (indexToResolve.length < lastIndexLength) {
lastIndexReduction = itterations;
lastIndexReduction = iterations;
}
if (itterations > lastIndexReduction + nodePropertiesArray.length) {
throw new Error('Could not resolve parameter depenencies. Max itterations got reached!');
if (iterations > lastIndexReduction + nodePropertiesArray.length) {
throw new Error('Could not resolve parameter depenencies. Max iterations reached! Hint: If `displayOptions` are specified in any child parameter of a parent `collection` or `fixedCollection`, remove the `displayOptions` from the child parameter.');
}

@@ -409,3 +392,3 @@ lastIndexLength = indexToResolve.length;

let nodeValuesDisplayCheck = nodeParametersFull;
if (dataIsResolved !== true && returnNoneDisplayed === false) {
if (!dataIsResolved && !returnNoneDisplayed) {
nodeValuesDisplayCheck = getNodeParameters(nodePropertiesArray, nodeValues, true, true, true, true, nodeValuesRoot, parentType, parameterDependencies);

@@ -417,12 +400,11 @@ }

const nodeProperties = nodePropertiesArray[parameterIndex];
if (nodeValues[nodeProperties.name] === undefined && (returnDefaults === false || parentType === 'collection')) {
if (nodeValues[nodeProperties.name] === undefined &&
(!returnDefaults || parentType === 'collection')) {
continue;
}
if (returnNoneDisplayed === false && !displayParameter(nodeValuesDisplayCheck, nodeProperties, nodeValuesRoot)) {
if (returnNoneDisplayed === false) {
if (!returnNoneDisplayed &&
!displayParameter(nodeValuesDisplayCheck, nodeProperties, nodeValuesRoot)) {
if (!returnNoneDisplayed || !returnDefaults) {
continue;
}
if (returnDefaults === false) {
continue;
}
}

@@ -435,13 +417,19 @@ if (!['collection', 'fixedCollection'].includes(nodeProperties.type)) {

}
if (returnDefaults === true) {
if (returnDefaults) {
if (['boolean', 'number', 'options'].includes(nodeProperties.type)) {
nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name] !== undefined ? nodeValues[nodeProperties.name] : nodeProperties.default;
nodeParameters[nodeProperties.name] =
nodeValues[nodeProperties.name] !== undefined
? nodeValues[nodeProperties.name]
: nodeProperties.default;
}
else {
nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name] || nodeProperties.default;
nodeParameters[nodeProperties.name] =
nodeValues[nodeProperties.name] || nodeProperties.default;
}
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];
}
else if ((nodeValues[nodeProperties.name] !== nodeProperties.default && typeof nodeValues[nodeProperties.name] !== 'object') ||
(typeof nodeValues[nodeProperties.name] === 'object' && !lodash_1.isEqual(nodeValues[nodeProperties.name], nodeProperties.default)) ||
else if ((nodeValues[nodeProperties.name] !== nodeProperties.default &&
typeof nodeValues[nodeProperties.name] !== 'object') ||
(typeof nodeValues[nodeProperties.name] === 'object' &&
!lodash_1.isEqual(nodeValues[nodeProperties.name], nodeProperties.default)) ||
(nodeValues[nodeProperties.name] !== undefined && parentType === 'collection')) {

@@ -453,3 +441,3 @@ nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name];

}
if (onlySimpleTypes === true) {
if (onlySimpleTypes) {
continue;

@@ -459,7 +447,8 @@ }

if (nodeProperties.type === 'collection') {
if (nodeProperties.typeOptions !== undefined && nodeProperties.typeOptions.multipleValues === true) {
if (nodeProperties.typeOptions !== undefined &&
nodeProperties.typeOptions.multipleValues === true) {
if (nodeValues[nodeProperties.name] !== undefined) {
nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name];
}
else if (returnDefaults === true) {
else if (returnDefaults) {
if (Array.isArray(nodeProperties.default)) {

@@ -474,15 +463,13 @@ nodeParameters[nodeProperties.name] = JSON.parse(JSON.stringify(nodeProperties.default));

}
else {
if (nodeValues[nodeProperties.name] !== undefined) {
const tempNodeParameters = getNodeParameters(nodeProperties.options, nodeValues[nodeProperties.name], returnDefaults, returnNoneDisplayed, false, false, nodeValuesRoot, nodeProperties.type);
if (tempNodeParameters !== null) {
nodeParameters[nodeProperties.name] = tempNodeParameters;
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];
}
}
else if (returnDefaults === true) {
nodeParameters[nodeProperties.name] = JSON.parse(JSON.stringify(nodeProperties.default));
else if (nodeValues[nodeProperties.name] !== undefined) {
const tempNodeParameters = getNodeParameters(nodeProperties.options, nodeValues[nodeProperties.name], returnDefaults, returnNoneDisplayed, false, false, nodeValuesRoot, nodeProperties.type);
if (tempNodeParameters !== null) {
nodeParameters[nodeProperties.name] = tempNodeParameters;
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];
}
}
else if (returnDefaults) {
nodeParameters[nodeProperties.name] = JSON.parse(JSON.stringify(nodeProperties.default));
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];
}
}

@@ -495,3 +482,3 @@ else if (nodeProperties.type === 'fixedCollection') {

let propertyValues = nodeValues[nodeProperties.name];
if (returnDefaults === true) {
if (returnDefaults) {
if (propertyValues === undefined) {

@@ -502,3 +489,4 @@ propertyValues = JSON.parse(JSON.stringify(nodeProperties.default));

for (const itemName of Object.keys(propertyValues || {})) {
if (nodeProperties.typeOptions !== undefined && nodeProperties.typeOptions.multipleValues === true) {
if (nodeProperties.typeOptions !== undefined &&
nodeProperties.typeOptions.multipleValues === true) {
const tempArrayValue = [];

@@ -533,4 +521,4 @@ for (const nodeValue of propertyValues[itemName]) {

}
if (Object.keys(collectionValues).length !== 0 || returnDefaults === true) {
if (returnDefaults === true) {
if (Object.keys(collectionValues).length !== 0 || returnDefaults) {
if (returnDefaults) {
if (collectionValues === undefined) {

@@ -575,6 +563,6 @@ nodeParameters[nodeProperties.name] = JSON.parse(JSON.stringify(nodeProperties.default));

for (const webhookDescription of nodeType.description.webhooks) {
if (ignoreRestartWehbooks === true && webhookDescription.restartWebhook === true) {
if (ignoreRestartWehbooks && webhookDescription.restartWebhook === true) {
continue;
}
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode, {});
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription.path, mode, {});
if (nodeWebhookPath === undefined) {

@@ -591,6 +579,6 @@ console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`);

}
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], 'internal', {}, false);
const restartWebhook = workflow.expression.getSimpleParameterValue(node, webhookDescription['restartWebhook'], 'internal', {}, false);
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription.isFullPath, 'internal', {}, false);
const restartWebhook = workflow.expression.getSimpleParameterValue(node, webhookDescription.restartWebhook, 'internal', {}, false);
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath, restartWebhook);
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode, {}, 'GET');
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription.httpMethod, mode, {}, 'GET');
if (httpMethod === undefined) {

@@ -629,3 +617,3 @@ console.error(`The webhook "${path}" for node "${node.name}" in workflow "${workflowId}" could not be added because the httpMethod is not defined.`);

for (const webhookDescription of nodeType.description.webhooks) {
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode, {});
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription.path, mode, {});
if (nodeWebhookPath === undefined) {

@@ -642,5 +630,5 @@ console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`);

}
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], mode, {}, false);
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription.isFullPath, mode, {}, false);
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath);
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode, {});
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription.httpMethod, mode, {});
if (httpMethod === undefined) {

@@ -666,3 +654,3 @@ console.error(`The webhook "${path}" for node "${node.name}" in workflow "${workflowId}" could not be added because the httpMethod is not defined.`);

}
else if (node.webhookId === undefined) {
if (node.webhookId === undefined) {
webhookPath = `${workflowId}/${encodeURIComponent(node.name.toLowerCase())}/${path}`;

@@ -710,7 +698,5 @@ }

}
const objectProperties = [
'parameters',
'credentials',
];
let issueText, parameterName;
const objectProperties = ['parameters', 'credentials'];
let issueText;
let parameterName;
for (const propertyName of objectProperties) {

@@ -751,3 +737,3 @@ if (issues[propertyName] !== undefined) {

function getParameterValueByPath(nodeValues, parameterName, path) {
return lodash_1.get(nodeValues, path ? path + '.' + parameterName : parameterName);
return lodash_1.get(nodeValues, path ? `${path}.${parameterName}` : parameterName);
}

@@ -761,3 +747,4 @@ exports.getParameterValueByPath = getParameterValueByPath;

value = getParameterValueByPath(nodeValues, nodeProperties.name, path);
if (nodeProperties.typeOptions !== undefined && nodeProperties.typeOptions.multipleValues !== undefined) {
if (nodeProperties.typeOptions !== undefined &&
nodeProperties.typeOptions.multipleValues !== undefined) {
if (Array.isArray(value)) {

@@ -788,3 +775,3 @@ for (const singleValue of value) {

else if (nodeProperties.type === 'fixedCollection') {
basePath = basePath ? `${basePath}.` : '' + nodeProperties.name + '.';
basePath = basePath ? `${basePath}.` : `${nodeProperties.name}.`;
let propertyOptions;

@@ -796,3 +783,4 @@ for (propertyOptions of nodeProperties.options) {

}
if (nodeProperties.typeOptions !== undefined && nodeProperties.typeOptions.multipleValues !== undefined) {
if (nodeProperties.typeOptions !== undefined &&
nodeProperties.typeOptions.multipleValues !== undefined) {
if (Array.isArray(value)) {

@@ -837,6 +825,3 @@ for (let i = 0; i < value.length; i++) {

}
const objectProperties = [
'parameters',
'credentials',
];
const objectProperties = ['parameters', 'credentials'];
let destinationProperty;

@@ -866,3 +851,3 @@ for (const propertyName of objectProperties) {

for (const property of addProperties) {
existingIndex = mainProperties.findIndex(element => element.name === property.name);
existingIndex = mainProperties.findIndex((element) => element.name === property.name);
if (existingIndex === -1) {

@@ -869,0 +854,0 @@ mainProperties.push(property);

@@ -1,2 +0,2 @@

import { IDataObject, IObservableObject } from './';
import { IDataObject, IObservableObject } from '.';
export interface IObservableOptions {

@@ -3,0 +3,0 @@ ignoreEmptyOnFirstChild?: boolean;

@@ -30,4 +30,8 @@ "use strict";

if (parent === undefined) {
if (option !== undefined && option.ignoreEmptyOnFirstChild === true && depth === 0
&& target[name.toString()] === undefined && typeof value === 'object' && Object.keys(value).length === 0) {
if (option !== undefined &&
option.ignoreEmptyOnFirstChild === true &&
depth === 0 &&
target[name.toString()] === undefined &&
typeof value === 'object' &&
Object.keys(value).length === 0) {
}

@@ -34,0 +38,0 @@ else {

@@ -1,2 +0,2 @@

import { Expression, IConnections, IGetExecuteTriggerFunctions, INode, INodeExecuteFunctions, INodeExecutionData, INodeParameters, INodes, INodeType, INodeTypes, IPollFunctions, IRunExecutionData, ITaskDataConnections, ITriggerResponse, IWebhookData, IWebhookResponseData, IWorfklowIssues, IWorkflowExecuteAdditionalData, IWorkflowSettings, NodeParameterValue, WebhookSetupMethodNames, WorkflowActivateMode, WorkflowExecuteMode } from './';
import { Expression, IConnections, IGetExecuteTriggerFunctions, INode, INodeExecuteFunctions, INodeExecutionData, INodeParameters, INodes, INodeType, INodeTypes, IPollFunctions, IRunExecutionData, ITaskDataConnections, ITriggerResponse, IWebhookData, IWebhookResponseData, IWorfklowIssues, IWorkflowExecuteAdditionalData, IWorkflowSettings, NodeParameterValue, WebhookSetupMethodNames, WorkflowActivateMode, WorkflowExecuteMode } from '.';
import { IDataObject } from './Interfaces';

@@ -3,0 +3,0 @@ export declare class Workflow {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Workflow = void 0;
const _1 = require("./");
const _1 = require(".");
class Workflow {

@@ -24,3 +24,5 @@ constructor(parameters) {

this.active = parameters.active || false;
this.staticData = _1.ObservableObject.create(parameters.staticData || {}, undefined, { ignoreEmptyOnFirstChild: true });
this.staticData = _1.ObservableObject.create(parameters.staticData || {}, undefined, {
ignoreEmptyOnFirstChild: true,
});
this.settings = parameters.settings || {};

@@ -82,3 +84,5 @@ this.expression = new _1.Expression(this);

}
if (nodeType.poll !== undefined || nodeType.trigger !== undefined || nodeType.webhook !== undefined) {
if (nodeType.poll !== undefined ||
nodeType.trigger !== undefined ||
nodeType.webhook !== undefined) {
return true;

@@ -201,3 +205,7 @@ }

}
let sourceNode, type, sourceIndex, connectionIndex, connectionData;
let sourceNode;
let type;
let sourceIndex;
let connectionIndex;
let connectionData;
for (sourceNode of Object.keys(this.connectionsBySourceNode)) {

@@ -207,3 +215,4 @@ for (type of Object.keys(this.connectionsBySourceNode[sourceNode])) {

for (connectionIndex of Object.keys(this.connectionsBySourceNode[sourceNode][type][parseInt(sourceIndex, 10)])) {
connectionData = this.connectionsBySourceNode[sourceNode][type][parseInt(sourceIndex, 10)][parseInt(connectionIndex, 10)];
connectionData =
this.connectionsBySourceNode[sourceNode][type][parseInt(sourceIndex, 10)][parseInt(connectionIndex, 10)];
if (connectionData.node === currentName) {

@@ -419,5 +428,3 @@ connectionData.node = newName;

}
else {
return nodeType.trigger.call(triggerFunctions);
}
return nodeType.trigger.call(triggerFunctions);
}

@@ -468,3 +475,4 @@ async runPoll(node, pollFunctions) {

}
if (runExecutionData.resultData.lastNodeExecuted === node.name && runExecutionData.resultData.error !== undefined) {
if (runExecutionData.resultData.lastNodeExecuted === node.name &&
runExecutionData.resultData.error !== undefined) {
const error = new Error(runExecutionData.resultData.error.message);

@@ -478,3 +486,3 @@ error.stack = runExecutionData.resultData.error.stack;

for (const inputName of Object.keys(inputData)) {
newInputData[inputName] = inputData[inputName].map(input => {
newInputData[inputName] = inputData[inputName].map((input) => {
return input && input.slice(0, 1);

@@ -514,5 +522,3 @@ });

}
else {
return inputData.main;
}
return inputData.main;
}

@@ -537,5 +543,3 @@ else if (nodeType.trigger) {

}
else {
return inputData.main;
}
return inputData.main;
}

@@ -542,0 +546,0 @@ else if (nodeType.webhook) {

@@ -1,2 +0,2 @@

import { INodeExecutionData, INodeParameters, IRunExecutionData, IWorkflowDataProxyAdditionalKeys, IWorkflowDataProxyData, Workflow, WorkflowExecuteMode } from './';
import { INodeExecutionData, INodeParameters, IRunExecutionData, IWorkflowDataProxyAdditionalKeys, IWorkflowDataProxyData, Workflow, WorkflowExecuteMode } from '.';
export declare class WorkflowDataProxy {

@@ -3,0 +3,0 @@ private workflow;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowDataProxy = void 0;
const _1 = require("./");
const _1 = require(".");
class WorkflowDataProxy {

@@ -84,3 +84,3 @@ constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, siblingParameters, mode, additionalKeys, defaultReturnRunIndex = -1, selfData = {}) {

let executionData;
if (shortSyntax === false) {
if (!shortSyntax) {
if (that.runExecutionData === null) {

@@ -93,3 +93,4 @@ throw new Error(`Workflow did not run so do not have any execution-data.`);

runIndex = runIndex === undefined ? that.defaultReturnRunIndex : runIndex;
runIndex = runIndex === -1 ? (that.runExecutionData.resultData.runData[nodeName].length - 1) : runIndex;
runIndex =
runIndex === -1 ? that.runExecutionData.resultData.runData[nodeName].length - 1 : runIndex;
if (that.runExecutionData.resultData.runData[nodeName].length < runIndex) {

@@ -138,3 +139,3 @@ throw new Error(`No execution data found for run "${runIndex}" of node "${nodeName}"`);

}
else if (name === 'binary') {
if (name === 'binary') {
const returnData = {};

@@ -165,3 +166,4 @@ if (!executionData[that.itemIndex].binary) {

else if (name === 'runIndex') {
if (that.runExecutionData === null || !that.runExecutionData.resultData.runData[nodeName]) {
if (that.runExecutionData === null ||
!that.runExecutionData.resultData.runData[nodeName]) {
return -1;

@@ -183,7 +185,3 @@ }

workflowGetter() {
const allowedValues = [
'active',
'id',
'name',
];
const allowedValues = ['active', 'id', 'name'];
const that = this;

@@ -211,3 +209,3 @@ return new Proxy({}, {

itemIndex = itemIndex || that.itemIndex;
return that.workflow.expression.getParameterValue('=' + expression, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData, that.mode, that.additionalKeys);
return that.workflow.expression.getParameterValue(`=${expression}`, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData, that.mode, that.additionalKeys);
}, $item: (itemIndex, runIndex) => {

@@ -234,3 +232,3 @@ const defaultReturnRunIndex = runIndex === undefined ? -1 : runIndex;

}
else if (name === '$binary') {
if (name === '$binary') {
return that.nodeDataGetter(that.activeNodeName, true).binary;

@@ -237,0 +235,0 @@ }

@@ -65,3 +65,5 @@ "use strict";

test('should recognize that item on first child level changed if it is now empty and option "ignoreEmptyOnFirstChild" === true (init data exists)', () => {
const testObject = src_1.ObservableObject.create({ a: { b: 1 } }, undefined, { ignoreEmptyOnFirstChild: true });
const testObject = src_1.ObservableObject.create({ a: { b: 1 } }, undefined, {
ignoreEmptyOnFirstChild: true,
});
expect(testObject.__dataChanged).toBeFalsy();

@@ -74,3 +76,5 @@ expect(testObject.a.b).toEqual(1);

test('should recognize that item on first child level changed if it is now empty and option "ignoreEmptyOnFirstChild" === false (init data exists)', () => {
const testObject = src_1.ObservableObject.create({ a: { b: 1 } }, undefined, { ignoreEmptyOnFirstChild: false });
const testObject = src_1.ObservableObject.create({ a: { b: 1 } }, undefined, {
ignoreEmptyOnFirstChild: false,
});
expect(testObject.__dataChanged).toBeFalsy();

@@ -109,3 +113,5 @@ expect(testObject.a.b).toEqual(1);

test('should recognize that item on parent level got deleted even with and option "ignoreEmptyOnFirstChild" === true (init data exists)', () => {
const testObject = src_1.ObservableObject.create({ a: 1 }, undefined, { ignoreEmptyOnFirstChild: true });
const testObject = src_1.ObservableObject.create({ a: 1 }, undefined, {
ignoreEmptyOnFirstChild: true,
});
expect(testObject.__dataChanged).toBeFalsy();

@@ -112,0 +118,0 @@ expect(testObject.a).toEqual(1);

@@ -30,9 +30,9 @@ "use strict";

parameters: {
value1: '={{$node.Node1.data.value1 + \'Node1\'}}',
value2: '={{$node.Node1.data.value2 + \' - \' + $node.Node1.data.value2}}',
value1: "={{$node.Node1.data.value1 + 'Node1'}}",
value2: "={{$node.Node1.data.value2 + ' - ' + $node.Node1.data.value2}}",
},
},
output: {
value1: '={{$node.NewName.data.value1 + \'Node1\'}}',
value2: '={{$node.NewName.data.value2 + \' - \' + $node.NewName.data.value2}}',
value1: "={{$node.NewName.data.value1 + 'Node1'}}",
value2: "={{$node.NewName.data.value2 + ' - ' + $node.NewName.data.value2}}",
},

@@ -56,3 +56,3 @@ },

{
description: 'should work with [\'nodeName\']',
description: "should work with ['nodeName']",
input: {

@@ -62,9 +62,9 @@ currentName: 'Node1',

parameters: {
value1: '={{$node[\'Node1\'][\'data\'][\'value1\'] + \'Node1\'}}',
value2: '={{$node[\'Node1\'][\'data\'][\'value2\'] + \' - \' + $node[\'Node1\'][\'data\'][\'value2\']}}',
value1: "={{$node['Node1']['data']['value1'] + 'Node1'}}",
value2: "={{$node['Node1']['data']['value2'] + ' - ' + $node['Node1']['data']['value2']}}",
},
},
output: {
value1: '={{$node[\'NewName\'][\'data\'][\'value1\'] + \'Node1\'}}',
value2: '={{$node[\'NewName\'][\'data\'][\'value2\'] + \' - \' + $node[\'NewName\'][\'data\'][\'value2\']}}',
value1: "={{$node['NewName']['data']['value1'] + 'Node1'}}",
value2: "={{$node['NewName']['data']['value2'] + ' - ' + $node['NewName']['data']['value2']}}",
},

@@ -78,7 +78,7 @@ },

parameters: {
level1a: '={{$node.Node1.data.value1 + \'Node1\'}}',
level1a: "={{$node.Node1.data.value1 + 'Node1'}}",
level1b: [
{
value2a: '={{$node.Node1.data.value1 + \'Node1\'}}',
value2b: '={{$node.Node1.data.value1 + \'Node1\'}}',
value2a: "={{$node.Node1.data.value1 + 'Node1'}}",
value2b: "={{$node.Node1.data.value1 + 'Node1'}}",
},

@@ -88,9 +88,9 @@ ],

value2a: {
value3a: '={{$node.Node1.data.value1 + \'Node1\'}}',
value3a: "={{$node.Node1.data.value1 + 'Node1'}}",
value3b: [
{
value4a: '={{$node.Node1.data.value1 + \'Node1\'}}',
value4a: "={{$node.Node1.data.value1 + 'Node1'}}",
value4b: {
value5a: '={{$node.Node1.data.value1 + \'Node1\'}}',
value5b: '={{$node.Node1.data.value1 + \'Node1\'}}',
value5a: "={{$node.Node1.data.value1 + 'Node1'}}",
value5b: "={{$node.Node1.data.value1 + 'Node1'}}",
},

@@ -104,7 +104,7 @@ },

output: {
level1a: '={{$node.NewName.data.value1 + \'Node1\'}}',
level1a: "={{$node.NewName.data.value1 + 'Node1'}}",
level1b: [
{
value2a: '={{$node.NewName.data.value1 + \'Node1\'}}',
value2b: '={{$node.NewName.data.value1 + \'Node1\'}}',
value2a: "={{$node.NewName.data.value1 + 'Node1'}}",
value2b: "={{$node.NewName.data.value1 + 'Node1'}}",
},

@@ -114,9 +114,9 @@ ],

value2a: {
value3a: '={{$node.NewName.data.value1 + \'Node1\'}}',
value3a: "={{$node.NewName.data.value1 + 'Node1'}}",
value3b: [
{
value4a: '={{$node.NewName.data.value1 + \'Node1\'}}',
value4a: "={{$node.NewName.data.value1 + 'Node1'}}",
value4b: {
value5a: '={{$node.NewName.data.value1 + \'Node1\'}}',
value5b: '={{$node.NewName.data.value1 + \'Node1\'}}',
value5a: "={{$node.NewName.data.value1 + 'Node1'}}",
value5b: "={{$node.NewName.data.value1 + 'Node1'}}",
},

@@ -493,4 +493,4 @@ },

parameters: {
value1: '={{$node.Node1.data.value1 + \'Node1\'}}',
value2: '={{$node.Node1.data.value2 + \' - \' + $node.Node1.data.value2}}',
value1: "={{$node.Node1.data.value1 + 'Node1'}}",
value2: "={{$node.Node1.data.value2 + ' - ' + $node.Node1.data.value2}}",
},

@@ -513,4 +513,4 @@ },

parameters: {
value1: '={{$node.Node1New.data.value1 + \'Node1\'}}',
value2: '={{$node.Node1New.data.value2 + \' - \' + $node.Node1New.data.value2}}',
value1: "={{$node.Node1New.data.value1 + 'Node1'}}",
value2: "={{$node.Node1New.data.value2 + ' - ' + $node.Node1New.data.value2}}",
},

@@ -531,6 +531,3 @@ },

typeVersion: 1,
position: [
100,
100,
],
position: [100, 100],
};

@@ -546,3 +543,8 @@ }

}
workflow = new src_1.Workflow({ nodes: executeNodes, connections: testData.input.connections, active: false, nodeTypes });
workflow = new src_1.Workflow({
nodes: executeNodes,
connections: testData.input.connections,
active: false,
nodeTypes,
});
workflow.renameNode(testData.input.currentName, testData.input.newName);

@@ -936,50 +938,44 @@ resultNodes = {};

{
"name": "Node1",
"parameters": testData.input.Node1.parameters,
"type": "test.set",
"typeVersion": 1,
"position": [
100,
100,
],
name: 'Node1',
parameters: testData.input.Node1.parameters,
type: 'test.set',
typeVersion: 1,
position: [100, 100],
},
{
"name": "Node2",
"parameters": testData.input.Node2.parameters,
"type": "test.set",
"typeVersion": 1,
"position": [
100,
200,
],
name: 'Node2',
parameters: testData.input.Node2.parameters,
type: 'test.set',
typeVersion: 1,
position: [100, 200],
},
{
"name": "Node3",
"parameters": testData.input.hasOwnProperty('Node3') ? testData.input.Node3.parameters : {},
"type": "test.set",
"typeVersion": 1,
"position": [
100,
300,
],
name: 'Node3',
parameters: testData.input.hasOwnProperty('Node3')
?
testData.input.Node3.parameters
: {},
type: 'test.set',
typeVersion: 1,
position: [100, 300],
},
{
"name": "Node 4 with spaces",
"parameters": testData.input.hasOwnProperty('Node4') ? testData.input.Node4.parameters : {},
"type": "test.set",
"typeVersion": 1,
"position": [
100,
400,
],
name: 'Node 4 with spaces',
parameters: testData.input.hasOwnProperty('Node4')
?
testData.input.Node4.parameters
: {},
type: 'test.set',
typeVersion: 1,
position: [100, 400],
},
];
const connections = {
"Node1": {
"main": [
Node1: {
main: [
[
{
"node": "Node2",
"type": "main",
"index": 0,
node: 'Node2',
type: 'main',
index: 0,
},

@@ -989,9 +985,9 @@ ],

},
"Node2": {
"main": [
Node2: {
main: [
[
{
"node": "Node3",
"type": "main",
"index": 0,
node: 'Node3',
type: 'main',
index: 0,
},

@@ -1040,13 +1036,13 @@ ],

{
"name": "Node1",
"parameters": {
"values": {
"string": [
name: 'Node1',
parameters: {
values: {
string: [
{
"name": "name1",
"value": "value1",
name: 'name1',
value: 'value1',
},
{
"name": "name2",
"value": "={{$parameter.values.string[0].value}}A",
name: 'name2',
value: '={{$parameter.values.string[0].value}}A',
},

@@ -1056,8 +1052,5 @@ ],

},
"type": "test.setMulti",
"typeVersion": 1,
"position": [
100,
100,
],
type: 'test.setMulti',
typeVersion: 1,
position: [100, 100],
},

@@ -1064,0 +1057,0 @@ ];

{
"name": "n8n-workflow",
"version": "0.65.0",
"version": "0.66.0",
"description": "Workflow base code of n8n",

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

"build": "tsc",
"tslint": "tslint -p tsconfig.json -c tslint.json",
"tslintfix": "tslint --fix -p tsconfig.json -c tslint.json",
"format": "cd ../.. && node_modules/prettier/bin-prettier.js packages/workflow/**/**.ts --write",
"lint": "cd ../.. && node_modules/eslint/bin/eslint.js packages/workflow",
"lintfix": "cd ../.. && node_modules/eslint/bin/eslint.js packages/workflow --fix",
"watch": "tsc --watch",

@@ -35,6 +36,14 @@ "test": "jest"

"@types/xml2js": "^0.4.3",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^26.4.2",
"prettier": "^2.3.2",
"ts-jest": "^26.3.0",
"tslint": "^6.1.2",
"typescript": "~3.9.7"
"typescript": "~4.3.5"
},

@@ -41,0 +50,0 @@ "dependencies": {

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 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 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 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

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