2021-08-29 11:58:11 -07:00
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
|
|
/* eslint-disable import/no-cycle */
|
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
|
|
// eslint-disable-next-line max-classes-per-file
|
|
|
|
import * as express from 'express';
|
2021-09-21 10:38:24 -07:00
|
|
|
import * as FormData from 'form-data';
|
|
|
|
import { URLSearchParams } from 'url';
|
2021-11-05 09:45:51 -07:00
|
|
|
import { IDeferredPromise } from './DeferredPromise';
|
2019-06-23 03:35:23 -07:00
|
|
|
import { Workflow } from './Workflow';
|
2019-12-19 14:07:55 -08:00
|
|
|
import { WorkflowHooks } from './WorkflowHooks';
|
2021-04-16 09:33:36 -07:00
|
|
|
import { WorkflowOperationError } from './WorkflowErrors';
|
|
|
|
import { NodeApiError, NodeOperationError } from './NodeErrors';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface IAdditionalCredentialOptions {
|
|
|
|
oauth2?: IOAuth2Options;
|
|
|
|
credentialsDecrypted?: ICredentialsDecrypted;
|
|
|
|
}
|
|
|
|
|
2021-08-29 11:58:11 -07:00
|
|
|
export type IAllExecuteFunctions =
|
|
|
|
| IExecuteFunctions
|
2022-02-05 13:55:43 -08:00
|
|
|
| IExecutePaginationFunctions
|
2021-08-29 11:58:11 -07:00
|
|
|
| IExecuteSingleFunctions
|
|
|
|
| IHookFunctions
|
|
|
|
| ILoadOptionsFunctions
|
|
|
|
| IPollFunctions
|
|
|
|
| ITriggerFunctions
|
|
|
|
| IWebhookFunctions;
|
2020-01-13 18:46:58 -08:00
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface IBinaryData {
|
|
|
|
[key: string]: string | undefined;
|
|
|
|
data: string;
|
|
|
|
mimeType: string;
|
|
|
|
fileName?: string;
|
2021-03-18 10:13:24 -07:00
|
|
|
directory?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
fileExtension?: string;
|
2021-12-23 13:29:04 -08:00
|
|
|
id?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2020-07-25 10:58:38 -07:00
|
|
|
export interface IOAuth2Options {
|
|
|
|
includeCredentialsOnRefreshOnBody?: boolean;
|
|
|
|
property?: string;
|
|
|
|
tokenType?: string;
|
2020-09-16 00:16:06 -07:00
|
|
|
keepBearer?: boolean;
|
2021-02-21 23:49:00 -08:00
|
|
|
tokenExpiredStatusCode?: number;
|
2020-07-25 10:58:38 -07:00
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
export interface IConnection {
|
|
|
|
// The node the connection is to
|
|
|
|
node: string;
|
|
|
|
|
|
|
|
// The type of the input on destination node (for example "main")
|
|
|
|
type: string;
|
|
|
|
|
|
|
|
// The output/input-index of destination node (if node has multiple inputs/outputs of the same type)
|
|
|
|
index: number;
|
|
|
|
}
|
|
|
|
|
2021-04-16 09:33:36 -07:00
|
|
|
export type ExecutionError = WorkflowOperationError | NodeOperationError | NodeApiError;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
// Get used to gives nodes access to credentials
|
|
|
|
export interface IGetCredentials {
|
2021-10-13 15:21:00 -07:00
|
|
|
get(type: string, id: string | null): Promise<ICredentialsEncrypted>;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
export abstract class ICredentials {
|
2021-10-13 15:21:00 -07:00
|
|
|
id?: string;
|
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
name: string;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
type: string;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
data: string | undefined;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
nodesAccess: ICredentialNodeAccess[];
|
|
|
|
|
2021-10-13 15:21:00 -07:00
|
|
|
constructor(
|
|
|
|
nodeCredentials: INodeCredentialsDetails,
|
|
|
|
type: string,
|
|
|
|
nodesAccess: ICredentialNodeAccess[],
|
|
|
|
data?: string,
|
|
|
|
) {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
|
|
this.id = nodeCredentials.id || undefined;
|
|
|
|
this.name = nodeCredentials.name;
|
2020-01-25 23:48:38 -08:00
|
|
|
this.type = type;
|
|
|
|
this.nodesAccess = nodesAccess;
|
|
|
|
this.data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract getData(encryptionKey: string, nodeType?: string): ICredentialDataDecryptedObject;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
abstract getDataKey(key: string, encryptionKey: string, nodeType?: string): CredentialInformation;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
abstract getDataToSave(): ICredentialsEncrypted;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
abstract hasNodeAccess(nodeType: string): boolean;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
abstract setData(data: ICredentialDataDecryptedObject, encryptionKey: string): void;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
abstract setDataKey(key: string, data: CredentialInformation, encryptionKey: string): void;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
// Defines which nodes are allowed to access the credentials and
|
|
|
|
// when that access got grented from which user
|
|
|
|
export interface ICredentialNodeAccess {
|
|
|
|
nodeType: string;
|
|
|
|
user?: string;
|
2019-07-22 11:29:06 -07:00
|
|
|
date?: Date;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICredentialsDecrypted {
|
2021-10-13 15:21:00 -07:00
|
|
|
id: string | number;
|
2019-06-23 03:35:23 -07:00
|
|
|
name: string;
|
|
|
|
type: string;
|
|
|
|
nodesAccess: ICredentialNodeAccess[];
|
|
|
|
data?: ICredentialDataDecryptedObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICredentialsEncrypted {
|
2021-10-13 15:21:00 -07:00
|
|
|
id?: string | number;
|
2019-06-23 03:35:23 -07:00
|
|
|
name: string;
|
|
|
|
type: string;
|
|
|
|
nodesAccess: ICredentialNodeAccess[];
|
|
|
|
data?: string;
|
|
|
|
}
|
|
|
|
|
2021-01-24 04:33:57 -08:00
|
|
|
export interface ICredentialsExpressionResolveValues {
|
|
|
|
connectionInputData: INodeExecutionData[];
|
|
|
|
itemIndex: number;
|
|
|
|
node: INode;
|
|
|
|
runExecutionData: IRunExecutionData | null;
|
|
|
|
runIndex: number;
|
|
|
|
workflow: Workflow;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
// Simplified options of request library
|
|
|
|
export interface IRequestOptionsSimplified {
|
|
|
|
auth?: {
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
};
|
|
|
|
body: IDataObject;
|
|
|
|
headers: IDataObject;
|
|
|
|
qs: IDataObject;
|
|
|
|
}
|
|
|
|
|
2020-01-25 23:48:38 -08:00
|
|
|
export abstract class ICredentialsHelper {
|
|
|
|
encryptionKey: string;
|
|
|
|
|
2021-08-20 09:57:30 -07:00
|
|
|
constructor(encryptionKey: string) {
|
2020-01-25 23:48:38 -08:00
|
|
|
this.encryptionKey = encryptionKey;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
abstract getParentTypes(name: string): string[];
|
|
|
|
|
|
|
|
abstract authenticate(
|
|
|
|
credentials: ICredentialDataDecryptedObject,
|
|
|
|
typeName: string,
|
|
|
|
requestOptions: IHttpRequestOptions | IRequestOptionsSimplified,
|
|
|
|
workflow: Workflow,
|
|
|
|
node: INode,
|
|
|
|
): Promise<IHttpRequestOptions>;
|
|
|
|
|
2021-10-13 15:21:00 -07:00
|
|
|
abstract getCredentials(
|
|
|
|
nodeCredentials: INodeCredentialsDetails,
|
|
|
|
type: string,
|
|
|
|
): Promise<ICredentials>;
|
2021-08-29 11:58:11 -07:00
|
|
|
|
|
|
|
abstract getDecrypted(
|
2021-10-13 15:21:00 -07:00
|
|
|
nodeCredentials: INodeCredentialsDetails,
|
2021-08-29 11:58:11 -07:00
|
|
|
type: string,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
raw?: boolean,
|
|
|
|
expressionResolveValues?: ICredentialsExpressionResolveValues,
|
|
|
|
): Promise<ICredentialDataDecryptedObject>;
|
|
|
|
|
|
|
|
abstract updateCredentials(
|
2021-10-13 15:21:00 -07:00
|
|
|
nodeCredentials: INodeCredentialsDetails,
|
2021-08-29 11:58:11 -07:00
|
|
|
type: string,
|
|
|
|
data: ICredentialDataDecryptedObject,
|
|
|
|
): Promise<void>;
|
2020-01-25 23:48:38 -08:00
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface IAuthenticateBase {
|
|
|
|
type: string;
|
|
|
|
properties: {
|
|
|
|
[key: string]: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAuthenticateBasicAuth extends IAuthenticateBase {
|
|
|
|
type: 'basicAuth';
|
|
|
|
properties: {
|
|
|
|
userPropertyName?: string;
|
|
|
|
passwordPropertyName?: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAuthenticateBearer extends IAuthenticateBase {
|
|
|
|
type: 'bearer';
|
|
|
|
properties: {
|
|
|
|
tokenPropertyName?: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAuthenticateHeaderAuth extends IAuthenticateBase {
|
|
|
|
type: 'headerAuth';
|
|
|
|
properties: {
|
|
|
|
name: string;
|
|
|
|
value: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAuthenticateQueryAuth extends IAuthenticateBase {
|
|
|
|
type: 'queryAuth';
|
|
|
|
properties: {
|
|
|
|
key: string;
|
|
|
|
value: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export type IAuthenticate =
|
|
|
|
| ((
|
|
|
|
credentials: ICredentialDataDecryptedObject,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
) => Promise<IHttpRequestOptions>)
|
|
|
|
| IAuthenticateBasicAuth
|
|
|
|
| IAuthenticateBearer
|
|
|
|
| IAuthenticateHeaderAuth
|
|
|
|
| IAuthenticateQueryAuth;
|
|
|
|
|
|
|
|
export interface IAuthenticateRuleBase {
|
|
|
|
type: string;
|
|
|
|
properties: {
|
|
|
|
[key: string]: string | number;
|
|
|
|
};
|
|
|
|
errorMessage?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAuthenticateRuleResponseCode extends IAuthenticateRuleBase {
|
|
|
|
type: 'responseCode';
|
|
|
|
properties: {
|
|
|
|
value: number;
|
|
|
|
message: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICredentialTestRequest {
|
|
|
|
request: IHttpRequestOptions;
|
|
|
|
rules?: IAuthenticateRuleResponseCode[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICredentialTestRequestData {
|
|
|
|
nodeType?: INodeType;
|
|
|
|
testRequest: ICredentialTestRequest;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface ICredentialType {
|
|
|
|
name: string;
|
|
|
|
displayName: string;
|
2021-09-11 01:15:36 -07:00
|
|
|
icon?: string;
|
2020-01-13 18:46:58 -08:00
|
|
|
extends?: string[];
|
2019-06-23 03:35:23 -07:00
|
|
|
properties: INodeProperties[];
|
2020-08-17 02:58:36 -07:00
|
|
|
documentationUrl?: string;
|
2020-01-25 23:48:38 -08:00
|
|
|
__overwrittenProperties?: string[];
|
2022-02-05 13:55:43 -08:00
|
|
|
authenticate?: IAuthenticate;
|
|
|
|
test?: ICredentialTestRequest;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICredentialTypes {
|
2022-02-05 13:55:43 -08:00
|
|
|
credentialTypes?: ICredentialTypeData;
|
|
|
|
init(credentialTypes?: ICredentialTypeData): Promise<void>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getAll(): ICredentialType[];
|
|
|
|
getByName(credentialType: string): ICredentialType;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The way the credentials get saved in the database (data encrypted)
|
|
|
|
export interface ICredentialData {
|
2021-10-13 15:21:00 -07:00
|
|
|
id?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
name: string;
|
|
|
|
data: string; // Contains the access data as encrypted JSON string
|
|
|
|
nodesAccess: ICredentialNodeAccess[];
|
|
|
|
}
|
|
|
|
|
|
|
|
// The encrypted credentials which the nodes can access
|
2020-01-13 18:46:58 -08:00
|
|
|
export type CredentialInformation = string | number | boolean | IDataObject;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
// The encrypted credentials which the nodes can access
|
|
|
|
export interface ICredentialDataDecryptedObject {
|
|
|
|
[key: string]: CredentialInformation;
|
|
|
|
}
|
|
|
|
|
|
|
|
// First array index: The output/input-index (if node has multiple inputs/outputs of the same type)
|
|
|
|
// Second array index: The different connections (if one node is connected to multiple nodes)
|
|
|
|
export type NodeInputConnections = IConnection[][];
|
|
|
|
|
|
|
|
export interface INodeConnections {
|
|
|
|
// Input name
|
|
|
|
[key: string]: NodeInputConnections;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IConnections {
|
|
|
|
// Node name
|
|
|
|
[key: string]: INodeConnections;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type GenericValue = string | object | number | boolean | undefined | null;
|
|
|
|
|
|
|
|
export interface IDataObject {
|
|
|
|
[key: string]: GenericValue | IDataObject | GenericValue[] | IDataObject[];
|
|
|
|
}
|
|
|
|
|
2021-11-05 09:45:51 -07:00
|
|
|
// export type IExecuteResponsePromiseData = IDataObject;
|
|
|
|
export type IExecuteResponsePromiseData = IDataObject | IN8nHttpFullResponse;
|
|
|
|
|
2021-09-21 10:38:24 -07:00
|
|
|
export interface INodeTypeNameVersion {
|
|
|
|
name: string;
|
|
|
|
version: number;
|
|
|
|
}
|
|
|
|
|
2019-12-31 12:19:37 -08:00
|
|
|
export interface IGetExecutePollFunctions {
|
2021-08-29 11:58:11 -07:00
|
|
|
(
|
|
|
|
workflow: Workflow,
|
|
|
|
node: INode,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
activation: WorkflowActivateMode,
|
|
|
|
): IPollFunctions;
|
2019-12-31 12:19:37 -08:00
|
|
|
}
|
|
|
|
|
2019-08-08 11:38:25 -07:00
|
|
|
export interface IGetExecuteTriggerFunctions {
|
2021-08-29 11:58:11 -07:00
|
|
|
(
|
|
|
|
workflow: Workflow,
|
|
|
|
node: INode,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
activation: WorkflowActivateMode,
|
|
|
|
): ITriggerFunctions;
|
2019-08-08 11:38:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IGetExecuteFunctions {
|
2021-08-29 11:58:11 -07:00
|
|
|
(
|
|
|
|
workflow: Workflow,
|
|
|
|
runExecutionData: IRunExecutionData,
|
|
|
|
runIndex: number,
|
|
|
|
connectionInputData: INodeExecutionData[],
|
|
|
|
inputData: ITaskDataConnections,
|
|
|
|
node: INode,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
): IExecuteFunctions;
|
2019-08-08 11:38:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IGetExecuteSingleFunctions {
|
2021-08-29 11:58:11 -07:00
|
|
|
(
|
|
|
|
workflow: Workflow,
|
|
|
|
runExecutionData: IRunExecutionData,
|
|
|
|
runIndex: number,
|
|
|
|
connectionInputData: INodeExecutionData[],
|
|
|
|
inputData: ITaskDataConnections,
|
|
|
|
node: INode,
|
|
|
|
itemIndex: number,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
): IExecuteSingleFunctions;
|
2019-08-08 11:38:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IGetExecuteHookFunctions {
|
2021-08-29 11:58:11 -07:00
|
|
|
(
|
|
|
|
workflow: Workflow,
|
|
|
|
node: INode,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
activation: WorkflowActivateMode,
|
|
|
|
isTest?: boolean,
|
|
|
|
webhookData?: IWebhookData,
|
|
|
|
): IHookFunctions;
|
2019-08-08 11:38:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IGetExecuteWebhookFunctions {
|
2021-08-29 11:58:11 -07:00
|
|
|
(
|
|
|
|
workflow: Workflow,
|
|
|
|
node: INode,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
mode: WorkflowExecuteMode,
|
|
|
|
webhookData: IWebhookData,
|
|
|
|
): IWebhookFunctions;
|
2019-08-08 11:38:25 -07:00
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface IExecuteData {
|
|
|
|
data: ITaskDataConnections;
|
|
|
|
node: INode;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type IContextObject = {
|
2021-08-29 11:58:11 -07:00
|
|
|
[key: string]: any;
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
export interface IExecuteContextData {
|
|
|
|
// Keys are: "flow" | "node:<NODE_NAME>"
|
|
|
|
[key: string]: IContextObject;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export type IHttpRequestMethods = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
|
|
|
|
|
2021-09-21 10:38:24 -07:00
|
|
|
export interface IHttpRequestOptions {
|
|
|
|
url: string;
|
2022-02-05 13:55:43 -08:00
|
|
|
baseURL?: string;
|
2021-09-21 10:38:24 -07:00
|
|
|
headers?: IDataObject;
|
2022-02-05 13:55:43 -08:00
|
|
|
method?: IHttpRequestMethods;
|
2021-09-21 10:38:24 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-11-05 09:45:51 -07:00
|
|
|
export type IN8nHttpResponse = IDataObject | Buffer | GenericValue | GenericValue[] | null;
|
2021-09-21 10:38:24 -07:00
|
|
|
|
|
|
|
export interface IN8nHttpFullResponse {
|
|
|
|
body: IN8nHttpResponse;
|
|
|
|
headers: IDataObject;
|
|
|
|
statusCode: number;
|
2021-11-05 09:45:51 -07:00
|
|
|
statusMessage?: string;
|
2021-09-21 10:38:24 -07:00
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface IN8nRequestOperations {
|
|
|
|
pagination?:
|
|
|
|
| IN8nRequestOperationPaginationOffset
|
|
|
|
| ((
|
|
|
|
this: IExecutePaginationFunctions,
|
|
|
|
requestOptions: IRequestOptionsFromParameters,
|
|
|
|
) => Promise<INodeExecutionData[]>);
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IN8nRequestOperationPaginationBase {
|
|
|
|
type: string;
|
|
|
|
properties: {
|
|
|
|
[key: string]: string | number;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IN8nRequestOperationPaginationOffset extends IN8nRequestOperationPaginationBase {
|
|
|
|
type: 'offset';
|
|
|
|
properties: {
|
|
|
|
limitParameter: string;
|
|
|
|
offsetParameter: string;
|
|
|
|
pageSize: number;
|
|
|
|
rootProperty?: string; // Optional Path to option array
|
|
|
|
type: 'body' | 'query';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface IExecuteFunctions {
|
2020-03-17 05:18:04 -07:00
|
|
|
continueOnFail(): boolean;
|
2021-08-29 11:58:11 -07:00
|
|
|
evaluateExpression(
|
|
|
|
expression: string,
|
|
|
|
itemIndex: number,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
|
|
|
|
executeWorkflow(
|
|
|
|
workflowInfo: IExecuteWorkflowInfo,
|
|
|
|
inputData?: INodeExecutionData[],
|
|
|
|
): Promise<any>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getContext(type: string): IContextObject;
|
2021-08-29 11:58:11 -07:00
|
|
|
getCredentials(
|
|
|
|
type: string,
|
|
|
|
itemIndex?: number,
|
|
|
|
): Promise<ICredentialDataDecryptedObject | undefined>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData[];
|
|
|
|
getMode(): WorkflowExecuteMode;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2021-09-21 10:38:24 -07:00
|
|
|
getNodeParameter<T extends { resource: string }>(
|
|
|
|
parameterName: 'resource',
|
|
|
|
itemIndex?: number,
|
|
|
|
): T['resource'];
|
|
|
|
// getNodeParameter(parameterName: 'operation', itemIndex?: number): string;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
itemIndex: number,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
2019-09-04 05:53:39 -07:00
|
|
|
getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
|
2019-06-23 03:35:23 -07:00
|
|
|
getWorkflowStaticData(type: string): IDataObject;
|
2019-12-19 14:07:55 -08:00
|
|
|
getRestApiUrl(): string;
|
2019-06-23 03:35:23 -07:00
|
|
|
getTimezone(): string;
|
2020-04-11 01:30:50 -07:00
|
|
|
getWorkflow(): IWorkflowMetadata;
|
2021-08-29 11:58:11 -07:00
|
|
|
prepareOutputData(
|
|
|
|
outputData: INodeExecutionData[],
|
|
|
|
outputIndex?: number,
|
|
|
|
): Promise<INodeExecutionData[][]>;
|
2021-08-21 05:11:32 -07:00
|
|
|
putExecutionToWait(waitTill: Date): Promise<void>;
|
2021-11-05 09:45:51 -07:00
|
|
|
sendMessageToUI(message: any): void; // tslint:disable-line:no-any
|
|
|
|
sendResponse(response: IExecuteResponsePromiseData): void; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IExecuteSingleFunctions {
|
2020-03-17 05:18:04 -07:00
|
|
|
continueOnFail(): boolean;
|
2021-08-29 11:58:11 -07:00
|
|
|
evaluateExpression(
|
|
|
|
expression: string,
|
|
|
|
itemIndex: number | undefined,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
|
2019-06-23 03:35:23 -07:00
|
|
|
getContext(type: string): IContextObject;
|
2021-08-20 09:57:30 -07:00
|
|
|
getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData;
|
|
|
|
getMode(): WorkflowExecuteMode;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
2019-12-19 14:07:55 -08:00
|
|
|
getRestApiUrl(): string;
|
2019-06-23 03:35:23 -07:00
|
|
|
getTimezone(): string;
|
2020-04-11 01:30:50 -07:00
|
|
|
getWorkflow(): IWorkflowMetadata;
|
2019-09-04 05:53:39 -07:00
|
|
|
getWorkflowDataProxy(): IWorkflowDataProxyData;
|
2019-06-23 03:35:23 -07:00
|
|
|
getWorkflowStaticData(type: string): IDataObject;
|
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface IExecutePaginationFunctions extends IExecuteSingleFunctions {
|
|
|
|
makeRoutingRequest(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
requestOptions: IRequestOptionsFromParameters,
|
|
|
|
): Promise<INodeExecutionData[]>;
|
|
|
|
}
|
2020-01-02 15:13:53 -08:00
|
|
|
export interface IExecuteWorkflowInfo {
|
|
|
|
code?: IWorkflowBase;
|
|
|
|
id?: string;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export type ICredentialTestFunction = (
|
|
|
|
this: ICredentialTestFunctions,
|
|
|
|
credential: ICredentialsDecrypted,
|
|
|
|
) => Promise<INodeCredentialTestResult>;
|
|
|
|
|
2021-09-11 01:15:36 -07:00
|
|
|
export interface ICredentialTestFunctions {
|
|
|
|
helpers: {
|
|
|
|
[key: string]: (...args: any[]) => any;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface ILoadOptionsFunctions {
|
2021-08-20 09:57:30 -07:00
|
|
|
getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
|
|
|
getCurrentNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
):
|
|
|
|
| NodeParameterValue
|
|
|
|
| INodeParameters
|
|
|
|
| NodeParameterValue[]
|
|
|
|
| INodeParameters[]
|
|
|
|
| object
|
|
|
|
| undefined;
|
2019-10-20 12:42:34 -07:00
|
|
|
getCurrentNodeParameters(): INodeParameters | undefined;
|
2019-06-23 03:35:23 -07:00
|
|
|
getTimezone(): string;
|
2019-12-19 14:07:55 -08:00
|
|
|
getRestApiUrl(): string;
|
2019-06-23 03:35:23 -07:00
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
// TODO: Remove from here. Add it only now to LoadOptions as many nodes do import
|
|
|
|
// from n8n-workflow instead of n8n-core
|
|
|
|
requestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: any, // tslint:disable-line:no-any
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<any>;
|
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: ((...args: any[]) => any) | undefined; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IHookFunctions {
|
2021-08-20 09:57:30 -07:00
|
|
|
getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getMode(): WorkflowExecuteMode;
|
2021-03-23 11:08:47 -07:00
|
|
|
getActivationMode(): WorkflowActivateMode;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2019-06-23 03:35:23 -07:00
|
|
|
getNodeWebhookUrl: (name: string) => string | undefined;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
2019-06-23 03:35:23 -07:00
|
|
|
getTimezone(): string;
|
|
|
|
getWebhookDescription(name: string): IWebhookDescription | undefined;
|
2019-07-12 02:33:18 -07:00
|
|
|
getWebhookName(): string;
|
2020-04-11 01:30:50 -07:00
|
|
|
getWorkflow(): IWorkflowMetadata;
|
2019-06-23 03:35:23 -07:00
|
|
|
getWorkflowStaticData(type: string): IDataObject;
|
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-12-31 12:19:37 -08:00
|
|
|
export interface IPollFunctions {
|
|
|
|
__emit(data: INodeExecutionData[][]): void;
|
2021-08-20 09:57:30 -07:00
|
|
|
getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
|
2019-12-31 12:19:37 -08:00
|
|
|
getMode(): WorkflowExecuteMode;
|
2021-03-23 11:08:47 -07:00
|
|
|
getActivationMode(): WorkflowActivateMode;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
2019-12-31 12:19:37 -08:00
|
|
|
getRestApiUrl(): string;
|
|
|
|
getTimezone(): string;
|
2020-04-11 01:30:50 -07:00
|
|
|
getWorkflow(): IWorkflowMetadata;
|
2019-12-31 12:19:37 -08:00
|
|
|
getWorkflowStaticData(type: string): IDataObject;
|
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
|
2019-12-31 12:19:37 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface ITriggerFunctions {
|
2021-11-05 09:45:51 -07:00
|
|
|
emit(
|
|
|
|
data: INodeExecutionData[][],
|
|
|
|
responsePromise?: IDeferredPromise<IExecuteResponsePromiseData>,
|
|
|
|
): void;
|
2021-08-20 09:57:30 -07:00
|
|
|
getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getMode(): WorkflowExecuteMode;
|
2021-03-23 11:08:47 -07:00
|
|
|
getActivationMode(): WorkflowActivateMode;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
2019-12-19 14:07:55 -08:00
|
|
|
getRestApiUrl(): string;
|
2019-06-23 03:35:23 -07:00
|
|
|
getTimezone(): string;
|
2020-04-11 01:30:50 -07:00
|
|
|
getWorkflow(): IWorkflowMetadata;
|
2019-06-23 03:35:23 -07:00
|
|
|
getWorkflowStaticData(type: string): IDataObject;
|
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IWebhookFunctions {
|
|
|
|
getBodyData(): IDataObject;
|
2021-08-20 09:57:30 -07:00
|
|
|
getCredentials(type: string): Promise<ICredentialDataDecryptedObject | undefined>;
|
2019-06-23 03:35:23 -07:00
|
|
|
getHeaderData(): object;
|
|
|
|
getMode(): WorkflowExecuteMode;
|
2020-02-15 17:07:01 -08:00
|
|
|
getNode(): INode;
|
2021-08-29 11:58:11 -07:00
|
|
|
getNodeParameter(
|
|
|
|
parameterName: string,
|
|
|
|
fallbackValue?: any,
|
|
|
|
): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
|
2019-07-12 02:33:18 -07:00
|
|
|
getNodeWebhookUrl: (name: string) => string | undefined;
|
2021-01-23 11:00:32 -08:00
|
|
|
getParamsData(): object;
|
2019-06-23 03:35:23 -07:00
|
|
|
getQueryData(): object;
|
|
|
|
getRequestObject(): express.Request;
|
|
|
|
getResponseObject(): express.Response;
|
|
|
|
getTimezone(): string;
|
2019-07-12 02:33:18 -07:00
|
|
|
getWebhookName(): string;
|
2019-06-23 03:35:23 -07:00
|
|
|
getWorkflowStaticData(type: string): IDataObject;
|
2020-04-11 01:30:50 -07:00
|
|
|
getWorkflow(): IWorkflowMetadata;
|
2021-08-29 11:58:11 -07:00
|
|
|
prepareOutputData(
|
|
|
|
outputData: INodeExecutionData[],
|
|
|
|
outputIndex?: number,
|
|
|
|
): Promise<INodeExecutionData[][]>;
|
2019-06-23 03:35:23 -07:00
|
|
|
helpers: {
|
2021-09-21 10:38:24 -07:00
|
|
|
httpRequest(
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2022-02-05 13:55:43 -08:00
|
|
|
httpRequestWithAuthentication(
|
|
|
|
this: IAllExecuteFunctions,
|
|
|
|
credentialsType: string,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
additionalCredentialOptions?: IAdditionalCredentialOptions,
|
|
|
|
): Promise<IN8nHttpResponse | IN8nHttpFullResponse>;
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: (...args: any[]) => any; // tslint:disable-line:no-any
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-10-13 15:21:00 -07:00
|
|
|
export interface INodeCredentialsDetails {
|
|
|
|
id: string | null;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface INodeCredentials {
|
2021-10-13 15:21:00 -07:00
|
|
|
[key: string]: INodeCredentialsDetails;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface INode {
|
|
|
|
name: string;
|
|
|
|
typeVersion: number;
|
|
|
|
type: string;
|
|
|
|
position: [number, number];
|
|
|
|
disabled?: boolean;
|
2021-07-01 00:04:24 -07:00
|
|
|
notes?: string;
|
2020-05-05 08:34:12 -07:00
|
|
|
notesInFlow?: boolean;
|
2019-07-18 10:26:16 -07:00
|
|
|
retryOnFail?: boolean;
|
|
|
|
maxTries?: number;
|
|
|
|
waitBetweenTries?: number;
|
2020-04-12 10:58:30 -07:00
|
|
|
alwaysOutputData?: boolean;
|
2020-08-08 11:31:04 -07:00
|
|
|
executeOnce?: boolean;
|
2019-06-23 03:35:23 -07:00
|
|
|
continueOnFail?: boolean;
|
|
|
|
parameters: INodeParameters;
|
|
|
|
credentials?: INodeCredentials;
|
2020-06-10 07:17:16 -07:00
|
|
|
webhookId?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodes {
|
|
|
|
[key: string]: INode;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IObservableObject {
|
2021-08-29 11:58:11 -07:00
|
|
|
[key: string]: any;
|
2019-06-23 03:35:23 -07:00
|
|
|
__dataChanged: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IBinaryKeyData {
|
|
|
|
[key: string]: IBinaryData;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeExecutionData {
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: IDataObject | IBinaryKeyData | NodeApiError | NodeOperationError | undefined;
|
2019-06-23 03:35:23 -07:00
|
|
|
json: IDataObject;
|
|
|
|
binary?: IBinaryKeyData;
|
2021-09-21 10:38:24 -07:00
|
|
|
error?: NodeApiError | NodeOperationError;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeExecuteFunctions {
|
2019-12-31 12:19:37 -08:00
|
|
|
getExecutePollFunctions: IGetExecutePollFunctions;
|
2019-08-08 11:38:25 -07:00
|
|
|
getExecuteTriggerFunctions: IGetExecuteTriggerFunctions;
|
|
|
|
getExecuteFunctions: IGetExecuteFunctions;
|
|
|
|
getExecuteSingleFunctions: IGetExecuteSingleFunctions;
|
|
|
|
getExecuteHookFunctions: IGetExecuteHookFunctions;
|
|
|
|
getExecuteWebhookFunctions: IGetExecuteWebhookFunctions;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// The values a node property can have
|
2020-10-26 01:26:07 -07:00
|
|
|
export type NodeParameterValue = string | number | boolean | undefined | null;
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
export interface INodeParameters {
|
|
|
|
// TODO: Later also has to be possible to add multiple ones with the name name. So array has to be possible
|
2019-10-20 12:42:34 -07:00
|
|
|
[key: string]: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2021-08-29 11:58:11 -07:00
|
|
|
export type NodePropertyTypes =
|
|
|
|
| 'boolean'
|
|
|
|
| 'collection'
|
|
|
|
| 'color'
|
|
|
|
| 'dateTime'
|
|
|
|
| 'fixedCollection'
|
|
|
|
| 'hidden'
|
|
|
|
| 'json'
|
|
|
|
| 'notice'
|
|
|
|
| 'multiOptions'
|
|
|
|
| 'number'
|
|
|
|
| 'options'
|
|
|
|
| 'string';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2021-12-23 02:41:46 -08:00
|
|
|
export type CodeAutocompleteTypes = 'function' | 'functionItem';
|
|
|
|
|
|
|
|
export type EditorTypes = 'code' | 'json';
|
2019-09-04 09:22:06 -07:00
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface ILoadOptions {
|
|
|
|
routing?: {
|
|
|
|
operations?: IN8nRequestOperations;
|
|
|
|
output?: INodeRequestOutput;
|
|
|
|
request?: IHttpRequestOptionsFromParameters;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface INodePropertyTypeOptions {
|
|
|
|
alwaysOpenEditWindow?: boolean; // Supported by: string
|
2021-12-23 02:41:46 -08:00
|
|
|
codeAutocomplete?: CodeAutocompleteTypes; // Supported by: string
|
2021-08-29 11:58:11 -07:00
|
|
|
editor?: EditorTypes; // Supported by: string
|
|
|
|
loadOptionsDependsOn?: string[]; // Supported by: options
|
|
|
|
loadOptionsMethod?: string; // Supported by: options
|
2022-02-05 13:55:43 -08:00
|
|
|
loadOptions?: ILoadOptions; // Supported by: options
|
2021-08-29 11:58:11 -07:00
|
|
|
maxValue?: number; // Supported by: number
|
|
|
|
minValue?: number; // Supported by: number
|
|
|
|
multipleValues?: boolean; // Supported by: <All>
|
|
|
|
multipleValueButtonText?: string; // Supported when "multipleValues" set to true
|
|
|
|
numberPrecision?: number; // Supported by: number
|
|
|
|
password?: boolean; // Supported by: string
|
|
|
|
rows?: number; // Supported by: string
|
|
|
|
showAlpha?: boolean; // Supported by: color
|
|
|
|
sortable?: boolean; // Supported when "multipleValues" set to true
|
2022-02-05 13:55:43 -08:00
|
|
|
[key: string]: any;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IDisplayOptions {
|
|
|
|
hide?: {
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: NodeParameterValue[] | undefined;
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
show?: {
|
2021-09-21 10:38:24 -07:00
|
|
|
[key: string]: NodeParameterValue[] | undefined;
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeProperties {
|
|
|
|
displayName: string;
|
|
|
|
name: string;
|
|
|
|
type: NodePropertyTypes;
|
|
|
|
typeOptions?: INodePropertyTypeOptions;
|
|
|
|
default: NodeParameterValue | INodeParameters | INodeParameters[] | NodeParameterValue[];
|
|
|
|
description?: string;
|
2022-01-27 22:55:25 -08:00
|
|
|
hint?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
displayOptions?: IDisplayOptions;
|
2021-02-20 04:51:06 -08:00
|
|
|
options?: Array<INodePropertyOptions | INodeProperties | INodePropertyCollection>;
|
2019-06-23 03:35:23 -07:00
|
|
|
placeholder?: string;
|
|
|
|
isNodeSetting?: boolean;
|
|
|
|
noDataExpression?: boolean;
|
|
|
|
required?: boolean;
|
2022-02-05 13:55:43 -08:00
|
|
|
routing?: INodePropertyRouting;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
export interface INodePropertyOptions {
|
|
|
|
name: string;
|
2021-12-03 00:44:16 -08:00
|
|
|
value: string | number | boolean;
|
2019-06-23 03:35:23 -07:00
|
|
|
description?: string;
|
2022-02-05 13:55:43 -08:00
|
|
|
routing?: INodePropertyRouting;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodePropertyCollection {
|
|
|
|
displayName: string;
|
|
|
|
name: string;
|
|
|
|
values: INodeProperties[];
|
|
|
|
}
|
|
|
|
|
2019-07-13 10:50:41 -07:00
|
|
|
export interface IParameterDependencies {
|
|
|
|
[key: string]: string[];
|
|
|
|
}
|
|
|
|
|
2019-12-31 12:19:37 -08:00
|
|
|
export interface IPollResponse {
|
|
|
|
closeFunction?: () => Promise<void>;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface ITriggerResponse {
|
|
|
|
closeFunction?: () => Promise<void>;
|
|
|
|
// To manually trigger the run
|
|
|
|
manualTriggerFunction?: () => Promise<void>;
|
|
|
|
// Gets added automatically at manual workflow runs resolves with
|
|
|
|
// the first emitted data
|
|
|
|
manualTriggerResponse?: Promise<INodeExecutionData[][]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeType {
|
|
|
|
description: INodeTypeDescription;
|
|
|
|
execute?(this: IExecuteFunctions): Promise<INodeExecutionData[][] | null>;
|
|
|
|
executeSingle?(this: IExecuteSingleFunctions): Promise<INodeExecutionData>;
|
2019-12-31 12:19:37 -08:00
|
|
|
poll?(this: IPollFunctions): Promise<INodeExecutionData[][] | null>;
|
2019-06-23 03:35:23 -07:00
|
|
|
trigger?(this: ITriggerFunctions): Promise<ITriggerResponse | undefined>;
|
2019-10-11 04:02:44 -07:00
|
|
|
webhook?(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
2019-06-23 03:35:23 -07:00
|
|
|
hooks?: {
|
|
|
|
[key: string]: (this: IHookFunctions) => Promise<boolean>;
|
|
|
|
};
|
|
|
|
methods?: {
|
|
|
|
loadOptions?: {
|
|
|
|
[key: string]: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
|
2021-08-29 11:58:11 -07:00
|
|
|
};
|
2021-09-11 01:15:36 -07:00
|
|
|
credentialTest?: {
|
|
|
|
// Contains a group of functins that test credentials.
|
2022-02-05 13:55:43 -08:00
|
|
|
[functionName: string]: ICredentialTestFunction;
|
2021-09-11 01:15:36 -07:00
|
|
|
};
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
webhookMethods?: {
|
|
|
|
[key: string]: IWebhookSetupMethods;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-09-21 10:38:24 -07:00
|
|
|
export interface INodeVersionedType {
|
|
|
|
nodeVersions: {
|
|
|
|
[key: number]: INodeType;
|
|
|
|
};
|
|
|
|
currentVersion: number;
|
|
|
|
description: INodeTypeBaseDescription;
|
|
|
|
getNodeType: (version?: number) => INodeType;
|
|
|
|
}
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface INodeCredentialTestResult {
|
2021-09-11 01:15:36 -07:00
|
|
|
status: 'OK' | 'Error';
|
|
|
|
message: string;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface INodeCredentialTestRequest {
|
2021-09-11 01:15:36 -07:00
|
|
|
nodeToTestWith?: string; // node name i.e. slack
|
|
|
|
credentials: ICredentialsDecrypted;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export type WebhookSetupMethodNames = 'checkExists' | 'create' | 'delete';
|
|
|
|
|
|
|
|
export interface IWebhookSetupMethods {
|
|
|
|
[key: string]: ((this: IHookFunctions) => Promise<boolean>) | undefined;
|
|
|
|
checkExists?: (this: IHookFunctions) => Promise<boolean>;
|
|
|
|
create?: (this: IHookFunctions) => Promise<boolean>;
|
|
|
|
delete?: (this: IHookFunctions) => Promise<boolean>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeCredentialDescription {
|
|
|
|
name: string;
|
|
|
|
required?: boolean;
|
|
|
|
displayOptions?: IDisplayOptions;
|
2022-02-05 13:55:43 -08:00
|
|
|
testedBy?: ICredentialTestRequest | string; // Name of a function inside `loadOptions.credentialTest`
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export type INodeIssueTypes = 'credentials' | 'execution' | 'parameters' | 'typeUnknown';
|
|
|
|
|
|
|
|
export interface INodeIssueObjectProperty {
|
|
|
|
[key: string]: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeIssueData {
|
|
|
|
node: string;
|
|
|
|
type: INodeIssueTypes;
|
|
|
|
value: boolean | string | string[] | INodeIssueObjectProperty;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeIssues {
|
|
|
|
execution?: boolean;
|
|
|
|
credentials?: INodeIssueObjectProperty;
|
|
|
|
parameters?: INodeIssueObjectProperty;
|
|
|
|
typeUnknown?: boolean;
|
|
|
|
[key: string]: undefined | boolean | INodeIssueObjectProperty;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IWorfklowIssues {
|
|
|
|
[key: string]: INodeIssues;
|
|
|
|
}
|
|
|
|
|
2021-09-21 10:38:24 -07:00
|
|
|
export interface INodeTypeBaseDescription {
|
2019-06-23 03:35:23 -07:00
|
|
|
displayName: string;
|
|
|
|
name: string;
|
|
|
|
icon?: string;
|
|
|
|
group: string[];
|
|
|
|
description: string;
|
2020-11-09 03:23:53 -08:00
|
|
|
documentationUrl?: string;
|
2021-09-21 10:38:24 -07:00
|
|
|
subtitle?: string;
|
|
|
|
defaultVersion?: number;
|
|
|
|
codex?: CodexData;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface INodePropertyRouting {
|
|
|
|
operations?: IN8nRequestOperations; // Should be changed, does not sound right
|
|
|
|
output?: INodeRequestOutput;
|
|
|
|
request?: IHttpRequestOptionsFromParameters;
|
|
|
|
send?: INodeRequestSend;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type PostReceiveAction =
|
|
|
|
| ((
|
|
|
|
this: IExecuteSingleFunctions,
|
|
|
|
items: INodeExecutionData[],
|
|
|
|
response: IN8nHttpFullResponse,
|
|
|
|
) => Promise<INodeExecutionData[]>)
|
|
|
|
| IPostReceiveBinaryData
|
|
|
|
| IPostReceiveRootProperty
|
|
|
|
| IPostReceiveSet
|
|
|
|
| IPostReceiveSetKeyValue
|
|
|
|
| IPostReceiveSort;
|
|
|
|
|
|
|
|
export type PreSendAction = (
|
|
|
|
this: IExecuteSingleFunctions,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
) => Promise<IHttpRequestOptions>;
|
|
|
|
|
|
|
|
export interface INodeRequestOutput {
|
|
|
|
maxResults?: number | string;
|
|
|
|
postReceive?: PostReceiveAction[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeRequestSend {
|
|
|
|
preSend?: PreSendAction[];
|
|
|
|
paginate?: boolean | string; // Where should this life?
|
|
|
|
property?: string; // Maybe: propertyName, destinationProperty?
|
|
|
|
propertyInDotNotation?: boolean; // Enabled by default
|
|
|
|
type?: 'body' | 'query';
|
|
|
|
value?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IPostReceiveBase {
|
|
|
|
type: string;
|
|
|
|
properties: {
|
|
|
|
[key: string]: string | number | IDataObject;
|
|
|
|
};
|
|
|
|
errorMessage?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IPostReceiveBinaryData extends IPostReceiveBase {
|
|
|
|
type: 'binaryData';
|
|
|
|
properties: {
|
|
|
|
destinationProperty: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IPostReceiveRootProperty extends IPostReceiveBase {
|
|
|
|
type: 'rootProperty';
|
|
|
|
properties: {
|
|
|
|
property: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IPostReceiveSet extends IPostReceiveBase {
|
|
|
|
type: 'set';
|
|
|
|
properties: {
|
|
|
|
value: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IPostReceiveSetKeyValue extends IPostReceiveBase {
|
|
|
|
type: 'setKeyValue';
|
|
|
|
properties: {
|
|
|
|
[key: string]: string | number;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IPostReceiveSort extends IPostReceiveBase {
|
|
|
|
type: 'sort';
|
|
|
|
properties: {
|
|
|
|
key: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IHttpRequestOptionsFromParameters extends Partial<IHttpRequestOptions> {
|
|
|
|
url?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IRequestOptionsFromParameters {
|
|
|
|
maxResults?: number | string;
|
|
|
|
options: IHttpRequestOptionsFromParameters;
|
|
|
|
paginate?: boolean | string;
|
|
|
|
preSend: PreSendAction[];
|
|
|
|
postReceive: Array<{
|
|
|
|
data: {
|
|
|
|
parameterValue: string | IDataObject | undefined;
|
|
|
|
};
|
|
|
|
actions: PostReceiveAction[];
|
|
|
|
}>;
|
|
|
|
requestOperations?: IN8nRequestOperations;
|
|
|
|
}
|
|
|
|
|
2021-09-21 10:38:24 -07:00
|
|
|
export interface INodeTypeDescription extends INodeTypeBaseDescription {
|
|
|
|
version: number;
|
|
|
|
defaults: INodeParameters;
|
:sparkles: Improve Waiting Webhook call state in WF Canvas (#2430)
* N8N-2586 Improve Waiting Webhook call state in WF Canvas
* N8N-2586 Added watcher for showing Webhook's Node Tooltip on execution
* N8N-2586 Show helping tooltip for trigger node if wokrflow is running, it is a trigger node, if it is only one trigger node in WF
* N8N-2586 Rework/Move logic to computed property, Created getter for ActveTriggerNodesInWokrflow, Add style to trigger node's tooltip, remove comments
* N8N-2586 Added EventTriggerDescription prop in INodeTypeDescription Interface, Updated Logic for TriggerNode Tooltip based on the new prop
* N8N-2586 Add new use cases/watcher to show Trigger Nodes Tooltip / If has issues, if paused, if wokrlfow is running, Refactor Getter
* N8N-2586 Added z-index to tooltip, Added new Scenario for Tooltip if it is Draged&Droped on the WF
* N8N-2586 Refactor computed property for draged nodes
* N8N-2586 Fixed Conflicts
* N8N-2586 Fixed Tooltip
* N8N-2586 Dont show tooltip on core trigger nodes that execute automatically
* N8N-2586 Fixed Webhook tooltip when adding/deleting canvas during WF execution
* N8N-2586 Updated Logic, Simplify the code
* N8N-2586 Simplify Code
* N8N-2586 Added check for nodetype
* update dragging to use local state
* N8N-2586 Added eventTriggerDescription to Interval Node
* add comment, use new getter
* update to always check
Co-authored-by: Mutasem <mutdmour@gmail.com>
2021-11-25 14:33:41 -08:00
|
|
|
eventTriggerDescription?: string;
|
2022-01-21 09:00:00 -08:00
|
|
|
activationMessage?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
inputs: string[];
|
2019-08-02 06:56:05 -07:00
|
|
|
inputNames?: string[];
|
2019-06-23 03:35:23 -07:00
|
|
|
outputs: string[];
|
|
|
|
outputNames?: string[];
|
|
|
|
properties: INodeProperties[];
|
|
|
|
credentials?: INodeCredentialDescription[];
|
|
|
|
maxNodes?: number; // How many nodes of that type can be created in a workflow
|
2019-12-31 12:19:37 -08:00
|
|
|
polling?: boolean;
|
2022-02-05 13:55:43 -08:00
|
|
|
requestDefaults?: IHttpRequestOptionsFromParameters;
|
|
|
|
requestOperations?: IN8nRequestOperations;
|
2019-06-23 03:35:23 -07:00
|
|
|
hooks?: {
|
|
|
|
[key: string]: INodeHookDescription[] | undefined;
|
|
|
|
activate?: INodeHookDescription[];
|
|
|
|
deactivate?: INodeHookDescription[];
|
|
|
|
};
|
|
|
|
webhooks?: IWebhookDescription[];
|
2021-11-15 02:19:43 -08:00
|
|
|
translation?: { [key: string]: object };
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeHookDescription {
|
|
|
|
method: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IWebhookData {
|
|
|
|
httpMethod: WebhookHttpMethod;
|
|
|
|
node: string;
|
|
|
|
path: string;
|
|
|
|
webhookDescription: IWebhookDescription;
|
2020-01-22 15:06:43 -08:00
|
|
|
workflowId: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
workflowExecuteAdditionalData: IWorkflowExecuteAdditionalData;
|
2021-01-23 11:00:32 -08:00
|
|
|
webhookId?: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IWebhookDescription {
|
2020-06-10 06:39:15 -07:00
|
|
|
[key: string]: WebhookHttpMethod | WebhookResponseMode | boolean | string | undefined;
|
2019-06-23 03:35:23 -07:00
|
|
|
httpMethod: WebhookHttpMethod | string;
|
2020-06-10 06:39:15 -07:00
|
|
|
isFullPath?: boolean;
|
2019-06-23 03:35:23 -07:00
|
|
|
name: string;
|
|
|
|
path: string;
|
|
|
|
responseBinaryPropertyName?: string;
|
2019-10-16 05:01:39 -07:00
|
|
|
responseContentType?: string;
|
|
|
|
responsePropertyName?: string;
|
2019-08-28 08:16:09 -07:00
|
|
|
responseMode?: WebhookResponseMode | string;
|
|
|
|
responseData?: WebhookResponseData | string;
|
2021-08-21 05:11:32 -07:00
|
|
|
restartWebhook?: boolean;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2019-09-04 05:53:39 -07:00
|
|
|
export interface IWorkflowDataProxyData {
|
2021-12-23 02:41:46 -08:00
|
|
|
[key: string]: any;
|
2021-08-29 11:58:11 -07:00
|
|
|
$binary: any;
|
|
|
|
$data: any;
|
|
|
|
$env: any;
|
|
|
|
$evaluateExpression: any;
|
|
|
|
$item: any;
|
|
|
|
$items: any;
|
|
|
|
$json: any;
|
|
|
|
$node: any;
|
|
|
|
$parameter: any;
|
|
|
|
$position: any;
|
|
|
|
$workflow: any;
|
2019-09-04 05:53:39 -07:00
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export type IWorkflowDataProxyAdditionalKeys = IDataObject;
|
2021-08-21 05:11:32 -07:00
|
|
|
|
2020-02-15 17:07:01 -08:00
|
|
|
export interface IWorkflowMetadata {
|
|
|
|
id?: number | string;
|
|
|
|
name?: string;
|
|
|
|
active: boolean;
|
|
|
|
}
|
|
|
|
|
2022-02-20 01:30:01 -08:00
|
|
|
export type WebhookHttpMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'OPTIONS';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2019-10-11 04:02:44 -07:00
|
|
|
export interface IWebhookResponseData {
|
2019-06-23 03:35:23 -07:00
|
|
|
workflowData?: INodeExecutionData[][];
|
2021-08-29 11:58:11 -07:00
|
|
|
webhookResponse?: any;
|
2019-06-23 03:35:23 -07:00
|
|
|
noWebhookResponse?: boolean;
|
|
|
|
}
|
|
|
|
|
2022-02-19 03:37:41 -08:00
|
|
|
export type WebhookResponseData = 'allEntries' | 'firstEntryJson' | 'firstEntryBinary' | 'noData';
|
2019-06-23 03:35:23 -07:00
|
|
|
export type WebhookResponseMode = 'onReceived' | 'lastNode';
|
|
|
|
|
|
|
|
export interface INodeTypes {
|
2019-08-08 11:38:25 -07:00
|
|
|
nodeTypes: INodeTypeData;
|
|
|
|
init(nodeTypes?: INodeTypeData): Promise<void>;
|
2021-09-21 10:38:24 -07:00
|
|
|
getAll(): Array<INodeType | INodeVersionedType>;
|
|
|
|
getByNameAndVersion(nodeType: string, version?: number): INodeType | undefined;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2022-02-05 13:55:43 -08:00
|
|
|
export interface ICredentialTypeData {
|
|
|
|
[key: string]: {
|
|
|
|
type: ICredentialType;
|
|
|
|
sourcePath: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-08-08 11:38:25 -07:00
|
|
|
export interface INodeTypeData {
|
|
|
|
[key: string]: {
|
2021-09-21 10:38:24 -07:00
|
|
|
type: INodeType | INodeVersionedType;
|
2019-08-08 11:38:25 -07:00
|
|
|
sourcePath: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface IRun {
|
|
|
|
data: IRunExecutionData;
|
|
|
|
finished?: boolean;
|
|
|
|
mode: WorkflowExecuteMode;
|
2021-08-21 05:11:32 -07:00
|
|
|
waitTill?: Date;
|
2019-07-22 11:29:06 -07:00
|
|
|
startedAt: Date;
|
2021-02-08 23:59:32 -08:00
|
|
|
stoppedAt?: Date;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Contains all the data which is needed to execute a workflow and so also to
|
|
|
|
// start restart it again after it did fail.
|
|
|
|
// The RunData, ExecuteData and WaitForExecution contain often the same data.
|
|
|
|
export interface IRunExecutionData {
|
|
|
|
startData?: {
|
|
|
|
destinationNode?: string;
|
|
|
|
runNodeFilter?: string[];
|
|
|
|
};
|
|
|
|
resultData: {
|
2021-04-16 09:33:36 -07:00
|
|
|
error?: ExecutionError;
|
2019-06-23 03:35:23 -07:00
|
|
|
runData: IRunData;
|
|
|
|
lastNodeExecuted?: string;
|
|
|
|
};
|
|
|
|
executionData?: {
|
|
|
|
contextData: IExecuteContextData;
|
|
|
|
nodeExecutionStack: IExecuteData[];
|
|
|
|
waitingExecution: IWaitingForExecution;
|
|
|
|
};
|
2021-08-21 05:11:32 -07:00
|
|
|
waitTill?: Date;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IRunData {
|
|
|
|
// node-name: result-data
|
|
|
|
[key: string]: ITaskData[];
|
|
|
|
}
|
|
|
|
|
|
|
|
// The data that gets returned when a node runs
|
|
|
|
export interface ITaskData {
|
|
|
|
startTime: number;
|
|
|
|
executionTime: number;
|
|
|
|
data?: ITaskDataConnections;
|
2021-04-16 09:33:36 -07:00
|
|
|
error?: ExecutionError;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// The data for al the different kind of connectons (like main) and all the indexes
|
|
|
|
export interface ITaskDataConnections {
|
|
|
|
// Key for each input type and because there can be multiple inputs of the same type it is an array
|
|
|
|
// null is also allowed because if we still need data for a later while executing the workflow set teompoary to null
|
|
|
|
// the nodes get as input TaskDataConnections which is identical to this one except that no null is allowed.
|
|
|
|
[key: string]: Array<INodeExecutionData[] | null>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Keeps data while workflow gets executed and allows when provided to restart execution
|
|
|
|
export interface IWaitingForExecution {
|
|
|
|
// Node name
|
|
|
|
[key: string]: {
|
|
|
|
// Run index
|
2021-08-29 11:58:11 -07:00
|
|
|
[key: number]: ITaskDataConnections;
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-12-19 14:07:55 -08:00
|
|
|
export interface IWorkflowBase {
|
2021-08-29 11:58:11 -07:00
|
|
|
id?: number | string | any;
|
2019-12-19 14:07:55 -08:00
|
|
|
name: string;
|
|
|
|
active: boolean;
|
|
|
|
createdAt: Date;
|
|
|
|
updatedAt: Date;
|
|
|
|
nodes: INode[];
|
|
|
|
connections: IConnections;
|
|
|
|
settings?: IWorkflowSettings;
|
|
|
|
staticData?: IDataObject;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface IWorkflowCredentials {
|
2021-10-13 15:21:00 -07:00
|
|
|
[credentialType: string]: {
|
|
|
|
[id: string]: ICredentialsEncrypted;
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IWorkflowExecuteHooks {
|
2021-08-29 11:58:11 -07:00
|
|
|
[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>>;
|
2021-11-05 09:45:51 -07:00
|
|
|
sendResponse?: Array<(response: IExecuteResponsePromiseData) => Promise<void>>;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IWorkflowExecuteAdditionalData {
|
2020-01-25 23:48:38 -08:00
|
|
|
credentialsHelper: ICredentialsHelper;
|
2019-06-23 03:35:23 -07:00
|
|
|
encryptionKey: string;
|
2021-08-29 11:58:11 -07:00
|
|
|
executeWorkflow: (
|
|
|
|
workflowInfo: IExecuteWorkflowInfo,
|
|
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
|
|
inputData?: INodeExecutionData[],
|
|
|
|
parentExecutionId?: string,
|
|
|
|
loadedWorkflowData?: IWorkflowBase,
|
|
|
|
loadedRunData?: any,
|
|
|
|
) => Promise<any>;
|
2019-12-19 14:07:55 -08:00
|
|
|
// hooks?: IWorkflowExecuteHooks;
|
2021-08-21 05:11:32 -07:00
|
|
|
executionId?: string;
|
2019-12-19 14:07:55 -08:00
|
|
|
hooks?: WorkflowHooks;
|
2019-06-23 03:35:23 -07:00
|
|
|
httpResponse?: express.Response;
|
|
|
|
httpRequest?: express.Request;
|
2019-12-19 14:07:55 -08:00
|
|
|
restApiUrl: string;
|
2021-08-29 11:58:11 -07:00
|
|
|
sendMessageToUI?: (source: string, message: any) => void;
|
2019-06-23 03:35:23 -07:00
|
|
|
timezone: string;
|
|
|
|
webhookBaseUrl: string;
|
2021-08-21 05:11:32 -07:00
|
|
|
webhookWaitingBaseUrl: string;
|
2019-06-23 03:35:23 -07:00
|
|
|
webhookTestBaseUrl: string;
|
2021-02-20 04:51:06 -08:00
|
|
|
currentNodeParameters?: INodeParameters;
|
2021-04-17 07:44:07 -07:00
|
|
|
executionTimeoutTimestamp?: number;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
2021-08-29 11:58:11 -07:00
|
|
|
export type WorkflowExecuteMode =
|
|
|
|
| 'cli'
|
|
|
|
| 'error'
|
|
|
|
| 'integrated'
|
|
|
|
| 'internal'
|
|
|
|
| 'manual'
|
|
|
|
| 'retry'
|
|
|
|
| 'trigger'
|
|
|
|
| 'webhook';
|
2021-03-23 11:08:47 -07:00
|
|
|
export type WorkflowActivateMode = 'init' | 'create' | 'update' | 'activate' | 'manual';
|
2019-12-19 14:07:55 -08:00
|
|
|
|
|
|
|
export interface IWorkflowHooksOptionalParameters {
|
|
|
|
parentProcessMode?: string;
|
|
|
|
retryOf?: string;
|
|
|
|
sessionId?: string;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export interface IWorkflowSettings {
|
|
|
|
[key: string]: IDataObject | string | number | boolean | undefined;
|
|
|
|
}
|
2021-04-16 09:33:36 -07:00
|
|
|
|
2021-05-01 20:43:01 -07:00
|
|
|
export type LogTypes = 'debug' | 'verbose' | 'info' | 'warn' | 'error';
|
|
|
|
|
|
|
|
export interface ILogger {
|
|
|
|
log: (type: LogTypes, message: string, meta?: object) => void;
|
|
|
|
debug: (message: string, meta?: object) => void;
|
|
|
|
verbose: (message: string, meta?: object) => void;
|
|
|
|
info: (message: string, meta?: object) => void;
|
|
|
|
warn: (message: string, meta?: object) => void;
|
|
|
|
error: (message: string, meta?: object) => void;
|
|
|
|
}
|
2021-04-16 09:33:36 -07:00
|
|
|
|
|
|
|
export interface IStatusCodeMessages {
|
|
|
|
[key: string]: string;
|
|
|
|
}
|
2021-06-12 08:15:23 -07:00
|
|
|
|
2021-06-17 22:58:26 -07:00
|
|
|
export type CodexData = {
|
|
|
|
categories?: string[];
|
2021-08-29 11:58:11 -07:00
|
|
|
subcategories?: { [category: string]: string[] };
|
2021-06-17 22:58:26 -07:00
|
|
|
alias?: string[];
|
|
|
|
};
|
|
|
|
|
2021-06-12 08:15:23 -07:00
|
|
|
export type JsonValue = string | number | boolean | null | JsonObject | JsonValue[];
|
|
|
|
|
|
|
|
export type JsonObject = { [key: string]: JsonValue };
|
2021-09-21 10:38:24 -07:00
|
|
|
|
|
|
|
export type AllEntities<M> = M extends { [key: string]: string } ? Entity<M, keyof M> : never;
|
|
|
|
|
|
|
|
export type Entity<M, K> = K extends keyof M ? { resource: K; operation: M[K] } : never;
|
|
|
|
|
|
|
|
export 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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
>;
|
2021-10-18 20:57:49 -07:00
|
|
|
|
|
|
|
// Telemetry
|
|
|
|
|
|
|
|
export interface INodesGraph {
|
|
|
|
node_types: string[];
|
|
|
|
node_connections: IDataObject[];
|
|
|
|
nodes: INodesGraphNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodesGraphNode {
|
|
|
|
[key: string]: INodeGraphItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeGraphItem {
|
|
|
|
type: string;
|
|
|
|
resource?: string;
|
|
|
|
operation?: string;
|
|
|
|
domain?: string;
|
2022-01-07 08:14:59 -08:00
|
|
|
position: [number, number];
|
|
|
|
mode?: string;
|
2021-10-18 20:57:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodeNameIndex {
|
|
|
|
[name: string]: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface INodesGraphResult {
|
|
|
|
nodeGraph: INodesGraph;
|
|
|
|
nameIndices: INodeNameIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITelemetryClientConfig {
|
|
|
|
url: string;
|
|
|
|
key: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITelemetrySettings {
|
|
|
|
enabled: boolean;
|
|
|
|
config?: ITelemetryClientConfig;
|
|
|
|
}
|