n8n-workflow
Advanced tools
Comparing version 0.34.0 to 0.35.0
@@ -262,2 +262,3 @@ import { Workflow } from './Workflow'; | ||
credentials?: INodeCredentials; | ||
webhookId?: string; | ||
} | ||
@@ -437,4 +438,5 @@ export interface INodes { | ||
export interface IWebhookDescription { | ||
[key: string]: WebhookHttpMethod | WebhookResponseMode | string | undefined; | ||
[key: string]: WebhookHttpMethod | WebhookResponseMode | boolean | string | undefined; | ||
httpMethod: WebhookHttpMethod | string; | ||
isFullPath?: boolean; | ||
name: string; | ||
@@ -441,0 +443,0 @@ path: string; |
@@ -105,4 +105,5 @@ import { IContextObject, INodeCredentialDescription, INode, INodeExecutionData, INodeIssues, INodeParameters, INodeProperties, INodeType, IParameterDependencies, IRunExecutionData, IWebhookData, IWorkflowExecuteAdditionalData, NodeParameterValue } from './Interfaces'; | ||
export declare function getNodeWebhooks(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData): IWebhookData[]; | ||
export declare function getNodeWebhookPath(workflowId: string, node: INode, path: string): string; | ||
export declare function getNodeWebhookUrl(baseUrl: string, workflowId: string, node: INode, path: string): string; | ||
export declare function getNodeWebhooksBasic(workflow: Workflow, node: INode): IWebhookData[]; | ||
export declare function getNodeWebhookPath(workflowId: string, node: INode, path: string, isFullPath?: boolean): string; | ||
export declare function getNodeWebhookUrl(baseUrl: string, workflowId: string, node: INode, path: string, isFullPath?: boolean): string; | ||
export declare function getNodeParametersIssues(nodePropertiesArray: INodeProperties[], node: INode): INodeIssues | null; | ||
@@ -109,0 +110,0 @@ export declare function nodeIssuesToString(issues: INodeIssues, node?: INode): string[]; |
@@ -543,3 +543,3 @@ "use strict"; | ||
for (const webhookDescription of nodeType.description.webhooks) { | ||
let nodeWebhookPath = workflow.getSimpleParameterValue(node, webhookDescription['path'], 'GET'); | ||
let nodeWebhookPath = workflow.getSimpleParameterValue(node, webhookDescription['path']); | ||
if (nodeWebhookPath === undefined) { | ||
@@ -553,3 +553,4 @@ console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`); | ||
} | ||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath); | ||
const isFullPath = workflow.getSimpleParameterValue(node, webhookDescription['isFullPath'], false); | ||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath); | ||
const httpMethod = workflow.getSimpleParameterValue(node, webhookDescription['httpMethod'], 'GET'); | ||
@@ -572,8 +573,56 @@ if (httpMethod === undefined) { | ||
exports.getNodeWebhooks = getNodeWebhooks; | ||
function getNodeWebhookPath(workflowId, node, path) { | ||
return `${workflowId}/${encodeURIComponent(node.name.toLowerCase())}/${path}`; | ||
function getNodeWebhooksBasic(workflow, node) { | ||
if (node.disabled === true) { | ||
return []; | ||
} | ||
const nodeType = workflow.nodeTypes.getByName(node.type); | ||
if (nodeType.description.webhooks === undefined) { | ||
return []; | ||
} | ||
const workflowId = workflow.id || '__UNSAVED__'; | ||
const returnData = []; | ||
for (const webhookDescription of nodeType.description.webhooks) { | ||
let nodeWebhookPath = workflow.getSimpleParameterValue(node, webhookDescription['path']); | ||
if (nodeWebhookPath === undefined) { | ||
console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`); | ||
continue; | ||
} | ||
nodeWebhookPath = nodeWebhookPath.toString(); | ||
if (nodeWebhookPath.charAt(0) === '/') { | ||
nodeWebhookPath = nodeWebhookPath.slice(1); | ||
} | ||
const isFullPath = workflow.getSimpleParameterValue(node, webhookDescription['isFullPath'], false); | ||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath); | ||
const httpMethod = workflow.getSimpleParameterValue(node, webhookDescription['httpMethod']); | ||
if (httpMethod === undefined) { | ||
console.error(`The webhook "${path}" for node "${node.name}" in workflow "${workflowId}" could not be added because the httpMethod is not defined.`); | ||
continue; | ||
} | ||
returnData.push({ | ||
httpMethod: httpMethod.toString(), | ||
node: node.name, | ||
path, | ||
webhookDescription, | ||
workflowId, | ||
}); | ||
} | ||
return returnData; | ||
} | ||
exports.getNodeWebhooksBasic = getNodeWebhooksBasic; | ||
function getNodeWebhookPath(workflowId, node, path, isFullPath) { | ||
let webhookPath = ''; | ||
if (node.webhookId === undefined) { | ||
webhookPath = `${workflowId}/${encodeURIComponent(node.name.toLowerCase())}/${path}`; | ||
} | ||
else { | ||
if (isFullPath === true) { | ||
return path; | ||
} | ||
webhookPath = `${node.webhookId}/${path}`; | ||
} | ||
return webhookPath; | ||
} | ||
exports.getNodeWebhookPath = getNodeWebhookPath; | ||
function getNodeWebhookUrl(baseUrl, workflowId, node, path) { | ||
return `${baseUrl}/${getNodeWebhookPath(workflowId, node, path)}`; | ||
function getNodeWebhookUrl(baseUrl, workflowId, node, path, isFullPath) { | ||
return `${baseUrl}/${getNodeWebhookPath(workflowId, node, path, isFullPath)}`; | ||
} | ||
@@ -580,0 +629,0 @@ exports.getNodeWebhookUrl = getNodeWebhookUrl; |
@@ -39,3 +39,3 @@ import { IConnections, IGetExecuteTriggerFunctions, INode, INodes, INodeExecuteFunctions, INodeExecutionData, INodeParameters, INodeType, INodeTypes, IPollFunctions, IRunExecutionData, ITaskDataConnections, ITriggerResponse, IWebhookData, IWebhookResponseData, IWorfklowIssues, IWorkflowExecuteAdditionalData, IWorkflowSettings, NodeParameterValue, WebhookSetupMethodNames, WorkflowExecuteMode } from './'; | ||
getNodeConnectionOutputIndex(nodeName: string, parentNodeName: string, type?: string, depth?: number, checkedNodes?: string[]): number | undefined; | ||
getSimpleParameterValue(node: INode, parameterValue: string | undefined, defaultValue?: boolean | number | string): boolean | number | string | undefined; | ||
getSimpleParameterValue(node: INode, parameterValue: string | boolean | undefined, defaultValue?: boolean | number | string): boolean | number | string | undefined; | ||
getComplexParameterValue(node: INode, parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], defaultValue?: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined; | ||
@@ -42,0 +42,0 @@ __getStartNode(nodeNames: string[]): INode | undefined; |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.34.0", | ||
"version": "0.35.0", | ||
"description": "Workflow base code of n8n", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md", |
# n8n-workflow | ||
![n8n.io - Workflow Automation](https://n8n.io/n8n-logo.png) | ||
![n8n.io - Workflow Automation](https://raw.githubusercontent.com/n8n-io/n8n/master/assets/n8n-logo.png) | ||
@@ -5,0 +5,0 @@ Workflow base code for n8n |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
415961
6619