mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Centralize SSH Tunnel management (#9906)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
committed by
GitHub
parent
86018aa6e0
commit
85aa560a5d
@@ -8,6 +8,7 @@ import type { SecureContextOptions } from 'tls';
|
||||
import type { Readable } from 'stream';
|
||||
import type { URLSearchParams } from 'url';
|
||||
import type { RequestBodyMatcher } from 'nock';
|
||||
import type { Client as SSHClient } from 'ssh2';
|
||||
|
||||
import type { AuthenticationMethod } from './Authentication';
|
||||
import type { CODE_EXECUTION_MODES, CODE_LANGUAGES, LOG_LEVELS } from './Constants';
|
||||
@@ -717,7 +718,7 @@ export type ICredentialTestFunction = (
|
||||
) => Promise<INodeCredentialTestResult>;
|
||||
|
||||
export interface ICredentialTestFunctions {
|
||||
helpers: {
|
||||
helpers: SSHTunnelFunctions & {
|
||||
request: (uriOrObject: string | object, options?: object) => Promise<any>;
|
||||
};
|
||||
}
|
||||
@@ -816,6 +817,28 @@ export interface RequestHelperFunctions {
|
||||
): Promise<any>;
|
||||
}
|
||||
|
||||
export type SSHCredentials = {
|
||||
sshHost: string;
|
||||
sshPort: number;
|
||||
sshUser: string;
|
||||
} & (
|
||||
| {
|
||||
sshAuthenticateWith: 'password';
|
||||
sshPassword: string;
|
||||
}
|
||||
| {
|
||||
sshAuthenticateWith: 'privateKey';
|
||||
// TODO: rename this to `sshPrivateKey`
|
||||
privateKey: string;
|
||||
// TODO: rename this to `sshPassphrase`
|
||||
passphrase?: string;
|
||||
}
|
||||
);
|
||||
|
||||
export interface SSHTunnelFunctions {
|
||||
getSSHClient(credentials: SSHCredentials): Promise<SSHClient>;
|
||||
}
|
||||
|
||||
export type NodeTypeAndVersion = {
|
||||
name: string;
|
||||
type: string;
|
||||
@@ -899,6 +922,7 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
|
||||
BaseHelperFunctions &
|
||||
BinaryHelperFunctions &
|
||||
FileSystemHelperFunctions &
|
||||
SSHTunnelFunctions &
|
||||
JsonHelperFunctions & {
|
||||
normalizeItems(items: INodeExecutionData | INodeExecutionData[]): INodeExecutionData[];
|
||||
constructExecutionMetaData(
|
||||
@@ -948,7 +972,7 @@ export interface ILoadOptionsFunctions extends FunctionsBase {
|
||||
options?: IGetNodeParameterOptions,
|
||||
): NodeParameterValueType | object | undefined;
|
||||
getCurrentNodeParameters(): INodeParameters | undefined;
|
||||
helpers: RequestHelperFunctions;
|
||||
helpers: RequestHelperFunctions & SSHTunnelFunctions;
|
||||
}
|
||||
|
||||
export interface IPollFunctions
|
||||
@@ -986,6 +1010,7 @@ export interface ITriggerFunctions
|
||||
helpers: RequestHelperFunctions &
|
||||
BaseHelperFunctions &
|
||||
BinaryHelperFunctions &
|
||||
SSHTunnelFunctions &
|
||||
JsonHelperFunctions;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user