n8n-workflow
Advanced tools
Comparing version 0.69.0 to 0.70.0
@@ -0,2 +1,5 @@ | ||
/// <reference types="node" /> | ||
import * as express from 'express'; | ||
import * as FormData from 'form-data'; | ||
import { URLSearchParams } from 'url'; | ||
import { Workflow } from './Workflow'; | ||
@@ -115,2 +118,6 @@ import { WorkflowHooks } from './WorkflowHooks'; | ||
} | ||
export interface INodeTypeNameVersion { | ||
name: string; | ||
version: number; | ||
} | ||
export interface IGetExecutePollFunctions { | ||
@@ -144,2 +151,36 @@ (workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode): IPollFunctions; | ||
} | ||
export interface IHttpRequestOptions { | ||
url: string; | ||
headers?: IDataObject; | ||
method?: 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT'; | ||
body?: FormData | GenericValue | GenericValue[] | Buffer | URLSearchParams; | ||
qs?: IDataObject; | ||
arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma'; | ||
auth?: { | ||
username: string; | ||
password: string; | ||
}; | ||
disableFollowRedirect?: boolean; | ||
encoding?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'; | ||
skipSslCertificateValidation?: boolean; | ||
returnFullResponse?: boolean; | ||
proxy?: { | ||
host: string; | ||
port: number; | ||
auth?: { | ||
username: string; | ||
password: string; | ||
}; | ||
protocol?: string; | ||
}; | ||
timeout?: number; | ||
json?: boolean; | ||
} | ||
export declare type IN8nHttpResponse = IDataObject | Buffer | GenericValue | GenericValue[]; | ||
export interface IN8nHttpFullResponse { | ||
body: IN8nHttpResponse; | ||
headers: IDataObject; | ||
statusCode: number; | ||
statusMessage: string; | ||
} | ||
export interface IExecuteFunctions { | ||
@@ -154,2 +195,5 @@ continueOnFail(): boolean; | ||
getNode(): INode; | ||
getNodeParameter<T extends { | ||
resource: string; | ||
}>(parameterName: 'resource', itemIndex?: number): T['resource']; | ||
getNodeParameter(parameterName: string, itemIndex: number, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object; | ||
@@ -165,2 +209,3 @@ getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: (...args: any[]) => any; | ||
@@ -184,2 +229,3 @@ }; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: (...args: any[]) => any; | ||
@@ -206,2 +252,3 @@ }; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: ((...args: any[]) => any) | undefined; | ||
@@ -223,2 +270,3 @@ }; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: (...args: any[]) => any; | ||
@@ -239,2 +287,3 @@ }; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: (...args: any[]) => any; | ||
@@ -255,2 +304,3 @@ }; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: (...args: any[]) => any; | ||
@@ -277,2 +327,3 @@ }; | ||
helpers: { | ||
httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpResponse | IN8nHttpFullResponse>; | ||
[key: string]: (...args: any[]) => any; | ||
@@ -313,5 +364,6 @@ }; | ||
export interface INodeExecutionData { | ||
[key: string]: IDataObject | IBinaryKeyData | undefined; | ||
[key: string]: IDataObject | IBinaryKeyData | NodeApiError | NodeOperationError | undefined; | ||
json: IDataObject; | ||
binary?: IBinaryKeyData; | ||
error?: NodeApiError | NodeOperationError; | ||
} | ||
@@ -351,6 +403,6 @@ export interface INodeExecuteFunctions { | ||
hide?: { | ||
[key: string]: NodeParameterValue[]; | ||
[key: string]: NodeParameterValue[] | undefined; | ||
}; | ||
show?: { | ||
[key: string]: NodeParameterValue[]; | ||
[key: string]: NodeParameterValue[] | undefined; | ||
}; | ||
@@ -415,2 +467,10 @@ } | ||
} | ||
export interface INodeVersionedType { | ||
nodeVersions: { | ||
[key: number]: INodeType; | ||
}; | ||
currentVersion: number; | ||
description: INodeTypeBaseDescription; | ||
getNodeType: (version?: number) => INodeType; | ||
} | ||
export interface NodeCredentialTestResult { | ||
@@ -456,3 +516,3 @@ status: 'OK' | 'Error'; | ||
} | ||
export interface INodeTypeDescription { | ||
export interface INodeTypeBaseDescription { | ||
displayName: string; | ||
@@ -462,6 +522,11 @@ name: string; | ||
group: string[]; | ||
description: string; | ||
documentationUrl?: string; | ||
subtitle?: string; | ||
defaultVersion?: number; | ||
codex?: CodexData; | ||
} | ||
export interface INodeTypeDescription extends INodeTypeBaseDescription { | ||
version: number; | ||
description: string; | ||
defaults: INodeParameters; | ||
documentationUrl?: string; | ||
inputs: string[]; | ||
@@ -475,3 +540,2 @@ inputNames?: string[]; | ||
polling?: boolean; | ||
subtitle?: string; | ||
hooks?: { | ||
@@ -483,3 +547,2 @@ [key: string]: INodeHookDescription[] | undefined; | ||
webhooks?: IWebhookDescription[]; | ||
codex?: CodexData; | ||
} | ||
@@ -543,8 +606,9 @@ export interface INodeHookDescription { | ||
init(nodeTypes?: INodeTypeData): Promise<void>; | ||
getAll(): INodeType[]; | ||
getByName(nodeType: string): INodeType | undefined; | ||
getAll(): Array<INodeType | INodeVersionedType>; | ||
getByName(nodeType: string): INodeType | INodeVersionedType | undefined; | ||
getByNameAndVersion(nodeType: string, version?: number): INodeType | undefined; | ||
} | ||
export interface INodeTypeData { | ||
[key: string]: { | ||
type: INodeType; | ||
type: INodeType | INodeVersionedType; | ||
sourcePath: string; | ||
@@ -668,1 +732,20 @@ }; | ||
}; | ||
export declare type AllEntities<M> = M extends { | ||
[key: string]: string; | ||
} ? Entity<M, keyof M> : never; | ||
export declare type Entity<M, K> = K extends keyof M ? { | ||
resource: K; | ||
operation: M[K]; | ||
} : never; | ||
export declare type PropertiesOf<M extends { | ||
resource: string; | ||
operation: string; | ||
}> = Array<Omit<INodeProperties, 'displayOptions'> & { | ||
displayOptions?: { | ||
[key in 'show' | 'hide']?: { | ||
resource?: Array<M['resource']>; | ||
operation?: Array<M['operation']>; | ||
[otherKey: string]: NodeParameterValue[] | undefined; | ||
}; | ||
}; | ||
}>; |
@@ -1,97 +0,4 @@ | ||
import { IContextObject, INode, INodeCredentialDescription, INodeExecutionData, INodeIssues, INodeParameters, INodeProperties, INodeType, IParameterDependencies, IRunExecutionData, IWebhookData, IWorkflowExecuteAdditionalData, NodeParameterValue } from './Interfaces'; | ||
import { IContextObject, INode, INodeCredentialDescription, INodeExecutionData, INodeIssues, INodeParameters, INodeProperties, INodeType, INodeVersionedType, IParameterDependencies, IRunExecutionData, IWebhookData, IWorkflowExecuteAdditionalData, NodeParameterValue } from './Interfaces'; | ||
import { Workflow } from './Workflow'; | ||
export declare function getSpecialNodeParameters(nodeType: INodeType): { | ||
displayName: string; | ||
name: string; | ||
type: string; | ||
typeOptions: { | ||
multipleValues: boolean; | ||
multipleValueButtonText: string; | ||
}; | ||
default: {}; | ||
description: string; | ||
placeholder: string; | ||
options: { | ||
name: string; | ||
displayName: string; | ||
values: ({ | ||
displayName: string; | ||
name: string; | ||
type: string; | ||
options: { | ||
name: string; | ||
value: string; | ||
}[]; | ||
default: string; | ||
description: string; | ||
typeOptions?: undefined; | ||
displayOptions?: undefined; | ||
} | { | ||
displayName: string; | ||
name: string; | ||
type: string; | ||
typeOptions: { | ||
minValue: number; | ||
maxValue: number; | ||
}; | ||
displayOptions: { | ||
hide: { | ||
mode: string[]; | ||
}; | ||
show?: undefined; | ||
}; | ||
default: number; | ||
description: string; | ||
options?: undefined; | ||
} | { | ||
displayName: string; | ||
name: string; | ||
type: string; | ||
displayOptions: { | ||
show: { | ||
mode: string[]; | ||
}; | ||
hide?: undefined; | ||
}; | ||
typeOptions: { | ||
minValue: number; | ||
maxValue: number; | ||
}; | ||
default: number; | ||
description: string; | ||
options?: undefined; | ||
} | { | ||
displayName: string; | ||
name: string; | ||
type: string; | ||
displayOptions: { | ||
show: { | ||
mode: string[]; | ||
}; | ||
hide?: undefined; | ||
}; | ||
options: { | ||
name: string; | ||
value: string; | ||
}[]; | ||
default: string; | ||
description: string; | ||
typeOptions?: undefined; | ||
} | { | ||
displayName: string; | ||
name: string; | ||
type: string; | ||
displayOptions: { | ||
show: { | ||
mode: string[]; | ||
}; | ||
hide?: undefined; | ||
}; | ||
default: string; | ||
description: string; | ||
options?: undefined; | ||
typeOptions?: undefined; | ||
})[]; | ||
}[]; | ||
}[]; | ||
export declare function getSpecialNodeParameters(nodeType: INodeType): INodeProperties[]; | ||
export declare function displayParameter(nodeValues: INodeParameters, parameter: INodeProperties | INodeCredentialDescription, nodeValuesRoot?: INodeParameters): boolean; | ||
@@ -115,1 +22,4 @@ export declare function displayParameterPath(nodeValues: INodeParameters, parameter: INodeProperties | INodeCredentialDescription, path: string): boolean; | ||
export declare function mergeNodeProperties(mainProperties: INodeProperties[], addProperties: INodeProperties[]): void; | ||
export declare function getVersionedTypeNode(object: INodeVersionedType | INodeType, version?: number): INodeType; | ||
export declare function getVersionedTypeNodeAll(object: INodeVersionedType | INodeType): INodeType[]; | ||
export declare function isNodeTypeVersioned(object: INodeVersionedType | INodeType): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mergeNodeProperties = exports.mergeIssues = exports.getParameterIssues = exports.getParameterValueByPath = exports.addToIssuesIfMissing = exports.nodeIssuesToString = exports.getNodeParametersIssues = exports.getNodeWebhookUrl = exports.getNodeWebhookPath = exports.getNodeWebhooksBasic = exports.getNodeWebhooks = exports.prepareOutputData = exports.getNodeParameters = exports.getParamterResolveOrder = exports.getParamterDependencies = exports.getContext = exports.displayParameterPath = exports.displayParameter = exports.getSpecialNodeParameters = void 0; | ||
exports.isNodeTypeVersioned = exports.getVersionedTypeNodeAll = exports.getVersionedTypeNode = exports.mergeNodeProperties = exports.mergeIssues = exports.getParameterIssues = exports.getParameterValueByPath = exports.addToIssuesIfMissing = exports.nodeIssuesToString = exports.getNodeParametersIssues = exports.getNodeWebhookUrl = exports.getNodeWebhookPath = exports.getNodeWebhooksBasic = exports.getNodeWebhooks = exports.prepareOutputData = exports.getNodeParameters = exports.getParamterResolveOrder = exports.getParamterDependencies = exports.getContext = exports.displayParameterPath = exports.displayParameter = exports.getSpecialNodeParameters = void 0; | ||
const lodash_1 = require("lodash"); | ||
@@ -535,3 +535,3 @@ function getSpecialNodeParameters(nodeType) { | ||
} | ||
const nodeType = workflow.nodeTypes.getByName(node.type); | ||
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType.description.webhooks === undefined) { | ||
@@ -588,3 +588,3 @@ return []; | ||
} | ||
const nodeType = workflow.nodeTypes.getByName(node.type); | ||
const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType.description.webhooks === undefined) { | ||
@@ -832,2 +832,23 @@ return []; | ||
exports.mergeNodeProperties = mergeNodeProperties; | ||
function getVersionedTypeNode(object, version) { | ||
if (isNodeTypeVersioned(object)) { | ||
return object.getNodeType(version); | ||
} | ||
return object; | ||
} | ||
exports.getVersionedTypeNode = getVersionedTypeNode; | ||
function getVersionedTypeNodeAll(object) { | ||
if (isNodeTypeVersioned(object)) { | ||
return Object.values(object.nodeVersions).map((element) => { | ||
element.description.name = object.description.name; | ||
return element; | ||
}); | ||
} | ||
return [object]; | ||
} | ||
exports.getVersionedTypeNodeAll = getVersionedTypeNodeAll; | ||
function isNodeTypeVersioned(object) { | ||
return !!('getNodeType' in object); | ||
} | ||
exports.isNodeTypeVersioned = isNodeTypeVersioned; | ||
//# sourceMappingURL=NodeHelpers.js.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
this.nodes[node.name] = node; | ||
nodeType = this.nodeTypes.getByName(node.type); | ||
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -80,3 +80,3 @@ continue; | ||
} | ||
nodeType = this.nodeTypes.getByName(node.type); | ||
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -104,3 +104,3 @@ continue; | ||
} | ||
nodeType = this.nodeTypes.getByName(node.type); | ||
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -157,3 +157,3 @@ nodeIssues = { | ||
} | ||
nodeType = this.nodeTypes.getByName(node.type); | ||
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType !== undefined && checkFunction(nodeType)) { | ||
@@ -322,3 +322,3 @@ returnNodes.push(node); | ||
} | ||
const nodeType = this.nodeTypes.getByName(node.type); | ||
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType.description.outputs.length === 1) { | ||
@@ -365,3 +365,3 @@ return 0; | ||
node = this.nodes[nodeName]; | ||
nodeType = this.nodeTypes.getByName(node.type); | ||
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType.trigger !== undefined || nodeType.poll !== undefined) { | ||
@@ -399,3 +399,3 @@ if (node.disabled === true) { | ||
const node = this.getNode(webhookData.node); | ||
const nodeType = this.nodeTypes.getByName(node.type); | ||
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType.webhookMethods === undefined) { | ||
@@ -415,3 +415,3 @@ return; | ||
const triggerFunctions = getTriggerFunctions(this, node, additionalData, mode, activation); | ||
const nodeType = this.nodeTypes.getByName(node.type); | ||
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -435,3 +435,3 @@ throw new Error(`The node type "${node.type}" of node "${node.name}" is not known.`); | ||
async runPoll(node, pollFunctions) { | ||
const nodeType = this.nodeTypes.getByName(node.type); | ||
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -446,3 +446,3 @@ throw new Error(`The node type "${node.type}" of node "${node.name}" is not known.`); | ||
async runWebhook(webhookData, node, additionalData, nodeExecuteFunctions, mode) { | ||
const nodeType = this.nodeTypes.getByName(node.type); | ||
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -467,3 +467,3 @@ throw new Error(`The type of the webhook node "${node.name}" is not known.`); | ||
} | ||
const nodeType = this.nodeTypes.getByName(node.type); | ||
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion); | ||
if (nodeType === undefined) { | ||
@@ -470,0 +470,0 @@ throw new Error(`Node type "${node.type}" is not known so can not run it!`); |
@@ -10,4 +10,5 @@ import { INodeType, INodeTypeData, INodeTypes } from '../src'; | ||
getByName(nodeType: string): INodeType; | ||
getByNameAndVersion(nodeType: string, version?: number): INodeType; | ||
} | ||
export declare function NodeTypes(): NodeTypesClass; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NodeTypes = void 0; | ||
const src_1 = require("../src"); | ||
class NodeTypesClass { | ||
@@ -94,7 +95,10 @@ constructor() { | ||
getAll() { | ||
return Object.values(this.nodeTypes).map((data) => data.type); | ||
return Object.values(this.nodeTypes).map((data) => src_1.NodeHelpers.getVersionedTypeNode(data.type)); | ||
} | ||
getByName(nodeType) { | ||
return this.nodeTypes[nodeType].type; | ||
return this.getByNameAndVersion(nodeType); | ||
} | ||
getByNameAndVersion(nodeType, version) { | ||
return src_1.NodeHelpers.getVersionedTypeNode(this.nodeTypes[nodeType].type, version); | ||
} | ||
} | ||
@@ -101,0 +105,0 @@ let nodeTypesInstance; |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.69.0", | ||
"version": "0.70.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 not supported yet
465994
7326