feat(Postgres Node): Options keepAlive and keepAliveInitialDelayMillis (#9067)

This commit is contained in:
Michael Kret
2024-04-09 18:41:51 +03:00
committed by GitHub
parent c2f4d7d796
commit 58518b684b
16 changed files with 136 additions and 31 deletions

View File

@@ -1,20 +1,19 @@
import type {
ICredentialsDecrypted,
ICredentialTestFunctions,
IDataObject,
INodeCredentialTestResult,
} from 'n8n-workflow';
import { Client } from 'ssh2';
import { configurePostgres } from '../transport';
import type { PgpClient } from '../helpers/interfaces';
import type { PgpClient, PostgresNodeCredentials } from '../helpers/interfaces';
export async function postgresConnectionTest(
this: ICredentialTestFunctions,
credential: ICredentialsDecrypted,
): Promise<INodeCredentialTestResult> {
const credentials = credential.data as IDataObject;
const credentials = credential.data as PostgresNodeCredentials;
let sshClientCreated: Client | undefined = new Client();
let pgpClientCreated: PgpClient | undefined;

View File

@@ -1,9 +1,10 @@
import type { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';
import { configurePostgres } from '../transport';
import type { PostgresNodeCredentials } from '../helpers/interfaces';
export async function schemaSearch(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
const credentials = await this.getCredentials('postgres');
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
const options = { nodeVersion: this.getNode().typeVersion };
const { db, sshClient } = await configurePostgres(credentials, options);
@@ -27,7 +28,7 @@ export async function schemaSearch(this: ILoadOptionsFunctions): Promise<INodeLi
}
}
export async function tableSearch(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
const credentials = await this.getCredentials('postgres');
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
const options = { nodeVersion: this.getNode().typeVersion };
const { db, sshClient } = await configurePostgres(credentials, options);

View File

@@ -2,9 +2,10 @@ import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
import { getTableSchema } from '../helpers/utils';
import { configurePostgres } from '../transport';
import type { PostgresNodeCredentials } from '../helpers/interfaces';
export async function getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const credentials = await this.getCredentials('postgres');
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
const options = { nodeVersion: this.getNode().typeVersion };
const { db, sshClient } = await configurePostgres(credentials, options);

View File

@@ -1,6 +1,7 @@
import type { ILoadOptionsFunctions, ResourceMapperFields, FieldType } from 'n8n-workflow';
import { getEnumValues, getEnums, getTableSchema, uniqueColumns } from '../helpers/utils';
import { configurePostgres } from '../transport';
import type { PostgresNodeCredentials } from '../helpers/interfaces';
const fieldTypeMapping: Partial<Record<FieldType, string[]>> = {
string: ['text', 'varchar', 'character varying', 'character', 'char'],
@@ -45,7 +46,7 @@ function mapPostgresType(postgresType: string): FieldType {
export async function getMappingColumns(
this: ILoadOptionsFunctions,
): Promise<ResourceMapperFields> {
const credentials = await this.getCredentials('postgres');
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
const { db, sshClient } = await configurePostgres(credentials);