refactor(core): Move push message types to a new shared package (no-changelog) (#10742)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-13 13:02:00 +02:00
committed by GitHub
parent 7f1c131b72
commit 2f8c8448d3
56 changed files with 477 additions and 660 deletions

View File

@@ -1,3 +1,4 @@
import type { PushPayload, PushType } from '@n8n/api-types';
import { Request } from 'express';
import Container from 'typedi';
import { v4 as uuid } from 'uuid';
@@ -10,7 +11,7 @@ import { SettingsRepository } from '@/databases/repositories/settings.repository
import { UserRepository } from '@/databases/repositories/user.repository';
import { Patch, Post, RestController } from '@/decorators';
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
import type { BooleanLicenseFeature, IPushDataType, NumericLicenseFeature } from '@/interfaces';
import type { BooleanLicenseFeature, NumericLicenseFeature } from '@/interfaces';
import { License } from '@/license';
import { Logger } from '@/logger';
import { MfaService } from '@/mfa/mfa.service';
@@ -56,13 +57,13 @@ type ResetRequest = Request<
}
>;
type PushRequest = Request<
type PushRequest<T extends PushType> = Request<
{},
{},
{
type: IPushDataType;
type: T;
pushRef: string;
data: object;
data: PushPayload<T>;
}
>;
@@ -132,7 +133,7 @@ export class E2EController {
}
@Post('/push', { skipAuth: true })
async pushSend(req: PushRequest) {
async pushSend(req: PushRequest<any>) {
this.push.broadcast(req.body.type, req.body.data);
}