fix: Set '@typescript-eslint/return-await' rule to 'always' for node code (no-changelog) (#8363)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Tomi Turtiainen
2024-01-17 17:08:50 +02:00
committed by GitHub
parent 2eb829a6b4
commit 9a1cc56806
369 changed files with 1041 additions and 928 deletions

View File

@@ -252,15 +252,15 @@ export class Agent implements INodeType {
const agentType = this.getNodeParameter('agent', 0, '') as string;
if (agentType === 'conversationalAgent') {
return conversationalAgentExecute.call(this);
return await conversationalAgentExecute.call(this);
} else if (agentType === 'openAiFunctionsAgent') {
return openAiFunctionsAgentExecute.call(this);
return await openAiFunctionsAgentExecute.call(this);
} else if (agentType === 'reActAgent') {
return reActAgentAgentExecute.call(this);
return await reActAgentAgentExecute.call(this);
} else if (agentType === 'sqlAgent') {
return sqlAgentAgentExecute.call(this);
return await sqlAgentAgentExecute.call(this);
} else if (agentType === 'planAndExecuteAgent') {
return planAndExecuteAgentExecute.call(this);
return await planAndExecuteAgentExecute.call(this);
}
throw new NodeOperationError(this.getNode(), `The agent type "${agentType}" is not supported`);

View File

@@ -102,5 +102,5 @@ export async function conversationalAgentExecute(
returnData.push({ json: response });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}

View File

@@ -101,5 +101,5 @@ export async function openAiFunctionsAgentExecute(
returnData.push({ json: response });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}

View File

@@ -76,5 +76,5 @@ export async function planAndExecuteAgentExecute(
returnData.push({ json: response });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}

View File

@@ -94,5 +94,5 @@ export async function reActAgentAgentExecute(
returnData.push({ json: response });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}

View File

@@ -101,5 +101,5 @@ export async function sqlAgentAgentExecute(
returnData.push({ json: response });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}

View File

@@ -380,6 +380,6 @@ export class OpenAiAssistant implements INodeType {
returnData.push({ json: response });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}
}

View File

@@ -166,7 +166,7 @@ async function getChain(
// If there are no output parsers, create a simple LLM chain and execute the query
if (!outputParsers.length) {
return createSimpleLLMChain(context, llm, query, chatTemplate);
return await createSimpleLLMChain(context, llm, query, chatTemplate);
}
// If there's only one output parser, use it; otherwise, create a combined output parser

View File

@@ -126,6 +126,6 @@ export class ChainRetrievalQa implements INodeType {
const response = await chain.call({ query });
returnData.push({ json: { response } });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}
}

View File

@@ -258,6 +258,6 @@ export class ChainSummarizationV1 implements INodeType {
returnData.push({ json: { response } });
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}
}

View File

@@ -415,6 +415,6 @@ export class ChainSummarizationV2 implements INodeType {
}
}
return this.prepareOutputData(returnData);
return await this.prepareOutputData(returnData);
}
}

View File

@@ -98,7 +98,7 @@ export class MemoryChatRetriever implements INodeType {
const messages = await memory?.chatHistory.getMessages();
if (simplifyOutput && messages) {
return this.prepareOutputData(simplifyMessages(messages));
return await this.prepareOutputData(simplifyMessages(messages));
}
const serializedMessages =
@@ -107,6 +107,6 @@ export class MemoryChatRetriever implements INodeType {
return { json: serializedMessage as unknown as IDataObject };
}) ?? [];
return this.prepareOutputData(serializedMessages);
return await this.prepareOutputData(serializedMessages);
}
}

View File

@@ -324,6 +324,6 @@ export class MemoryManager implements INodeType {
result.push(...executionData);
}
return this.prepareOutputData(result);
return await this.prepareOutputData(result);
}
}

View File

@@ -163,7 +163,7 @@ export class ToolCode implements INodeType {
const runFunction = async (query: string): Promise<string> => {
const sandbox = getSandbox(query, itemIndex);
return sandbox.runCode() as Promise<string>;
return await (sandbox.runCode() as Promise<string>);
};
return {

View File

@@ -46,7 +46,7 @@ export const VectorStoreInMemory = createVectorStoreNode({
const memoryKey = context.getNodeParameter('memoryKey', itemIndex) as string;
const vectorStoreSingleton = MemoryVectorStoreManager.getInstance(embeddings);
return vectorStoreSingleton.getVectorStore(`${workflowId}__${memoryKey}`);
return await vectorStoreSingleton.getVectorStore(`${workflowId}__${memoryKey}`);
},
async populateVectorStore(context, embeddings, documents, itemIndex) {
const memoryKey = context.getNodeParameter('memoryKey', itemIndex) as string;

View File

@@ -108,6 +108,6 @@ export class VectorStoreInMemoryInsert implements INodeType {
clearStore,
);
return this.prepareOutputData(serializedDocuments);
return await this.prepareOutputData(serializedDocuments);
}
}

View File

@@ -97,7 +97,7 @@ export const VectorStorePinecone = createVectorStoreNode({
filter,
};
return PineconeStore.fromExistingIndex(embeddings, config);
return await PineconeStore.fromExistingIndex(embeddings, config);
},
async populateVectorStore(context, embeddings, documents, itemIndex) {
const index = context.getNodeParameter('pineconeIndex', itemIndex, '', {

View File

@@ -134,6 +134,6 @@ export class VectorStorePineconeInsert implements INodeType {
pineconeIndex,
});
return this.prepareOutputData(serializedDocuments);
return await this.prepareOutputData(serializedDocuments);
}
}

View File

@@ -59,7 +59,7 @@ export const VectorStoreQdrant = createVectorStoreNode({
collectionName: collection,
};
return QdrantVectorStore.fromExistingCollection(embeddings, config);
return await QdrantVectorStore.fromExistingCollection(embeddings, config);
},
async populateVectorStore(context, embeddings, documents, itemIndex) {
const collectionName = context.getNodeParameter('qdrantCollection', itemIndex, '', {

View File

@@ -76,7 +76,7 @@ export const VectorStoreSupabase = createVectorStoreNode({
const credentials = await context.getCredentials('supabaseApi');
const client = createClient(credentials.host as string, credentials.serviceRole as string);
return SupabaseVectorStore.fromExistingIndex(embeddings, {
return await SupabaseVectorStore.fromExistingIndex(embeddings, {
client,
tableName,
queryName: options.queryName ?? 'match_documents',

View File

@@ -122,6 +122,6 @@ export class VectorStoreSupabaseInsert implements INodeType {
queryName,
});
return this.prepareOutputData(serializedDocuments);
return await this.prepareOutputData(serializedDocuments);
}
}

View File

@@ -139,6 +139,6 @@ export class VectorStoreZepInsert implements INodeType {
await ZepVectorStore.fromDocuments(processedDocuments, embeddings, zepConfig);
return this.prepareOutputData(serializedDocuments);
return await this.prepareOutputData(serializedDocuments);
}
}

View File

@@ -239,7 +239,7 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>
resultData.push(...serializedDocs);
}
return this.prepareOutputData(resultData);
return await this.prepareOutputData(resultData);
}
if (mode === 'insert') {
@@ -267,7 +267,7 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>
}
}
return this.prepareOutputData(resultData);
return await this.prepareOutputData(resultData);
}
throw new NodeOperationError(