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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(

View file

@ -8,4 +8,11 @@ module.exports = {
es6: true,
node: true,
},
rules: {
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/return-await.md
*/
'@typescript-eslint/return-await': ['error', 'always'],
},
};

View file

@ -208,7 +208,7 @@ export abstract class AbstractServer {
// TODO UM: check if this needs validation with user management.
this.app.delete(
`/${this.restEndpoint}/test-webhook/:id`,
send(async (req) => testWebhooks.cancelWebhook(req.params.id)),
send(async (req) => await testWebhooks.cancelWebhook(req.params.id)),
);
}

View file

@ -178,7 +178,7 @@ export class ActiveExecutions {
this.activeExecutions[executionId].workflowExecution!.cancel();
}
return this.getPostExecutePromise(executionId);
return await this.getPostExecutePromise(executionId);
}
/**
@ -197,7 +197,7 @@ export class ActiveExecutions {
this.activeExecutions[executionId].postExecutePromises.push(waitPromise);
return waitPromise.promise();
return await waitPromise.promise();
}
/**

View file

@ -30,7 +30,7 @@ export class ActiveWebhooks implements IWebhookManager {
) {}
async getWebhookMethods(path: string) {
return this.webhookService.getWebhookMethods(path);
return await this.webhookService.getWebhookMethods(path);
}
async findAccessControlOptions(path: string, httpMethod: IHttpRequestMethods) {
@ -120,7 +120,7 @@ export class ActiveWebhooks implements IWebhookManager {
throw new NotFoundError('Could not find node to process webhook.');
}
return new Promise((resolve, reject) => {
return await new Promise((resolve, reject) => {
const executionMode = 'webhook';
void WebhookHelpers.executeWebhook(
workflow,

View file

@ -89,7 +89,7 @@ export class ActiveWorkflowRunner {
}
async getAllWorkflowActivationErrors() {
return this.activationErrorsService.getAll();
return await this.activationErrorsService.getAll();
}
/**
@ -305,7 +305,7 @@ export class ActiveWorkflowRunner {
};
const workflowRunner = new WorkflowRunner();
return workflowRunner.run(runData, true, undefined, undefined, responsePromise);
return await workflowRunner.run(runData, true, undefined, undefined, responsePromise);
}
/**

View file

@ -121,7 +121,10 @@ export class CredentialsHelper extends ICredentialsHelper {
if (typeof credentialType.authenticate === 'function') {
// Special authentication function is defined
return credentialType.authenticate(credentials, requestOptions as IHttpRequestOptions);
return await credentialType.authenticate(
credentials,
requestOptions as IHttpRequestOptions,
);
}
if (typeof credentialType.authenticate === 'object') {

View file

@ -54,7 +54,7 @@ if (!inTest) {
}
export async function transaction<T>(fn: (entityManager: EntityManager) => Promise<T>): Promise<T> {
return connection.transaction(fn);
return await connection.transaction(fn);
}
export function getConnectionOptions(dbType: DatabaseType): ConnectionOptions {

View file

@ -13,7 +13,7 @@ export class ExternalSecretsController {
@Get('/providers')
@RequireGlobalScope('externalSecretsProvider:list')
async getProviders() {
return this.secretsService.getProviders();
return await this.secretsService.getProviders();
}
@Get('/providers/:provider')

View file

@ -134,7 +134,7 @@ export class ExternalSecretsService {
}
const { settings } = providerAndSettings;
const newData = this.unredact(data, settings.settings);
return Container.get(ExternalSecretsManager).testProviderSettings(providerName, newData);
return await Container.get(ExternalSecretsManager).testProviderSettings(providerName, newData);
}
async updateProvider(providerName: string) {
@ -143,6 +143,6 @@ export class ExternalSecretsService {
if (!providerAndSettings) {
throw new ExternalSecretsProviderNotFoundError(providerName);
}
return Container.get(ExternalSecretsManager).updateProvider(providerName);
return await Container.get(ExternalSecretsManager).updateProvider(providerName);
}
}

View file

@ -48,10 +48,13 @@ export class ExternalSecretsManager {
this.initialized = true;
resolve();
this.initializingPromise = undefined;
this.updateInterval = setInterval(async () => this.updateSecrets(), updateIntervalTime());
this.updateInterval = setInterval(
async () => await this.updateSecrets(),
updateIntervalTime(),
);
});
}
return this.initializingPromise;
return await this.initializingPromise;
}
}
@ -107,8 +110,8 @@ export class ExternalSecretsManager {
}
const providers: Array<SecretsProvider | null> = (
await Promise.allSettled(
Object.entries(settings).map(async ([name, providerSettings]) =>
this.initProvider(name, providerSettings),
Object.entries(settings).map(
async ([name, providerSettings]) => await this.initProvider(name, providerSettings),
),
)
).map((i) => (i.status === 'rejected' ? null : i.value));

View file

@ -436,7 +436,7 @@ export class VaultProvider extends SecretsProvider {
await Promise.allSettled(
listResp.data.data.keys.map(async (key): Promise<[string, IDataObject] | null> => {
if (key.endsWith('/')) {
return this.getKVSecrets(mountPath, kvVersion, path + key);
return await this.getKVSecrets(mountPath, kvVersion, path + key);
}
let secretPath = mountPath;
if (kvVersion === '2') {

View file

@ -56,11 +56,13 @@ export class InternalHooks {
eventsService: EventsService,
private readonly instanceSettings: InstanceSettings,
) {
eventsService.on('telemetry.onFirstProductionWorkflowSuccess', async (metrics) =>
this.onFirstProductionWorkflowSuccess(metrics),
eventsService.on(
'telemetry.onFirstProductionWorkflowSuccess',
async (metrics) => await this.onFirstProductionWorkflowSuccess(metrics),
);
eventsService.on('telemetry.onFirstWorkflowDataLoad', async (metrics) =>
this.onFirstWorkflowDataLoad(metrics),
eventsService.on(
'telemetry.onFirstWorkflowDataLoad',
async (metrics) => await this.onFirstWorkflowDataLoad(metrics),
);
}
@ -88,7 +90,7 @@ export class InternalHooks {
license_tenant_id: diagnosticInfo.licenseTenantId,
};
return Promise.all([
return await Promise.all([
this.telemetry.identify(info),
this.telemetry.track('Instance started', {
...info,
@ -98,7 +100,7 @@ export class InternalHooks {
}
async onFrontendSettingsAPI(sessionId?: string): Promise<void> {
return this.telemetry.track('Session started', { session_id: sessionId });
return await this.telemetry.track('Session started', { session_id: sessionId });
}
async onPersonalizationSurveySubmitted(
@ -111,7 +113,7 @@ export class InternalHooks {
personalizationSurveyData[snakeCase(camelCaseKey)] = answers[camelCaseKey];
});
return this.telemetry.track(
return await this.telemetry.track(
'User responded to personalization questions',
personalizationSurveyData,
);
@ -459,7 +461,7 @@ export class InternalHooks {
user_id_list: userList,
};
return this.telemetry.track('User updated workflow sharing', properties);
return await this.telemetry.track('User updated workflow sharing', properties);
}
async onN8nStop(): Promise<void> {
@ -469,7 +471,7 @@ export class InternalHooks {
}, 3000);
});
return Promise.race([timeoutPromise, this.telemetry.trackN8nStop()]);
return await Promise.race([timeoutPromise, this.telemetry.trackN8nStop()]);
}
async onUserDeletion(userDeletionData: {
@ -554,42 +556,42 @@ export class InternalHooks {
user_id: string;
public_api: boolean;
}): Promise<void> {
return this.telemetry.track('User retrieved user', userRetrievedData);
return await this.telemetry.track('User retrieved user', userRetrievedData);
}
async onUserRetrievedAllUsers(userRetrievedData: {
user_id: string;
public_api: boolean;
}): Promise<void> {
return this.telemetry.track('User retrieved all users', userRetrievedData);
return await this.telemetry.track('User retrieved all users', userRetrievedData);
}
async onUserRetrievedExecution(userRetrievedData: {
user_id: string;
public_api: boolean;
}): Promise<void> {
return this.telemetry.track('User retrieved execution', userRetrievedData);
return await this.telemetry.track('User retrieved execution', userRetrievedData);
}
async onUserRetrievedAllExecutions(userRetrievedData: {
user_id: string;
public_api: boolean;
}): Promise<void> {
return this.telemetry.track('User retrieved all executions', userRetrievedData);
return await this.telemetry.track('User retrieved all executions', userRetrievedData);
}
async onUserRetrievedWorkflow(userRetrievedData: {
user_id: string;
public_api: boolean;
}): Promise<void> {
return this.telemetry.track('User retrieved workflow', userRetrievedData);
return await this.telemetry.track('User retrieved workflow', userRetrievedData);
}
async onUserRetrievedAllWorkflows(userRetrievedData: {
user_id: string;
public_api: boolean;
}): Promise<void> {
return this.telemetry.track('User retrieved all workflows', userRetrievedData);
return await this.telemetry.track('User retrieved all workflows', userRetrievedData);
}
async onUserUpdate(userUpdateData: { user: User; fields_changed: string[] }): Promise<void> {
@ -649,7 +651,7 @@ export class InternalHooks {
message_type: 'Reset password' | 'New user invite' | 'Resend invite';
public_api: boolean;
}): Promise<void> {
return this.telemetry.track(
return await this.telemetry.track(
'Instance sent transactional email to user',
userTransactionalEmailData,
);
@ -661,7 +663,7 @@ export class InternalHooks {
method: string;
api_version: string;
}): Promise<void> {
return this.telemetry.track('User invoked API', userInvokedApiData);
return await this.telemetry.track('User invoked API', userInvokedApiData);
}
async onApiKeyDeleted(apiKeyDeletedData: { user: User; public_api: boolean }): Promise<void> {
@ -709,7 +711,7 @@ export class InternalHooks {
}
async onInstanceOwnerSetup(instanceOwnerSetupData: { user_id: string }): Promise<void> {
return this.telemetry.track('Owner finished instance setup', instanceOwnerSetupData);
return await this.telemetry.track('Owner finished instance setup', instanceOwnerSetupData);
}
async onUserSignup(
@ -963,7 +965,7 @@ export class InternalHooks {
users_synced: number;
error: string;
}): Promise<void> {
return this.telemetry.track('Ldap general sync finished', data);
return await this.telemetry.track('Ldap general sync finished', data);
}
async onUserUpdatedLdapSettings(data: {
@ -980,15 +982,15 @@ export class InternalHooks {
loginLabel: string;
loginEnabled: boolean;
}): Promise<void> {
return this.telemetry.track('Ldap general sync finished', data);
return await this.telemetry.track('Ldap general sync finished', data);
}
async onLdapLoginSyncFailed(data: { error: string }): Promise<void> {
return this.telemetry.track('Ldap login sync failed', data);
return await this.telemetry.track('Ldap login sync failed', data);
}
async userLoginFailedDueToLdapDisabled(data: { user_id: string }): Promise<void> {
return this.telemetry.track('User login failed since ldap disabled', data);
return await this.telemetry.track('User login failed since ldap disabled', data);
}
/*
@ -998,7 +1000,7 @@ export class InternalHooks {
user_id: string;
workflow_id: string;
}): Promise<void> {
return this.telemetry.track('Workflow first prod success', data);
return await this.telemetry.track('Workflow first prod success', data);
}
async onFirstWorkflowDataLoad(data: {
@ -1009,7 +1011,7 @@ export class InternalHooks {
credential_type?: string;
credential_id?: string;
}): Promise<void> {
return this.telemetry.track('Workflow first data fetched', data);
return await this.telemetry.track('Workflow first data fetched', data);
}
/**
@ -1023,11 +1025,11 @@ export class InternalHooks {
* Audit
*/
async onAuditGeneratedViaCli() {
return this.telemetry.track('Instance generated security audit via CLI command');
return await this.telemetry.track('Instance generated security audit via CLI command');
}
async onVariableCreated(createData: { variable_type: string }): Promise<void> {
return this.telemetry.track('User created variable', createData);
return await this.telemetry.track('User created variable', createData);
}
async onSourceControlSettingsUpdated(data: {
@ -1036,7 +1038,7 @@ export class InternalHooks {
repo_type: 'github' | 'gitlab' | 'other';
connected: boolean;
}): Promise<void> {
return this.telemetry.track('User updated source control settings', data);
return await this.telemetry.track('User updated source control settings', data);
}
async onSourceControlUserStartedPullUI(data: {
@ -1044,11 +1046,11 @@ export class InternalHooks {
workflow_conflicts: number;
cred_conflicts: number;
}): Promise<void> {
return this.telemetry.track('User started pull via UI', data);
return await this.telemetry.track('User started pull via UI', data);
}
async onSourceControlUserFinishedPullUI(data: { workflow_updates: number }): Promise<void> {
return this.telemetry.track('User finished pull via UI', {
return await this.telemetry.track('User finished pull via UI', {
workflow_updates: data.workflow_updates,
});
}
@ -1057,7 +1059,7 @@ export class InternalHooks {
workflow_updates: number;
forced: boolean;
}): Promise<void> {
return this.telemetry.track('User pulled via API', data);
return await this.telemetry.track('User pulled via API', data);
}
async onSourceControlUserStartedPushUI(data: {
@ -1067,7 +1069,7 @@ export class InternalHooks {
creds_eligible_with_conflicts: number;
variables_eligible: number;
}): Promise<void> {
return this.telemetry.track('User started push via UI', data);
return await this.telemetry.track('User started push via UI', data);
}
async onSourceControlUserFinishedPushUI(data: {
@ -1076,7 +1078,7 @@ export class InternalHooks {
creds_pushed: number;
variables_pushed: number;
}): Promise<void> {
return this.telemetry.track('User finished push via UI', data);
return await this.telemetry.track('User finished push via UI', data);
}
async onExternalSecretsProviderSettingsSaved(saveData: {
@ -1086,6 +1088,6 @@ export class InternalHooks {
is_new: boolean;
error_message?: string | undefined;
}): Promise<void> {
return this.telemetry.track('User updated external secrets settings', saveData);
return await this.telemetry.track('User updated external secrets settings', saveData);
}
}

View file

@ -51,7 +51,7 @@ export const randomPassword = (): string => {
* Return the user role to be assigned to LDAP users
*/
export const getLdapUserRole = async (): Promise<Role> => {
return Container.get(RoleService).findGlobalMemberRole();
return await Container.get(RoleService).findGlobalMemberRole();
};
/**
@ -101,7 +101,7 @@ export const escapeFilter = (filter: string): string => {
export const getAuthIdentityByLdapId = async (
idAttributeValue: string,
): Promise<AuthIdentity | null> => {
return Container.get(AuthIdentityRepository).findOne({
return await Container.get(AuthIdentityRepository).findOne({
relations: ['user', 'user.globalRole'],
where: {
providerId: idAttributeValue,
@ -111,7 +111,7 @@ export const getAuthIdentityByLdapId = async (
};
export const getUserByEmail = async (email: string): Promise<User | null> => {
return Container.get(UserRepository).findOne({
return await Container.get(UserRepository).findOne({
where: { email },
relations: ['globalRole'],
});
@ -190,10 +190,10 @@ export const processUsers = async (
toDisableUsers: string[],
): Promise<void> => {
await Db.transaction(async (transactionManager) => {
return Promise.all([
return await Promise.all([
...toCreateUsers.map(async ([ldapId, user]) => {
const authIdentity = AuthIdentity.create(await transactionManager.save(user), ldapId);
return transactionManager.save(authIdentity);
return await transactionManager.save(authIdentity);
}),
...toUpdateUsers.map(async ([ldapId, user]) => {
const authIdentity = await transactionManager.findOneBy(AuthIdentity, {
@ -240,7 +240,7 @@ export const getLdapSynchronizations = async (
perPage: number,
): Promise<AuthProviderSyncHistory[]> => {
const _page = Math.abs(page);
return Container.get(AuthProviderSyncHistoryRepository).find({
return await Container.get(AuthProviderSyncHistoryRepository).find({
where: { providerType: 'ldap' },
order: { id: 'DESC' },
take: perPage,
@ -267,7 +267,7 @@ export const getMappingAttributes = (ldapConfig: LdapConfig): string[] => {
};
export const createLdapAuthIdentity = async (user: User, ldapId: string) => {
return Container.get(AuthIdentityRepository).save(AuthIdentity.create(user, ldapId));
return await Container.get(AuthIdentityRepository).save(AuthIdentity.create(user, ldapId));
};
export const createLdapUserOnLocalDb = async (role: Role, data: Partial<User>, ldapId: string) => {
@ -288,5 +288,5 @@ export const updateLdapUserOnLocalDb = async (identity: AuthIdentity, data: Part
};
export const deleteAllLdapIdentities = async () => {
return Container.get(AuthIdentityRepository).delete({ providerType: 'ldap' });
return await Container.get(AuthIdentityRepository).delete({ providerType: 'ldap' });
};

View file

@ -19,7 +19,7 @@ export class LdapController {
@Get('/config')
@RequireGlobalScope('ldap:manage')
async getConfig() {
return this.ldapService.loadConfig();
return await this.ldapService.loadConfig();
}
@Post('/test-connection')
@ -55,7 +55,7 @@ export class LdapController {
@RequireGlobalScope('ldap:sync')
async getLdapSync(req: LdapConfiguration.GetSync) {
const { page = '0', perPage = '20' } = req.query;
return getLdapSynchronizations(parseInt(page, 10), parseInt(perPage, 10));
return await getLdapSynchronizations(parseInt(page, 10), parseInt(perPage, 10));
}
@Post('/sync')

View file

@ -59,13 +59,13 @@ export class License {
const offlineMode = !isMainInstance;
const autoRenewOffset = config.getEnv('license.autoRenewOffset');
const saveCertStr = isMainInstance
? async (value: TLicenseBlock) => this.saveCertStr(value)
? async (value: TLicenseBlock) => await this.saveCertStr(value)
: async () => {};
const onFeatureChange = isMainInstance
? async (features: TFeatures) => this.onFeatureChange(features)
? async (features: TFeatures) => await this.onFeatureChange(features)
: async () => {};
const collectUsageMetrics = isMainInstance
? async () => this.collectUsageMetrics()
? async () => await this.collectUsageMetrics()
: async () => [];
try {
@ -78,7 +78,7 @@ export class License {
autoRenewOffset,
offlineMode,
logger: this.logger,
loadCertStr: async () => this.loadCertStr(),
loadCertStr: async () => await this.loadCertStr(),
saveCertStr,
deviceFingerprint: () => this.instanceSettings.instanceId,
collectUsageMetrics,

View file

@ -182,7 +182,7 @@ export class LoadNodesAndCredentials {
'node_modules',
packageName,
);
return this.runDirectoryLoader(PackageDirectoryLoader, finalNodeUnpackedPath);
return await this.runDirectoryLoader(PackageDirectoryLoader, finalNodeUnpackedPath);
}
async unloadPackage(packageName: string) {

View file

@ -8,7 +8,7 @@ export const isMfaFeatureEnabled = () => config.get(MFA_FEATURE_ENABLED);
const isMfaFeatureDisabled = () => !isMfaFeatureEnabled();
const getUsersWithMfaEnabled = async () =>
Container.get(UserRepository).count({ where: { mfaEnabled: true } });
await Container.get(UserRepository).count({ where: { mfaEnabled: true } });
export const handleMfaDisable = async () => {
if (isMfaFeatureDisabled()) {

View file

@ -25,7 +25,7 @@ export class MfaService {
secret,
recoveryCodes,
);
return this.userRepository.update(userId, {
return await this.userRepository.update(userId, {
mfaSecret: encryptedSecret,
mfaRecoveryCodes: encryptedRecoveryCodes,
});

View file

@ -144,7 +144,7 @@ export const loadPublicApiVersions = async (
const apiRouters = await Promise.all(
versions.map(async (version) => {
const openApiPath = path.join(__dirname, version, 'openapi.yml');
return createApiRouter(version, openApiPath, __dirname, publicApiEndpoint);
return await createApiRouter(version, openApiPath, __dirname, publicApiEndpoint);
}),
);

View file

@ -14,7 +14,7 @@ import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@db/repositories/sharedCredentials.repository';
export async function getCredentials(credentialId: string): Promise<ICredentialsDb | null> {
return Container.get(CredentialsRepository).findOneBy({ id: credentialId });
return await Container.get(CredentialsRepository).findOneBy({ id: credentialId });
}
export async function getSharedCredentials(
@ -22,7 +22,7 @@ export async function getSharedCredentials(
credentialId: string,
relations?: string[],
): Promise<SharedCredentials | null> {
return Container.get(SharedCredentialsRepository).findOne({
return await Container.get(SharedCredentialsRepository).findOne({
where: {
userId,
credentialsId: credentialId,
@ -64,7 +64,7 @@ export async function saveCredential(
await Container.get(ExternalHooks).run('credentials.create', [encryptedData]);
return Db.transaction(async (transactionManager) => {
return await Db.transaction(async (transactionManager) => {
const savedCredential = await transactionManager.save<CredentialsEntity>(credential);
savedCredential.data = credential.data;
@ -85,7 +85,7 @@ export async function saveCredential(
export async function removeCredential(credentials: CredentialsEntity): Promise<ICredentialsDb> {
await Container.get(ExternalHooks).run('credentials.delete', [credentials.id]);
return Container.get(CredentialsRepository).remove(credentials);
return await Container.get(CredentialsRepository).remove(credentials);
}
export async function encryptCredential(credential: CredentialsEntity): Promise<ICredentialsDb> {

View file

@ -15,7 +15,7 @@ export async function getUser(data: {
withIdentifier: string;
includeRole?: boolean;
}): Promise<User | null> {
return Container.get(UserRepository).findOne({
return await Container.get(UserRepository).findOne({
where: {
...(uuidValidate(data.withIdentifier) && { id: data.withIdentifier }),
...(!uuidValidate(data.withIdentifier) && { email: data.withIdentifier }),

View file

@ -25,7 +25,7 @@ export async function getSharedWorkflow(
user: User,
workflowId?: string | undefined,
): Promise<SharedWorkflow | null> {
return Container.get(SharedWorkflowRepository).findOne({
return await Container.get(SharedWorkflowRepository).findOne({
where: {
...(!['owner', 'admin'].includes(user.globalRole.name) && { userId: user.id }),
...(workflowId && { workflowId }),
@ -35,7 +35,7 @@ export async function getSharedWorkflow(
}
export async function getWorkflowById(id: string): Promise<WorkflowEntity | null> {
return Container.get(WorkflowRepository).findOne({
return await Container.get(WorkflowRepository).findOne({
where: { id },
});
}
@ -45,7 +45,7 @@ export async function createWorkflow(
user: User,
role: Role,
): Promise<WorkflowEntity> {
return Db.transaction(async (transactionManager) => {
return await Db.transaction(async (transactionManager) => {
const newWorkflow = new WorkflowEntity();
Object.assign(newWorkflow, workflow);
const savedWorkflow = await transactionManager.save<WorkflowEntity>(newWorkflow);
@ -70,18 +70,18 @@ export async function setWorkflowAsActive(workflow: WorkflowEntity) {
}
export async function setWorkflowAsInactive(workflow: WorkflowEntity) {
return Container.get(WorkflowRepository).update(workflow.id, {
return await Container.get(WorkflowRepository).update(workflow.id, {
active: false,
updatedAt: new Date(),
});
}
export async function deleteWorkflow(workflow: WorkflowEntity): Promise<WorkflowEntity> {
return Container.get(WorkflowRepository).remove(workflow);
return await Container.get(WorkflowRepository).remove(workflow);
}
export async function updateWorkflow(workflowId: string, updateData: WorkflowEntity) {
return Container.get(WorkflowRepository).update(workflowId, updateData);
return await Container.get(WorkflowRepository).update(workflowId, updateData);
}
export function parseTagNames(tags: string): string[] {

View file

@ -74,27 +74,27 @@ export class Queue {
}
async add(jobData: JobData, jobOptions: object): Promise<Job> {
return this.jobQueue.add(jobData, jobOptions);
return await this.jobQueue.add(jobData, jobOptions);
}
async getJob(jobId: JobId): Promise<Job | null> {
return this.jobQueue.getJob(jobId);
return await this.jobQueue.getJob(jobId);
}
async getJobs(jobTypes: Bull.JobStatus[]): Promise<Job[]> {
return this.jobQueue.getJobs(jobTypes);
return await this.jobQueue.getJobs(jobTypes);
}
async process(concurrency: number, fn: Bull.ProcessCallbackFunction<JobData>): Promise<void> {
return this.jobQueue.process(concurrency, fn);
return await this.jobQueue.process(concurrency, fn);
}
async ping(): Promise<string> {
return this.jobQueue.client.ping();
return await this.jobQueue.client.ping();
}
async pause(isLocal?: boolean): Promise<void> {
return this.jobQueue.pause(isLocal);
return await this.jobQueue.pause(isLocal);
}
getBullObjectInstance(): JobQueue {

View file

@ -209,8 +209,9 @@ export class Server extends AbstractServer {
order: { createdAt: 'ASC' },
where: {},
})
.then(async (workflow) =>
Container.get(InternalHooks).onServerStarted(diagnosticInfo, workflow?.createdAt),
.then(
async (workflow) =>
await Container.get(InternalHooks).onServerStarted(diagnosticInfo, workflow?.createdAt),
);
Container.get(CollaborationService);

View file

@ -101,7 +101,7 @@ export class TestWebhooks implements IWebhookManager {
throw new NotFoundError('Could not find node to process webhook.');
}
return new Promise(async (resolve, reject) => {
return await new Promise(async (resolve, reject) => {
try {
const executionMode = 'manual';
const executionId = await WebhookHelpers.executeWebhook(
@ -229,7 +229,10 @@ export class TestWebhooks implements IWebhookManager {
return false; // no webhooks found to start a workflow
}
const timeout = setTimeout(async () => this.cancelWebhook(workflow.id), TEST_WEBHOOK_TIMEOUT);
const timeout = setTimeout(
async () => await this.cancelWebhook(workflow.id),
TEST_WEBHOOK_TIMEOUT,
);
for (const webhook of webhooks) {
const key = this.registrations.toKey(webhook);

View file

@ -53,7 +53,7 @@ export class UserManagementMailer {
async verifyConnection(): Promise<void> {
if (!this.mailer) throw new ApplicationError('No mailer configured.');
return this.mailer.verifyConnection();
return await this.mailer.verifyConnection();
}
async invite(inviteEmailData: InviteEmailData): Promise<SendEmailResult> {

View file

@ -122,7 +122,7 @@ export class WaitingWebhooks implements IWebhookManager {
const runExecutionData = execution.data;
return new Promise((resolve, reject) => {
return await new Promise((resolve, reject) => {
const executionMode = 'webhook';
void WebhookHelpers.executeWebhook(
workflow,

View file

@ -417,8 +417,9 @@ export class WorkflowRunner {
fullRunData.status = this.activeExecutions.getStatus(executionId);
this.activeExecutions.remove(executionId, fullRunData);
})
.catch(async (error) =>
this.processError(
.catch(
async (error) =>
await this.processError(
error,
new Date(),
data.executionMode,

View file

@ -276,7 +276,7 @@ class WorkflowRunnerProcess {
this.data.executionMode,
this.data.executionData,
);
return this.workflowExecute.processRunExecutionData(this.workflow);
return await this.workflowExecute.processRunExecutionData(this.workflow);
}
if (
this.data.runData === undefined ||
@ -289,7 +289,7 @@ class WorkflowRunnerProcess {
// Can execute without webhook so go on
this.workflowExecute = new WorkflowExecute(additionalData, this.data.executionMode);
return this.workflowExecute.run(
return await this.workflowExecute.run(
this.workflow,
startNode,
this.data.destinationNode,
@ -298,7 +298,7 @@ class WorkflowRunnerProcess {
}
// Execute only the nodes between start and destination nodes
this.workflowExecute = new WorkflowExecute(additionalData, this.data.executionMode);
return this.workflowExecute.runPartialWorkflow(
return await this.workflowExecute.runPartialWorkflow(
this.workflow,
this.data.runData,
this.data.startNodes,
@ -383,7 +383,7 @@ class WorkflowRunnerProcess {
* @param {*} data The data
*/
async function sendToParentProcess(type: string, data: any): Promise<void> {
return new Promise((resolve, reject) => {
return await new Promise((resolve, reject) => {
process.send!(
{
type,

View file

@ -80,7 +80,7 @@ export async function resolveJwt(token: string): Promise<User> {
const jwtPayload: JwtPayload = Container.get(JwtService).verify(token, {
algorithms: ['HS256'],
});
return resolveJwtContent(jwtPayload);
return await resolveJwtContent(jwtPayload);
}
export async function issueCookie(res: Response, user: User): Promise<void> {

View file

@ -59,8 +59,8 @@ export abstract class BaseCommand extends Command {
this.nodeTypes = Container.get(NodeTypes);
await Container.get(LoadNodesAndCredentials).init();
await Db.init().catch(async (error: Error) =>
this.exitWithCrash('There was an error initializing DB', error),
await Db.init().catch(
async (error: Error) => await this.exitWithCrash('There was an error initializing DB', error),
);
// This needs to happen after DB.init() or otherwise DB Connection is not
@ -71,8 +71,9 @@ export abstract class BaseCommand extends Command {
await this.server?.init();
await Db.migrate().catch(async (error: Error) =>
this.exitWithCrash('There was an error running database migrations', error),
await Db.migrate().catch(
async (error: Error) =>
await this.exitWithCrash('There was an error running database migrations', error),
);
const dbType = config.getEnv('database.type');

View file

@ -120,7 +120,7 @@ export class ExecuteBatch extends BaseCommand {
const activeExecutionsInstance = Container.get(ActiveExecutions);
const stopPromises = activeExecutionsInstance
.getActiveExecutions()
.map(async (execution) => activeExecutionsInstance.stopExecution(execution.id));
.map(async (execution) => await activeExecutionsInstance.stopExecution(execution.id));
await Promise.allSettled(stopPromises);
@ -410,7 +410,7 @@ export class ExecuteBatch extends BaseCommand {
this.initializeLogs();
}
return new Promise(async (res) => {
return await new Promise(async (res) => {
const promisesArray = [];
for (let i = 0; i < ExecuteBatch.concurrency; i++) {
const promise = new Promise(async (resolve) => {
@ -623,7 +623,7 @@ export class ExecuteBatch extends BaseCommand {
}
});
return new Promise(async (resolve) => {
return await new Promise(async (resolve) => {
let gotCancel = false;
// Timeouts execution after 5 minutes.

View file

@ -174,7 +174,7 @@ export class Start extends BaseCommand {
);
}
streams.push(createWriteStream(destFile, 'utf-8'));
return pipeline(streams);
return await pipeline(streams);
}
};

View file

@ -71,7 +71,7 @@ export class Reset extends BaseCommand {
await Container.get(UserRepository).save(user);
return Container.get(UserRepository).findOneByOrFail({ globalRoleId: globalRole.id });
return await Container.get(UserRepository).findOneByOrFail({ globalRoleId: globalRole.id });
}
async catch(error: Error): Promise<void> {

View file

@ -345,8 +345,9 @@ export class Worker extends BaseCommand {
Worker.jobQueue = Container.get(Queue);
await Worker.jobQueue.init();
this.logger.debug('Queue singleton ready');
void Worker.jobQueue.process(flags.concurrency, async (job) =>
this.runJob(job, this.nodeTypes),
void Worker.jobQueue.process(
flags.concurrency,
async (job) => await this.runJob(job, this.nodeTypes),
);
Worker.jobQueue.getBullObjectInstance().on('global:progress', (jobId: JobId, progress) => {

View file

@ -9,7 +9,7 @@ export class ActiveWorkflowsController {
@Get('/')
async getActiveWorkflows(req: ActiveWorkflowRequest.GetAllActive) {
return this.activeWorkflowsService.getAllActiveIdsFor(req.user);
return await this.activeWorkflowsService.getAllActiveIdsFor(req.user);
}
@Get('/error/:id')
@ -18,6 +18,6 @@ export class ActiveWorkflowsController {
user,
params: { id: workflowId },
} = req;
return this.activeWorkflowsService.getActivationError(workflowId, user);
return await this.activeWorkflowsService.getActivationError(workflowId, user);
}
}

View file

@ -102,7 +102,7 @@ export class AuthController {
authenticationMethod: usedAuthenticationMethod,
});
return this.userService.toPublic(user, { posthog: this.postHog, withScopes: true });
return await this.userService.toPublic(user, { posthog: this.postHog, withScopes: true });
}
void this.internalHooks.onUserLoginFailed({
user: email,
@ -150,7 +150,7 @@ export class AuthController {
}
await issueCookie(res, user);
return this.userService.toPublic(user, { posthog: this.postHog, withScopes: true });
return await this.userService.toPublic(user, { posthog: this.postHog, withScopes: true });
}
/**

View file

@ -57,7 +57,7 @@ export class DynamicNodeParametersController {
const additionalData = await getBase(req.user.id, currentNodeParameters);
if (methodName) {
return this.service.getOptionsViaMethodName(
return await this.service.getOptionsViaMethodName(
methodName,
path,
additionalData,
@ -68,7 +68,7 @@ export class DynamicNodeParametersController {
}
if (loadOptions) {
return this.service.getOptionsViaLoadOptions(
return await this.service.getOptionsViaLoadOptions(
jsonParse(loadOptions),
additionalData,
nodeTypeAndVersion,
@ -87,7 +87,7 @@ export class DynamicNodeParametersController {
const { path, methodName, filter, paginationToken } = req.query;
const { credentials, currentNodeParameters, nodeTypeAndVersion } = req.params;
const additionalData = await getBase(req.user.id, currentNodeParameters);
return this.service.getResourceLocatorResults(
return await this.service.getResourceLocatorResults(
methodName,
path,
additionalData,
@ -106,7 +106,7 @@ export class DynamicNodeParametersController {
const { path, methodName } = req.query;
const { credentials, currentNodeParameters, nodeTypeAndVersion } = req.params;
const additionalData = await getBase(req.user.id, currentNodeParameters);
return this.service.getResourceMappingFields(
return await this.service.getResourceMappingFields(
methodName,
path,
additionalData,

View file

@ -177,6 +177,9 @@ export class InvitationController {
await this.externalHooks.run('user.profile.update', [invitee.email, publicInvitee]);
await this.externalHooks.run('user.password.update', [invitee.email, invitee.password]);
return this.userService.toPublic(updatedUser, { posthog: this.postHog, withScopes: true });
return await this.userService.toPublic(updatedUser, {
posthog: this.postHog,
withScopes: true,
});
}
}

View file

@ -50,8 +50,8 @@ export class NodeTypesController {
const nodeTypes: INodeTypeDescription[] = [];
const promises = nodeInfos.map(async ({ name, version }) =>
populateTranslation(name, version, nodeTypes),
const promises = nodeInfos.map(
async ({ name, version }) => await populateTranslation(name, version, nodeTypes),
);
await Promise.all(promises);

View file

@ -61,14 +61,14 @@ export abstract class AbstractOAuthController {
}
protected async getAdditionalData(user: User) {
return WorkflowExecuteAdditionalData.getBase(user.id);
return await WorkflowExecuteAdditionalData.getBase(user.id);
}
protected async getDecryptedData(
credential: ICredentialsDb,
additionalData: IWorkflowExecuteAdditionalData,
) {
return this.credentialsHelper.getDecrypted(
return await this.credentialsHelper.getDecrypted(
additionalData,
credential,
credential.type,
@ -105,6 +105,6 @@ export abstract class AbstractOAuthController {
/** Get a credential without user check */
protected async getCredentialWithoutUser(credentialId: string): Promise<ICredentialsDb | null> {
return this.credentialsRepository.findOneBy({ id: credentialId });
return await this.credentialsRepository.findOneBy({ id: credentialId });
}
}

View file

@ -20,20 +20,20 @@ export class OrchestrationController {
async getWorkersStatus(req: OrchestrationRequest.Get) {
if (!this.licenseService.isWorkerViewLicensed()) return;
const id = req.params.id;
return this.singleMainSetup.getWorkerStatus(id);
return await this.singleMainSetup.getWorkerStatus(id);
}
@RequireGlobalScope('orchestration:read')
@Post('/worker/status')
async getWorkersStatusAll() {
if (!this.licenseService.isWorkerViewLicensed()) return;
return this.singleMainSetup.getWorkerStatus();
return await this.singleMainSetup.getWorkerStatus();
}
@RequireGlobalScope('orchestration:list')
@Post('/worker/ids')
async getWorkerIdsAll() {
if (!this.licenseService.isWorkerViewLicensed()) return;
return this.singleMainSetup.getWorkerIds();
return await this.singleMainSetup.getWorkerIds();
}
}

View file

@ -104,7 +104,7 @@ export class OwnerController {
void this.internalHooks.onInstanceOwnerSetup({ user_id: userId });
return this.userService.toPublic(owner, { posthog: this.postHog, withScopes: true });
return await this.userService.toPublic(owner, { posthog: this.postHog, withScopes: true });
}
@Post('/dismiss-banner')

View file

@ -32,7 +32,7 @@ export class TagsController {
@Get('/')
@RequireGlobalScope('tag:list')
async getAll(req: TagsRequest.GetAll) {
return this.tagService.getAll({ withUsageCount: req.query.withUsageCount === 'true' });
return await this.tagService.getAll({ withUsageCount: req.query.withUsageCount === 'true' });
}
@Post('/')
@ -40,7 +40,7 @@ export class TagsController {
async createTag(req: TagsRequest.Create) {
const tag = this.tagService.toEntity({ name: req.body.name });
return this.tagService.save(tag, 'create');
return await this.tagService.save(tag, 'create');
}
@Patch('/:id(\\w+)')
@ -48,7 +48,7 @@ export class TagsController {
async updateTag(req: TagsRequest.Update) {
const newTag = this.tagService.toEntity({ id: req.params.id, name: req.body.name.trim() });
return this.tagService.save(newTag, 'update');
return await this.tagService.save(newTag, 'update');
}
@Delete('/:id(\\w+)')

View file

@ -102,8 +102,9 @@ export class UsersController {
const users = await this.userRepository.find(findManyOptions);
const publicUsers: Array<Partial<PublicUser>> = await Promise.all(
users.map(async (u) =>
this.userService.toPublic(u, { withInviteUrl: true, inviterId: req.user.id }),
users.map(
async (u) =>
await this.userService.toPublic(u, { withInviteUrl: true, inviterId: req.user.id }),
),
);

View file

@ -49,12 +49,12 @@ export class WorkflowStatisticsController {
@Get('/:id/counts/')
async getCounts(req: ExecutionRequest.Get): Promise<WorkflowStatisticsData<number>> {
return this.getData(req.params.id, 'count', 0);
return await this.getData(req.params.id, 'count', 0);
}
@Get('/:id/times/')
async getTimes(req: ExecutionRequest.Get): Promise<WorkflowStatisticsData<Date | null>> {
return this.getData(req.params.id, 'latestEvent', null);
return await this.getData(req.params.id, 'latestEvent', null);
}
@Get('/:id/data-loaded/')

View file

@ -102,7 +102,7 @@ EECredentialsController.post(
mergedCredentials.data = EECredentials.unredact(mergedCredentials.data, decryptedData);
}
return EECredentials.test(req.user, mergedCredentials);
return await EECredentials.test(req.user, mergedCredentials);
}),
);

View file

@ -27,7 +27,7 @@ credentialsController.get(
'/',
listQueryMiddleware,
ResponseHelper.send(async (req: ListQuery.Request) => {
return CredentialsService.getMany(req.user, { listQueryOptions: req.listQueryOptions });
return await CredentialsService.getMany(req.user, { listQueryOptions: req.listQueryOptions });
}),
);
@ -105,7 +105,7 @@ credentialsController.post(
mergedCredentials.data = CredentialsService.unredact(mergedCredentials.data, decryptedData);
}
return CredentialsService.test(req.user, mergedCredentials);
return await CredentialsService.test(req.user, mergedCredentials);
}),
);

View file

@ -43,7 +43,7 @@ export class EECredentialsService extends CredentialsService {
where.userId = user.id;
}
return Container.get(SharedCredentialsRepository).findOne({
return await Container.get(SharedCredentialsRepository).findOne({
where,
relations,
});
@ -79,6 +79,6 @@ export class EECredentialsService extends CredentialsService {
}),
);
return transaction.save(newSharedCredentials);
return await transaction.save(newSharedCredentials);
}
}

View file

@ -35,7 +35,7 @@ export type CredentialsGetSharedOptions =
export class CredentialsService {
static async get(where: FindOptionsWhere<ICredentialsDb>, options?: { relations: string[] }) {
return Container.get(CredentialsRepository).findOne({
return await Container.get(CredentialsRepository).findOne({
relations: options?.relations,
where,
});
@ -94,7 +94,7 @@ export class CredentialsService {
}
}
return Container.get(SharedCredentialsRepository).findOne({ where, relations });
return await Container.get(SharedCredentialsRepository).findOne({ where, relations });
}
static async prepareCreateData(
@ -180,7 +180,7 @@ export class CredentialsService {
// We sadly get nothing back from "update". Neither if it updated a record
// nor the new value. So query now the updated entry.
return Container.get(CredentialsRepository).findOneBy({ id: credentialId });
return await Container.get(CredentialsRepository).findOneBy({ id: credentialId });
}
static async save(
@ -231,7 +231,7 @@ export class CredentialsService {
credentials: ICredentialsDecrypted,
): Promise<INodeCredentialTestResult> {
const helper = Container.get(CredentialsHelper);
return helper.testCredentials(user, credentials.type, credentials);
return await helper.testCredentials(user, credentials.type, credentials);
}
// Take data and replace all sensitive values with a sentinel value.

View file

@ -40,7 +40,7 @@ export class CreateIndex extends IndexOperation {
async execute(queryRunner: QueryRunner) {
const { columnNames, isUnique } = this;
return queryRunner.createIndex(
return await queryRunner.createIndex(
this.fullTableName,
new TableIndex({ name: this.customIndexName ?? this.fullIndexName, columnNames, isUnique }),
);
@ -49,6 +49,9 @@ export class CreateIndex extends IndexOperation {
export class DropIndex extends IndexOperation {
async execute(queryRunner: QueryRunner) {
return queryRunner.dropIndex(this.fullTableName, this.customIndexName ?? this.fullIndexName);
return await queryRunner.dropIndex(
this.fullTableName,
this.customIndexName ?? this.fullIndexName,
);
}
}

View file

@ -62,7 +62,7 @@ export class CreateTable extends TableOperation {
async execute(queryRunner: QueryRunner) {
const { driver } = queryRunner.connection;
const { columns, tableName: name, prefix, indices, foreignKeys } = this;
return queryRunner.createTable(
return await queryRunner.createTable(
new Table({
name: `${prefix}${name}`,
columns: columns.map((c) => c.toOptions(driver)),
@ -78,7 +78,7 @@ export class CreateTable extends TableOperation {
export class DropTable extends TableOperation {
async execute(queryRunner: QueryRunner) {
const { tableName: name, prefix } = this;
return queryRunner.dropTable(`${prefix}${name}`, true);
return await queryRunner.dropTable(`${prefix}${name}`, true);
}
}
@ -95,7 +95,7 @@ export class AddColumns extends TableOperation {
async execute(queryRunner: QueryRunner) {
const { driver } = queryRunner.connection;
const { tableName, prefix, columns } = this;
return queryRunner.addColumns(
return await queryRunner.addColumns(
`${prefix}${tableName}`,
columns.map((c) => new TableColumn(c.toOptions(driver))),
);
@ -114,7 +114,7 @@ export class DropColumns extends TableOperation {
async execute(queryRunner: QueryRunner) {
const { tableName, prefix, columnNames } = this;
return queryRunner.dropColumns(`${prefix}${tableName}`, columnNames);
return await queryRunner.dropColumns(`${prefix}${tableName}`, columnNames);
}
}
@ -136,7 +136,7 @@ class ModifyNotNull extends TableOperation {
const oldColumn = table.findColumnByName(columnName)!;
const newColumn = oldColumn.clone();
newColumn.isNullable = isNullable;
return queryRunner.changeColumn(table, oldColumn, newColumn);
return await queryRunner.changeColumn(table, oldColumn, newColumn);
}
}

View file

@ -20,7 +20,7 @@ export class UniqueWorkflowNames1620821879465 implements ReversibleMigration {
await Promise.all(
duplicates.map(async (workflow, index) => {
if (index === 0) return;
return runQuery(`UPDATE ${tableName} SET name = :name WHERE id = :id`, {
return await runQuery(`UPDATE ${tableName} SET name = :name WHERE id = :id`, {
name: `${workflow.name} ${index + 1}`,
id: workflow.id,
});

View file

@ -26,8 +26,9 @@ export class AddJsonKeyPinData1659888469333 implements IrreversibleMigration {
const selectQuery = `SELECT id, ${columnName} FROM ${tableName} WHERE ${columnName} IS NOT NULL`;
await runInBatches<Workflow>(selectQuery, async (workflows) => {
await Promise.all(
this.makeUpdateParams(workflows).map(async (workflow) =>
runQuery(`UPDATE ${tableName} SET ${columnName} = :pinData WHERE id = :id;`, {
this.makeUpdateParams(workflows).map(
async (workflow) =>
await runQuery(`UPDATE ${tableName} SET ${columnName} = :pinData WHERE id = :id;`, {
pinData: workflow.pinData,
id: workflow.id,
}),

View file

@ -18,13 +18,13 @@ export class RemoveWorkflowDataLoadedFlag1671726148419 implements ReversibleMigr
await Promise.all(
workflowIds.map(
async ({ id, dataLoaded }) =>
dataLoaded &&
await (dataLoaded &&
runQuery(
`INSERT INTO ${statisticsTableName}
(${escape.columnName('workflowId')}, name, count, ${escape.columnName('latestEvent')})
VALUES (:id, :name, 1, ${now})`,
{ id, name: StatisticsNames.dataLoaded },
),
)),
),
);
@ -47,8 +47,9 @@ export class RemoveWorkflowDataLoadedFlag1671726148419 implements ReversibleMigr
);
await Promise.all(
workflowsIds.map(async ({ workflowId }) =>
runQuery(`UPDATE ${workflowTableName} SET ${columnName} = true WHERE id = :id`, {
workflowsIds.map(
async ({ workflowId }) =>
await runQuery(`UPDATE ${workflowTableName} SET ${columnName} = true WHERE id = :id`, {
id: workflowId,
}),
),

View file

@ -47,10 +47,13 @@ export class PurgeInvalidWorkflowConnections1675940580449 implements Irreversibl
});
// Update database with new connections
return runQuery(`UPDATE ${workflowsTable} SET connections = :connections WHERE id = :id`, {
return await runQuery(
`UPDATE ${workflowsTable} SET connections = :connections WHERE id = :id`,
{
connections: JSON.stringify(connections),
id: workflow.id,
});
},
);
}),
);
}

View file

@ -18,15 +18,15 @@ export class AddUserActivatedProperty1681134145996 implements ReversibleMigratio
AND r.scope = 'workflow'`,
)) as UserSettings[];
const updatedUsers = activatedUsers.map(async (user) =>
queryRunner.query(
const updatedUserPromises = activatedUsers.map(async (user) => {
await queryRunner.query(
`UPDATE "${tablePrefix}user" SET settings = '${JSON.stringify(
user.settings,
)}' WHERE id = '${user.id}' `,
),
);
});
await Promise.all(updatedUsers);
await Promise.all(updatedUserPromises);
if (!activatedUsers.length) {
await queryRunner.query(

View file

@ -18,14 +18,14 @@ export class AddUserActivatedProperty1681134145996 implements ReversibleMigratio
AND r.scope = "workflow"`,
)) as UserSettings[];
const updatedUsers = activatedUsers.map(async (user) =>
queryRunner.query(
const updatedUserPromises = activatedUsers.map(async (user) => {
await queryRunner.query(
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`UPDATE ${tablePrefix}user SET settings = '${user.settings}' WHERE id = '${user.id}' `,
),
);
});
await Promise.all(updatedUsers);
await Promise.all(updatedUserPromises);
if (!activatedUsers.length) {
await queryRunner.query(

View file

@ -20,11 +20,11 @@ export class CredentialsRepository extends Repository<CredentialsEntity> {
credentialsId: credentialId,
userId: Not(In(userIds)),
};
return transaction.delete(SharedCredentials, conditions);
return await transaction.delete(SharedCredentials, conditions);
}
async findStartingWith(credentialName: string) {
return this.find({
return await this.find({
select: ['name'],
where: { name: Like(`${credentialName}%`) },
});
@ -37,7 +37,7 @@ export class CredentialsRepository extends Repository<CredentialsEntity> {
findManyOptions.where = { ...findManyOptions.where, id: In(credentialIds) };
}
return this.find(findManyOptions);
return await this.find(findManyOptions);
}
private toFindManyOptions(listQueryOptions?: ListQuery.Options) {
@ -84,6 +84,6 @@ export class CredentialsRepository extends Repository<CredentialsEntity> {
findManyOptions.relations = ['shared', 'shared.user', 'shared.role'];
}
return this.find(findManyOptions);
return await this.find(findManyOptions);
}
}

View file

@ -251,7 +251,10 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
* Permanently remove a single execution and its binary data.
*/
async hardDelete(ids: { workflowId: string; executionId: string }) {
return Promise.all([this.delete(ids.executionId), this.binaryDataService.deleteMany([ids])]);
return await Promise.all([
this.delete(ids.executionId),
this.binaryDataService.deleteMany([ids]),
]);
}
async updateStatus(executionId: string, status: ExecutionStatus) {
@ -438,7 +441,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
}
async getIdsSince(date: Date) {
return this.find({
return await this.find({
select: ['id'],
where: {
startedAt: MoreThanOrEqual(DateUtils.mixedDateToUtcDatetimeString(date)),
@ -474,7 +477,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
const [timeBasedWhere, countBasedWhere] = toPrune;
return this.createQueryBuilder()
return await this.createQueryBuilder()
.update(ExecutionEntity)
.set({ deletedAt: new Date() })
.where({
@ -516,7 +519,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
}
async deleteByIds(executionIds: string[]) {
return this.delete({ id: In(executionIds) });
return await this.delete({ id: In(executionIds) });
}
async getWaitingExecutions() {
@ -534,7 +537,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
where.waitTill = LessThanOrEqual(DateUtils.mixedDateToUtcDatetimeString(waitTill));
}
return this.findMultipleExecutions({
return await this.findMultipleExecutions({
select: ['id', 'waitTill'],
where,
order: {
@ -606,7 +609,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
where = { ...where, workflowId: In(params.workflowIds) };
}
return this.findMultipleExecutions(
return await this.findMultipleExecutions(
{
select: [
'id',
@ -636,7 +639,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
workflowIds: string[],
includeData?: boolean,
): Promise<IExecutionBase | undefined> {
return this.findSingleExecution(id, {
return await this.findSingleExecution(id, {
where: {
workflowId: In(workflowIds),
},
@ -646,7 +649,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
}
async findIfShared(executionId: string, sharedWorkflowIds: string[]) {
return this.findSingleExecution(executionId, {
return await this.findSingleExecution(executionId, {
where: {
workflowId: In(sharedWorkflowIds),
},

View file

@ -9,7 +9,7 @@ export class ExecutionDataRepository extends Repository<ExecutionData> {
}
async findByExecutionIds(executionIds: string[]) {
return this.find({
return await this.find({
select: ['workflowData'],
where: {
executionId: In(executionIds),

View file

@ -41,7 +41,7 @@ export class InstalledPackagesRepository extends Repository<InstalledPackages> {
installedPackage.installedNodes.push(installedNode);
return manager.save(installedNode);
return await manager.save(installedNode);
});
});

View file

@ -11,7 +11,7 @@ export class RoleRepository extends Repository<Role> {
}
async findRole(scope: RoleScopes, name: RoleNames) {
return this.findOne({ where: { scope, name } });
return await this.findOne({ where: { scope, name } });
}
/**
@ -34,7 +34,7 @@ export class RoleRepository extends Repository<Role> {
}
async getIdsInScopeWorkflowByNames(roleNames: RoleNames[]) {
return this.find({
return await this.find({
select: ['id'],
where: { name: In(roleNames), scope: 'workflow' },
}).then((role) => role.map(({ id }) => id));

View file

@ -25,7 +25,7 @@ export class SharedCredentialsRepository extends Repository<SharedCredentials> {
}
async findByCredentialIds(credentialIds: string[]) {
return this.find({
return await this.find({
relations: ['credentials', 'role', 'user'],
where: {
credentialsId: In(credentialIds),
@ -34,7 +34,7 @@ export class SharedCredentialsRepository extends Repository<SharedCredentials> {
}
async makeOwnerOfAllCredentials(user: User, role: Role) {
return this.update({ userId: Not(user.id), roleId: role.id }, { user });
return await this.update({ userId: Not(user.id), roleId: role.id }, { user });
}
/**
@ -58,11 +58,11 @@ export class SharedCredentialsRepository extends Repository<SharedCredentials> {
// If credential sharing is not enabled, get only credentials owned by this user
if (roleId) where.roleId = roleId;
return this.find({ where });
return await this.find({ where });
}
async deleteByIds(transaction: EntityManager, sharedCredentialsIds: string[], user?: User) {
return transaction.delete(SharedCredentials, {
return await transaction.delete(SharedCredentials, {
user,
credentialsId: In(sharedCredentialsIds),
});

View file

@ -20,7 +20,7 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
if (!user.hasGlobalScope('workflow:read')) {
where.userId = user.id;
}
return this.exist({ where });
return await this.exist({ where });
}
async getSharedWorkflowIds(workflowIds: string[]) {
@ -34,7 +34,7 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
}
async findByWorkflowIds(workflowIds: string[]) {
return this.find({
return await this.find({
relations: ['role', 'user'],
where: {
role: {
@ -68,11 +68,11 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
if (extraRelations) relations.push(...extraRelations);
return this.findOne({ relations, where });
return await this.findOne({ relations, where });
}
async makeOwnerOfAllWorkflows(user: User, role: Role) {
return this.update({ userId: Not(user.id), roleId: role.id }, { user });
return await this.update({ userId: Not(user.id), roleId: role.id }, { user });
}
async getSharing(
@ -90,7 +90,7 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
where.userId = user.id;
}
return this.findOne({ where, relations });
return await this.findOne({ where, relations });
}
async getSharedWorkflows(
@ -100,7 +100,7 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
workflowIds?: string[];
},
): Promise<SharedWorkflow[]> {
return this.find({
return await this.find({
where: {
...(!['owner', 'admin'].includes(user.globalRole.name) && { userId: user.id }),
...(options.workflowIds && { workflowId: In(options.workflowIds) }),
@ -123,11 +123,11 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
return acc;
}, []);
return transaction.save(newSharedWorkflows);
return await transaction.save(newSharedWorkflows);
}
async findWithFields(workflowIds: string[], { fields }: { fields: string[] }) {
return this.find({
return await this.find({
where: {
workflowId: In(workflowIds),
},
@ -136,7 +136,7 @@ export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
}
async deleteByIds(transaction: EntityManager, sharedWorkflowIds: string[], user?: User) {
return transaction.delete(SharedWorkflow, {
return await transaction.delete(SharedWorkflow, {
user,
workflowId: In(sharedWorkflowIds),
});

View file

@ -12,7 +12,7 @@ export class TagRepository extends Repository<TagEntity> {
}
async findMany(tagIds: string[]) {
return this.find({
return await this.find({
select: ['id', 'name'],
where: { id: In(tagIds) },
});

View file

@ -11,7 +11,7 @@ export class UserRepository extends Repository<User> {
}
async findManybyIds(userIds: string[]) {
return this.find({
return await this.find({
where: { id: In(userIds) },
relations: ['globalRole'],
});
@ -22,11 +22,11 @@ export class UserRepository extends Repository<User> {
}
async getByIds(transaction: EntityManager, ids: string[]) {
return transaction.find(User, { where: { id: In(ids) } });
return await transaction.find(User, { where: { id: In(ids) } });
}
async findManyByEmail(emails: string[]) {
return this.find({
return await this.find({
where: { email: In(emails) },
relations: ['globalRole'],
select: ['email', 'password', 'id'],
@ -34,11 +34,11 @@ export class UserRepository extends Repository<User> {
}
async deleteMany(userIds: string[]) {
return this.delete({ id: In(userIds) });
return await this.delete({ id: In(userIds) });
}
async findNonShellUser(email: string) {
return this.findOne({
return await this.findOne({
where: {
email,
password: Not(IsNull()),

View file

@ -26,14 +26,14 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
}
async get(where: FindOptionsWhere<WorkflowEntity>, options?: { relations: string[] }) {
return this.findOne({
return await this.findOne({
where,
relations: options?.relations,
});
}
async getAllActive() {
return this.find({
return await this.find({
where: { active: true },
relations: ['shared', 'shared.user', 'shared.user.globalRole', 'shared.role'],
});
@ -48,7 +48,7 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
}
async findById(workflowId: string) {
return this.findOne({
return await this.findOne({
where: { id: workflowId },
relations: ['shared', 'shared.user', 'shared.user.globalRole', 'shared.role'],
});
@ -61,7 +61,7 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
if (fields?.length) options.select = fields as FindOptionsSelect<WorkflowEntity>;
return this.find(options);
return await this.find(options);
}
async getActiveTriggerCount() {
@ -88,7 +88,7 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
workflowId: string,
userIds: string[],
): Promise<DeleteResult> {
return transaction.delete(SharedWorkflow, {
return await transaction.delete(SharedWorkflow, {
workflowId,
userId: Not(In(userIds)),
});
@ -96,7 +96,7 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
async updateWorkflowTriggerCount(id: string, triggerCount: number): Promise<UpdateResult> {
const qb = this.createQueryBuilder('workflow');
return qb
return await qb
.update()
.set({
triggerCount,
@ -185,35 +185,35 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
}
async findStartingWith(workflowName: string): Promise<Array<{ name: string }>> {
return this.find({
return await this.find({
select: ['name'],
where: { name: Like(`${workflowName}%`) },
});
}
async findIn(workflowIds: string[]) {
return this.find({
return await this.find({
select: ['id', 'name'],
where: { id: In(workflowIds) },
});
}
async findWebhookBasedActiveWorkflows() {
return this.createQueryBuilder('workflow')
return await (this.createQueryBuilder('workflow')
.select('DISTINCT workflow.id, workflow.name')
.innerJoin(WebhookEntity, 'webhook_entity', 'workflow.id = webhook_entity.workflowId')
.execute() as Promise<Array<{ id: string; name: string }>>;
.execute() as Promise<Array<{ id: string; name: string }>>);
}
async updateActiveState(workflowId: string, newState: boolean) {
return this.update({ id: workflowId }, { active: newState });
return await this.update({ id: workflowId }, { active: newState });
}
async deactivateAll() {
return this.update({ active: true }, { active: false });
return await this.update({ active: true }, { active: false });
}
async findByActiveState(activeState: boolean) {
return this.findBy({ active: activeState });
return await this.findBy({ active: activeState });
}
}

View file

@ -9,6 +9,6 @@ export class WorkflowHistoryRepository extends Repository<WorkflowHistory> {
}
async deleteEarlierThan(date: Date) {
return this.delete({ createdAt: LessThan(date) });
return await this.delete({ createdAt: LessThan(date) });
}
}

View file

@ -118,9 +118,9 @@ const createContext = (queryRunner: QueryRunner, migration: Migration): Migratio
namedParameters,
{},
);
return queryRunner.query(query, parameters) as Promise<T>;
return await (queryRunner.query(query, parameters) as Promise<T>);
} else {
return queryRunner.query(sql) as Promise<T>;
return await (queryRunner.query(sql) as Promise<T>);
}
},
runInBatches: async <T>(

View file

@ -121,7 +121,8 @@ export const registerController = (app: Application, controllerClass: Class<obje
const authRole = authRoles?.[handlerName] ?? authRoles?.['*'];
const features = licenseFeatures?.[handlerName] ?? licenseFeatures?.['*'];
const scopes = requiredScopes?.[handlerName] ?? requiredScopes?.['*'];
const handler = async (req: Request, res: Response) => controller[handlerName](req, res);
const handler = async (req: Request, res: Response) =>
await controller[handlerName](req, res);
router[method](
path,
...(authRole ? [createAuthMiddleware(authRole)] : []),

View file

@ -171,7 +171,7 @@ export class SourceControlService {
await this.initGitService();
}
await this.gitService.fetch();
return this.gitService.getBranches();
return await this.gitService.getBranches();
}
async setBranch(branch: string): Promise<{ branches: string[]; currentBranch: string }> {
@ -182,7 +182,7 @@ export class SourceControlService {
branchName: branch,
connected: branch?.length > 0,
});
return this.gitService.setBranch(branch);
return await this.gitService.setBranch(branch);
}
// will reset the branch to the remote branch and pull

View file

@ -95,7 +95,7 @@ export class SourceControlExportService {
owner: owners[e.id],
};
this.logger.debug(`Writing workflow ${e.id} to ${fileName}`);
return fsWriteFile(fileName, JSON.stringify(sanitizedWorkflow, null, 2));
return await fsWriteFile(fileName, JSON.stringify(sanitizedWorkflow, null, 2));
}),
);
}
@ -253,7 +253,7 @@ export class SourceControlExportService {
nodesAccess: sharedCredential.credentials.nodesAccess,
};
this.logger.debug(`Writing credential ${sharedCredential.credentials.id} to ${fileName}`);
return fsWriteFile(fileName, JSON.stringify(sanitizedCredential, null, 2));
return await fsWriteFile(fileName, JSON.stringify(sanitizedCredential, null, 2));
}),
);
return {

View file

@ -232,7 +232,7 @@ export class SourceControlGitService {
}
await this.git.checkout(branch);
await this.git.branch([`--set-upstream-to=${SOURCE_CONTROL_ORIGIN}/${branch}`, branch]);
return this.getBranches();
return await this.getBranches();
}
async getCurrentBranch(): Promise<{ current: string; remote: string }> {
@ -253,7 +253,7 @@ export class SourceControlGitService {
const currentBranch = await this.getCurrentBranch();
if (currentBranch.remote) {
const target = currentBranch.remote;
return this.git.diffSummary(['...' + target, '--ignore-all-space']);
return await this.git.diffSummary(['...' + target, '--ignore-all-space']);
}
return;
}
@ -265,7 +265,7 @@ export class SourceControlGitService {
const currentBranch = await this.getCurrentBranch();
if (currentBranch.remote) {
const target = currentBranch.current;
return this.git.diffSummary([target, '--ignore-all-space']);
return await this.git.diffSummary([target, '--ignore-all-space']);
}
return;
}
@ -274,7 +274,7 @@ export class SourceControlGitService {
if (!this.git) {
throw new ApplicationError('Git is not initialized (fetch)');
}
return this.git.fetch();
return await this.git.fetch();
}
async pull(options: { ffOnly: boolean } = { ffOnly: true }): Promise<PullResult> {
@ -286,7 +286,7 @@ export class SourceControlGitService {
// eslint-disable-next-line @typescript-eslint/naming-convention
Object.assign(params, { '--ff-only': true });
}
return this.git.pull(params);
return await this.git.pull(params);
}
async push(
@ -300,9 +300,9 @@ export class SourceControlGitService {
throw new ApplicationError('Git is not initialized ({)');
}
if (force) {
return this.git.push(SOURCE_CONTROL_ORIGIN, branch, ['-f']);
return await this.git.push(SOURCE_CONTROL_ORIGIN, branch, ['-f']);
}
return this.git.push(SOURCE_CONTROL_ORIGIN, branch);
return await this.git.push(SOURCE_CONTROL_ORIGIN, branch);
}
async stage(files: Set<string>, deletedFiles?: Set<string>): Promise<string> {
@ -316,7 +316,7 @@ export class SourceControlGitService {
this.logger.debug(`Git rm: ${(error as Error).message}`);
}
}
return this.git.add(Array.from(files));
return await this.git.add(Array.from(files));
}
async resetBranch(
@ -326,9 +326,9 @@ export class SourceControlGitService {
throw new ApplicationError('Git is not initialized (Promise)');
}
if (options?.hard) {
return this.git.raw(['reset', '--hard', options.target]);
return await this.git.raw(['reset', '--hard', options.target]);
}
return this.git.raw(['reset', options.target]);
return await this.git.raw(['reset', options.target]);
// built-in reset method does not work
// return this.git.reset();
}
@ -337,7 +337,7 @@ export class SourceControlGitService {
if (!this.git) {
throw new ApplicationError('Git is not initialized (commit)');
}
return this.git.commit(message);
return await this.git.commit(message);
}
async status(): Promise<StatusResult> {

View file

@ -186,7 +186,7 @@ export class SourceControlImportService {
}
public async getLocalVariablesFromDb(): Promise<Variables[]> {
return this.variablesService.getAllCached();
return await this.variablesService.getAllCached();
}
public async getRemoteTagsAndMappingsFromFile(): Promise<{

View file

@ -23,7 +23,7 @@ export class VariablesController {
@Get('/')
@RequireGlobalScope('variable:list')
async getVariables() {
return this.variablesService.getAllCached();
return await this.variablesService.getAllCached();
}
@Post('/')

View file

@ -18,7 +18,7 @@ export class VariablesService {
async getAllCached(): Promise<Variables[]> {
const variables = await this.cacheService.get('variables', {
async refreshFn() {
return Container.get(VariablesService).findAll();
return await Container.get(VariablesService).findAll();
},
});
return (variables as Array<Partial<Variables>>).map((v) => this.variablesRepository.create(v));
@ -49,7 +49,7 @@ export class VariablesService {
}
async findAll(): Promise<Variables[]> {
return this.variablesRepository.find();
return await this.variablesRepository.find();
}
validateVariable(variable: Omit<Variables, 'id'>): void {

Some files were not shown because too many files have changed in this diff Show more