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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -41,7 +41,7 @@ export class InstalledPackagesRepository extends Repository<InstalledPackages> {
|
||||
|
||||
installedPackage.installedNodes.push(installedNode);
|
||||
|
||||
return manager.save(installedNode);
|
||||
return await manager.save(installedNode);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
@@ -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) },
|
||||
});
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user