@busy-hour/blaze
Version:
<h1 align='center'>🔥 Blaze</h1> <div align='center'> An event driven framework for 🔥 Hono.js </div>
37 lines (36 loc) • 2.85 kB
TypeScript
import type { ActionCallRecord, EventCallRecord } from '../../types/external';
export declare class BlazeBroker {
hasListener(eventName: string): boolean;
private validateEventName;
/**
* @description Call an action through the broker and return the result
* @param actionName name of the action that will be called
* @param body data that will be passed to the action
* @param params data that will be passed to the action
* @param headers data that will be passed to the action
* @param query data that will be passed to the action
*/
call<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T], V = U['result']>(actionName: T): Promise<V>;
call<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T], V = U['result']>(actionName: T, body: U['body']): Promise<V>;
call<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T], V = U['result']>(actionName: T, body: U['body'], params: U['params']): Promise<V>;
call<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T], V = U['result']>(actionName: T, body: U['body'], params: U['params'], headers: U['headers']): Promise<V>;
call<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T], V = U['result']>(actionName: T, body: U['body'], params: U['params'], headers: U['headers'], query: U['query']): Promise<V>;
/**
* @description Call an action through the broker asynchronously
* @param actionName name of the action that will be called
* @param body data that will be passed to the action
* @param params data that will be passed to the action
* @param headers data that will be passed to the action
* @param query data that will be passed to the action
*/
emit<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T]>(actionName: T, body: U['body']): boolean;
emit<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T]>(actionName: T, body: U['body'], params: U['params']): boolean;
emit<T extends keyof ActionCallRecord | (string & NonNullable<unknown>), U = ActionCallRecord[T]>(actionName: T, body: U['body'], params: U['params'], headers: U['headers']): boolean;
/**
* @description Call an action through the broker asynchronously
* @param eventName name of the action that will be called
* @param body data that will be passed to the evemt
*/
event<T extends keyof EventCallRecord | (string & NonNullable<unknown>)>(eventName: T): boolean;
event<T extends keyof EventCallRecord | (string & NonNullable<unknown>), U = EventCallRecord[T]>(eventName: T, body: U['body']): boolean;
}