39 lines
1.6 KiB
TypeScript
39 lines
1.6 KiB
TypeScript
import { ClientProxy } from '@nestjs/microservices';
|
|
export declare class CoreService {
|
|
private readonly client;
|
|
private readonly logger;
|
|
private readonly serviceName;
|
|
private heartbeatInterval;
|
|
constructor(client: ClientProxy);
|
|
/**
|
|
* Спеціальний метод для виконання запитів до Ядра з автоматичним прокиданням авторизації
|
|
*/
|
|
fetchCore(endpoint: string, options?: RequestInit): Promise<any>;
|
|
register(): Promise<void>;
|
|
private startHeartbeatLoop;
|
|
emit<T>(pattern: string, payload: T): Promise<void>;
|
|
auditLog(action: string, resource: string, details?: any): Promise<void>;
|
|
getGlobalData<T = string>(key: string): Promise<T | null>;
|
|
setGlobalData(key: string, value: any): Promise<void>;
|
|
deleteGlobalData(key: string): Promise<void>;
|
|
sendNotification(payload: {
|
|
userId: number | null;
|
|
title: string;
|
|
message: string;
|
|
icon?: string;
|
|
image?: string;
|
|
details?: any;
|
|
}): Promise<void>;
|
|
/**
|
|
* Отримати назву БД, наданої ядром (має сенс після виклику setupDatabase)
|
|
*/
|
|
getDbName(): string;
|
|
/**
|
|
* Зареєструвати БД плагіна в ядрі (створює БД p_<id>, якщо ще не існує).
|
|
* Викликати ДО створення NestJS app, щоб TypeORM міг підхопити PLUGIN_DB_NAME.
|
|
*/
|
|
static setupDatabase(options: {
|
|
pluginId: string;
|
|
}): Promise<string>;
|
|
}
|