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:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -26,11 +26,12 @@ 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;`, {
|
||||
pinData: workflow.pinData,
|
||||
id: workflow.id,
|
||||
}),
|
||||
this.makeUpdateParams(workflows).map(
|
||||
async (workflow) =>
|
||||
await runQuery(`UPDATE ${tableName} SET ${columnName} = :pinData WHERE id = :id;`, {
|
||||
pinData: workflow.pinData,
|
||||
id: workflow.id,
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -18,13 +18,13 @@ export class RemoveWorkflowDataLoadedFlag1671726148419 implements ReversibleMigr
|
||||
await Promise.all(
|
||||
workflowIds.map(
|
||||
async ({ id, dataLoaded }) =>
|
||||
dataLoaded &&
|
||||
runQuery(
|
||||
`INSERT INTO ${statisticsTableName}
|
||||
await (dataLoaded &&
|
||||
runQuery(
|
||||
`INSERT INTO ${statisticsTableName}
|
||||
(${escape.columnName('workflowId')}, name, count, ${escape.columnName('latestEvent')})
|
||||
VALUES (:id, :name, 1, ${now})`,
|
||||
{ id, name: StatisticsNames.dataLoaded },
|
||||
),
|
||||
{ id, name: StatisticsNames.dataLoaded },
|
||||
)),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -47,10 +47,11 @@ export class RemoveWorkflowDataLoadedFlag1671726148419 implements ReversibleMigr
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
workflowsIds.map(async ({ workflowId }) =>
|
||||
runQuery(`UPDATE ${workflowTableName} SET ${columnName} = true WHERE id = :id`, {
|
||||
id: workflowId,
|
||||
}),
|
||||
workflowsIds.map(
|
||||
async ({ workflowId }) =>
|
||||
await runQuery(`UPDATE ${workflowTableName} SET ${columnName} = true WHERE id = :id`, {
|
||||
id: workflowId,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -47,10 +47,13 @@ export class PurgeInvalidWorkflowConnections1675940580449 implements Irreversibl
|
||||
});
|
||||
|
||||
// Update database with new connections
|
||||
return runQuery(`UPDATE ${workflowsTable} SET connections = :connections WHERE id = :id`, {
|
||||
connections: JSON.stringify(connections),
|
||||
id: workflow.id,
|
||||
});
|
||||
return await runQuery(
|
||||
`UPDATE ${workflowsTable} SET connections = :connections WHERE id = :id`,
|
||||
{
|
||||
connections: JSON.stringify(connections),
|
||||
id: workflow.id,
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>(
|
||||
|
||||
Reference in New Issue
Block a user