mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Allow custom types on getCredentials (no-changelog) (#10567)
This commit is contained in:
committed by
GitHub
parent
52c574d83f
commit
be52176585
@@ -94,11 +94,11 @@ export class EmbeddingsAzureOpenAi implements INodeType {
|
||||
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
this.logger.verbose('Supply data for embeddings');
|
||||
const credentials = (await this.getCredentials('azureOpenAiApi')) as {
|
||||
const credentials = await this.getCredentials<{
|
||||
apiKey: string;
|
||||
resourceName: string;
|
||||
apiVersion: string;
|
||||
};
|
||||
}>('azureOpenAiApi');
|
||||
const modelName = this.getNodeParameter('model', itemIndex) as string;
|
||||
|
||||
const options = this.getNodeParameter('options', itemIndex, {}) as {
|
||||
|
||||
@@ -102,7 +102,7 @@ export class EmbeddingsCohere implements INodeType {
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
this.logger.verbose('Supply data for embeddings Cohere');
|
||||
const modelName = this.getNodeParameter('modelName', itemIndex, 'embed-english-v2.0') as string;
|
||||
const credentials = (await this.getCredentials('cohereApi')) as { apiKey: string };
|
||||
const credentials = await this.getCredentials<{ apiKey: string }>('cohereApi');
|
||||
const embeddings = new CohereEmbeddings({
|
||||
apiKey: credentials.apiKey,
|
||||
model: modelName,
|
||||
|
||||
@@ -133,11 +133,11 @@ export class LmChatAzureOpenAi implements INodeType {
|
||||
};
|
||||
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const credentials = (await this.getCredentials('azureOpenAiApi')) as {
|
||||
const credentials = await this.getCredentials<{
|
||||
apiKey: string;
|
||||
resourceName: string;
|
||||
apiVersion: string;
|
||||
};
|
||||
}>('azureOpenAiApi');
|
||||
|
||||
const modelName = this.getNodeParameter('model', itemIndex) as string;
|
||||
const options = this.getNodeParameter('options', itemIndex, {}) as {
|
||||
|
||||
@@ -74,7 +74,7 @@ export class MemoryPostgresChat implements INodeType {
|
||||
};
|
||||
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const credentials = (await this.getCredentials('postgres')) as PostgresNodeCredentials;
|
||||
const credentials = await this.getCredentials<PostgresNodeCredentials>('postgres');
|
||||
const tableName = this.getNodeParameter('tableName', itemIndex, 'n8n_chat_histories') as string;
|
||||
const sessionId = getSessionId(this, itemIndex);
|
||||
|
||||
|
||||
@@ -104,11 +104,11 @@ export class MemoryZep implements INodeType {
|
||||
};
|
||||
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const credentials = (await this.getCredentials('zepApi')) as {
|
||||
const credentials = await this.getCredentials<{
|
||||
apiKey?: string;
|
||||
apiUrl?: string;
|
||||
cloud?: boolean;
|
||||
};
|
||||
}>('zepApi');
|
||||
|
||||
const nodeVersion = this.getNode().typeVersion;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function validateAuth(context: IWebhookFunctions) {
|
||||
// Basic authorization is needed to call webhook
|
||||
let expectedAuth: ICredentialDataDecryptedObject | undefined;
|
||||
try {
|
||||
expectedAuth = await context.getCredentials('httpBasicAuth');
|
||||
expectedAuth = await context.getCredentials<ICredentialDataDecryptedObject>('httpBasicAuth');
|
||||
} catch {}
|
||||
|
||||
if (expectedAuth === undefined || !expectedAuth.user || !expectedAuth.password) {
|
||||
|
||||
@@ -79,10 +79,10 @@ export const VectorStoreZep = createVectorStoreNode({
|
||||
embeddingDimensions?: number;
|
||||
}) || {};
|
||||
|
||||
const credentials = (await context.getCredentials('zepApi')) as {
|
||||
const credentials = await context.getCredentials<{
|
||||
apiKey?: string;
|
||||
apiUrl: string;
|
||||
};
|
||||
}>('zepApi');
|
||||
|
||||
const zepConfig: IZepConfig = {
|
||||
apiUrl: credentials.apiUrl,
|
||||
@@ -102,10 +102,10 @@ export const VectorStoreZep = createVectorStoreNode({
|
||||
embeddingDimensions?: number;
|
||||
}) || {};
|
||||
|
||||
const credentials = (await context.getCredentials('zepApi')) as {
|
||||
const credentials = await context.getCredentials<{
|
||||
apiKey?: string;
|
||||
apiUrl: string;
|
||||
};
|
||||
}>('zepApi');
|
||||
|
||||
const zepConfig = {
|
||||
apiUrl: credentials.apiUrl,
|
||||
|
||||
@@ -110,10 +110,10 @@ export class VectorStoreZepInsert implements INodeType {
|
||||
embeddingDimensions?: number;
|
||||
}) || {};
|
||||
|
||||
const credentials = (await this.getCredentials('zepApi')) as {
|
||||
const credentials = await this.getCredentials<{
|
||||
apiKey?: string;
|
||||
apiUrl: string;
|
||||
};
|
||||
}>('zepApi');
|
||||
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
|
||||
@@ -93,10 +93,10 @@ export class VectorStoreZepLoad implements INodeType {
|
||||
embeddingDimensions?: number;
|
||||
}) || {};
|
||||
|
||||
const credentials = (await this.getCredentials('zepApi')) as {
|
||||
const credentials = await this.getCredentials<{
|
||||
apiKey?: string;
|
||||
apiUrl: string;
|
||||
};
|
||||
}>('zepApi');
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user