n8n-workflow
Advanced tools
Comparing version 0.100.0 to 0.101.0
@@ -58,2 +58,16 @@ "use strict"; | ||
data.document = {}; | ||
data.global = {}; | ||
data.window = {}; | ||
data.Window = {}; | ||
data.this = {}; | ||
data.self = {}; | ||
data.alert = {}; | ||
data.prompt = {}; | ||
data.confirm = {}; | ||
data.eval = {}; | ||
data.setTimeout = {}; | ||
data.setInterval = {}; | ||
data.Function = {}; | ||
data.fetch = {}; | ||
data.XMLHttpRequest = {}; | ||
data.DateTime = luxon_1.DateTime; | ||
@@ -64,2 +78,5 @@ data.Interval = luxon_1.Interval; | ||
try { | ||
if (/([^a-zA-Z0-9"']window[^a-zA-Z0-9"'])/g.test(parameterValue)) { | ||
throw new Error(`window is not allowed`); | ||
} | ||
const returnValue = tmpl.tmpl(parameterValue, data); | ||
@@ -66,0 +83,0 @@ if (typeof returnValue === 'function') { |
@@ -213,2 +213,6 @@ /// <reference types="node" /> | ||
} | ||
export interface IRunNodeResponse { | ||
data: INodeExecutionData[][] | null | undefined; | ||
closeFunction?: () => Promise<void>; | ||
} | ||
export interface IGetExecuteFunctions { | ||
@@ -404,3 +408,3 @@ (workflow: Workflow, runExecutionData: IRunExecutionData, runIndex: number, connectionInputData: INodeExecutionData[], inputData: ITaskDataConnections, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode): IExecuteFunctions; | ||
export interface ITriggerFunctions { | ||
emit(data: INodeExecutionData[][], responsePromise?: IDeferredPromise<IExecuteResponsePromiseData>): void; | ||
emit(data: INodeExecutionData[][], responsePromise?: IDeferredPromise<IExecuteResponsePromiseData>, donePromise?: IDeferredPromise<IRun>): void; | ||
emitError(error: Error, responsePromise?: IDeferredPromise<IExecuteResponsePromiseData>): void; | ||
@@ -407,0 +411,0 @@ getCredentials(type: string): Promise<ICredentialDataDecryptedObject>; |
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, IConnectedNode } from './Interfaces'; | ||
import { IDataObject, IConnectedNode, IRunNodeResponse } from './Interfaces'; | ||
export declare class Workflow { | ||
@@ -50,3 +50,3 @@ id: string | undefined; | ||
runWebhook(webhookData: IWebhookData, node: INode, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode): Promise<IWebhookResponseData>; | ||
runNode(node: INode, inputData: ITaskDataConnections, runExecutionData: IRunExecutionData, runIndex: number, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode): Promise<INodeExecutionData[][] | null | undefined>; | ||
runNode(node: INode, inputData: ITaskDataConnections, runExecutionData: IRunExecutionData, runIndex: number, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode): Promise<IRunNodeResponse>; | ||
} |
@@ -477,3 +477,4 @@ "use strict"; | ||
triggerResponse.manualTriggerResponse = new Promise((resolve, reject) => { | ||
triggerFunctions.emit = ((resolveEmit) => (data, responsePromise) => { | ||
triggerFunctions.emit = ((resolveEmit) => (data, responsePromise, donePromise) => { | ||
var _a; | ||
additionalData.hooks.hookFunctions.sendResponse = [ | ||
@@ -486,2 +487,7 @@ async (response) => { | ||
]; | ||
if (donePromise) { | ||
(_a = additionalData.hooks.hookFunctions.workflowExecuteAfter) === null || _a === void 0 ? void 0 : _a.unshift(async (runData) => { | ||
return donePromise.resolve(runData); | ||
}); | ||
} | ||
resolveEmit(data); | ||
@@ -529,7 +535,7 @@ })(resolve); | ||
if (inputData.main[0] === null) { | ||
return undefined; | ||
return { data: undefined }; | ||
} | ||
return [inputData.main[0]]; | ||
return { data: [inputData.main[0]] }; | ||
} | ||
return undefined; | ||
return { data: undefined }; | ||
} | ||
@@ -548,3 +554,3 @@ const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (connectionInputData.length === 0) { | ||
return undefined; | ||
return { data: undefined }; | ||
} | ||
@@ -575,3 +581,3 @@ } | ||
if (returnPromises.length === 0) { | ||
return null; | ||
return { data: null }; | ||
} | ||
@@ -586,3 +592,3 @@ let promiseResults; | ||
if (promiseResults) { | ||
return [promiseResults]; | ||
return { data: [promiseResults] }; | ||
} | ||
@@ -592,3 +598,3 @@ } | ||
const thisArgs = nodeExecuteFunctions.getExecuteFunctions(this, runExecutionData, runIndex, connectionInputData, inputData, node, additionalData, mode); | ||
return nodeType.execute.call(thisArgs); | ||
return { data: await nodeType.execute.call(thisArgs) }; | ||
} | ||
@@ -598,5 +604,5 @@ else if (nodeType.poll) { | ||
const thisArgs = nodeExecuteFunctions.getExecutePollFunctions(this, node, additionalData, mode, 'manual'); | ||
return nodeType.poll.call(thisArgs); | ||
return { data: await nodeType.poll.call(thisArgs) }; | ||
} | ||
return inputData.main; | ||
return { data: inputData.main }; | ||
} | ||
@@ -607,3 +613,3 @@ else if (nodeType.trigger) { | ||
if (triggerResponse === undefined) { | ||
return null; | ||
return { data: null }; | ||
} | ||
@@ -614,20 +620,23 @@ if (triggerResponse.manualTriggerFunction !== undefined) { | ||
const response = await triggerResponse.manualTriggerResponse; | ||
let closeFunction; | ||
if (triggerResponse.closeFunction) { | ||
await triggerResponse.closeFunction(); | ||
closeFunction = triggerResponse.closeFunction; | ||
} | ||
if (response.length === 0) { | ||
return null; | ||
return { data: null, closeFunction }; | ||
} | ||
return response; | ||
return { data: response, closeFunction }; | ||
} | ||
return inputData.main; | ||
return { data: inputData.main }; | ||
} | ||
else if (nodeType.webhook) { | ||
return inputData.main; | ||
return { data: inputData.main }; | ||
} | ||
else { | ||
const routingNode = new _1.RoutingNode(this, node, connectionInputData, runExecutionData !== null && runExecutionData !== void 0 ? runExecutionData : null, additionalData, mode); | ||
return routingNode.runNode(inputData, runIndex, nodeType, nodeExecuteFunctions); | ||
return { | ||
data: await routingNode.runNode(inputData, runIndex, nodeType, nodeExecuteFunctions), | ||
}; | ||
} | ||
return null; | ||
return { data: null }; | ||
} | ||
@@ -634,0 +643,0 @@ } |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.100.0", | ||
"version": "0.101.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
745421
11661