mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Allow custom types on getCredentials (no-changelog) (#10567)
This commit is contained in:
committed by
GitHub
parent
52c574d83f
commit
be52176585
@@ -87,7 +87,7 @@ export async function pgTriggerFunction(
|
||||
}
|
||||
|
||||
export async function initDB(this: ITriggerFunctions | ILoadOptionsFunctions) {
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const options = this.getNodeParameter('options', {}) as {
|
||||
connectionTimeout?: number;
|
||||
delayClosingIdleConnection?: number;
|
||||
|
||||
@@ -15,7 +15,7 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
|
||||
const resource = this.getNodeParameter<PostgresType>('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const options = this.getNodeParameter('options', 0, {}) as PostgresNodeOptions;
|
||||
const node = this.getNode();
|
||||
options.nodeVersion = node.typeVersion;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { configurePostgres } from '../transport';
|
||||
import type { PostgresNodeCredentials } from '../helpers/interfaces';
|
||||
|
||||
export async function schemaSearch(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const options = { nodeVersion: this.getNode().typeVersion };
|
||||
|
||||
const { db } = await configurePostgres.call(this, credentials, options);
|
||||
@@ -23,7 +23,7 @@ export async function schemaSearch(this: ILoadOptionsFunctions): Promise<INodeLi
|
||||
}
|
||||
}
|
||||
export async function tableSearch(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const options = { nodeVersion: this.getNode().typeVersion };
|
||||
|
||||
const { db } = await configurePostgres.call(this, credentials, options);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { configurePostgres } from '../transport';
|
||||
import type { PostgresNodeCredentials } from '../helpers/interfaces';
|
||||
|
||||
export async function getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const options = { nodeVersion: this.getNode().typeVersion };
|
||||
|
||||
const { db } = await configurePostgres.call(this, credentials, options);
|
||||
|
||||
@@ -46,7 +46,7 @@ function mapPostgresType(postgresType: string): FieldType {
|
||||
export async function getMappingColumns(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<ResourceMapperFields> {
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
|
||||
const { db } = await configurePostgres.call(this, credentials);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user