fix(core): Remove threads pkg, rewrite log writer worker (#5134)
This commit is contained in:
committed by
GitHub
parent
b7faf4a0df
commit
e845eb33f9
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { MessageEventBusDestinationTypeNames } from 'n8n-workflow';
|
||||
import type { EventDestinations } from '@/databases/entities/MessageEventBusDestinationEntity';
|
||||
import type { MessageEventBusDestination } from './MessageEventBusDestination.ee';
|
||||
@@ -10,7 +9,6 @@ import { MessageEventBusDestinationWebhook } from './MessageEventBusDestinationW
|
||||
export function messageEventBusDestinationFromDb(
|
||||
dbData: EventDestinations,
|
||||
): MessageEventBusDestination | null {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment
|
||||
const destinationData = dbData.destination;
|
||||
if ('__type' in destinationData) {
|
||||
switch (destinationData.__type) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import {
|
||||
INodeCredentials,
|
||||
@@ -83,7 +81,6 @@ export abstract class MessageEventBusDestination implements MessageEventBusDesti
|
||||
id: this.getId(),
|
||||
destination: this.serialize(),
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
||||
const dbResult: InsertResult = await Db.collections.EventDestinations.upsert(data, {
|
||||
skipUpdateIfNoValuesChanged: true,
|
||||
conflictPaths: ['id'],
|
||||
@@ -97,7 +94,6 @@ export abstract class MessageEventBusDestination implements MessageEventBusDesti
|
||||
}
|
||||
|
||||
static async deleteFromDb(id: string): Promise<DeleteResult> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
||||
const dbResult = await Db.collections.EventDestinations.delete({ id });
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ export class MessageEventBusDestinationSentry
|
||||
|
||||
constructor(options: MessageEventBusDestinationSentryOptions) {
|
||||
super(options);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
this.label = options.label ?? 'Sentry DSN';
|
||||
this.__type = options.__type ?? MessageEventBusDestinationTypeNames.sentry;
|
||||
this.dsn = options.dsn;
|
||||
@@ -85,7 +84,7 @@ export class MessageEventBusDestinationSentry
|
||||
);
|
||||
|
||||
if (sentryResult) {
|
||||
await eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
sendResult = true;
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -109,7 +108,6 @@ export class MessageEventBusDestinationSentry
|
||||
): MessageEventBusDestinationSentry | null {
|
||||
if (
|
||||
'__type' in data &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
data.__type === MessageEventBusDestinationTypeNames.sentry &&
|
||||
isMessageEventBusDestinationSentryOptions(data)
|
||||
) {
|
||||
|
||||
@@ -96,7 +96,7 @@ export class MessageEventBusDestinationSyslog
|
||||
if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
await eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
sendResult = true;
|
||||
}
|
||||
},
|
||||
@@ -112,7 +112,6 @@ export class MessageEventBusDestinationSyslog
|
||||
|
||||
serialize(): MessageEventBusDestinationSyslogOptions {
|
||||
const abstractSerialized = super.serialize();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
...abstractSerialized,
|
||||
expectedStatusCode: this.expectedStatusCode,
|
||||
|
||||
@@ -192,8 +192,6 @@ export class MessageEventBusDestinationWebhook
|
||||
} catch (_) {
|
||||
console.log('JSON parameter need to be an valid JSON');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
this.axiosRequestOptions.params = jsonParse(this.jsonQuery);
|
||||
}
|
||||
}
|
||||
@@ -212,8 +210,6 @@ export class MessageEventBusDestinationWebhook
|
||||
} catch (_) {
|
||||
console.log('JSON parameter need to be an valid JSON');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
this.axiosRequestOptions.headers = jsonParse(this.jsonHeaders);
|
||||
}
|
||||
}
|
||||
@@ -222,7 +218,6 @@ export class MessageEventBusDestinationWebhook
|
||||
if (this.axiosRequestOptions.headers === undefined) {
|
||||
this.axiosRequestOptions.headers = {};
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
this.axiosRequestOptions.headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
|
||||
@@ -336,10 +331,8 @@ export class MessageEventBusDestinationWebhook
|
||||
password: httpBasicAuth.password as string,
|
||||
};
|
||||
} else if (httpHeaderAuth) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
this.axiosRequestOptions.headers[httpHeaderAuth.name as string] = httpHeaderAuth.value;
|
||||
} else if (httpQueryAuth) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
this.axiosRequestOptions.params[httpQueryAuth.name as string] = httpQueryAuth.value;
|
||||
} else if (httpDigestAuth) {
|
||||
this.axiosRequestOptions.auth = {
|
||||
@@ -353,13 +346,13 @@ export class MessageEventBusDestinationWebhook
|
||||
if (requestResponse) {
|
||||
if (this.responseCodeMustMatch) {
|
||||
if (requestResponse.status === this.expectedStatusCode) {
|
||||
await eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
sendResult = true;
|
||||
} else {
|
||||
sendResult = false;
|
||||
}
|
||||
} else {
|
||||
await eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
eventBus.confirmSent(msg, { id: this.id, name: this.label });
|
||||
sendResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user