@devgrid/netron
Version:
A powerful TypeScript library for building distributed systems with event bus, streaming capabilities, and remote object invocation. Features WebSocket-based bidirectional communication between Node.js and browser environments, service discovery, and type
68 lines (67 loc) • 1.75 kB
TypeScript
import { LoggerOptions, DestinationStream } from 'pino';
import { Definition } from './definition';
export type Abilities = {
services?: Map<string, Definition>;
allowServiceEvents?: boolean;
};
export type NetronOptions = {
id?: string;
listenHost?: string;
listenPort?: number;
taskTimeout?: number;
taskOverwriteStrategy?: 'replace' | 'skip' | 'throw';
connectTimeout?: number;
requestTimeout?: number;
streamTimeout?: number;
allowServiceEvents?: boolean;
maxReconnectAttempts?: number;
discoveryEnabled?: boolean;
discoveryRedisUrl?: string;
discoveryHeartbeatInterval?: number;
discoveryHeartbeatTTL?: number;
discoveryPubSubEnabled?: boolean;
loggerOptions?: LoggerOptions;
loggerDestination?: DestinationStream;
loggerContext?: Record<string, any>;
};
export type EventSubscriber = (...args: any[]) => void;
export interface ArgumentInfo {
index: number;
type: string;
}
export interface MethodInfo {
type: string;
arguments: ArgumentInfo[];
}
export interface PropertyInfo {
type: string;
readonly: boolean;
}
export interface ServiceMetadata {
name: string;
version: string;
properties: Record<string, PropertyInfo>;
methods: Record<string, MethodInfo>;
}
export type ServiceExposeEvent = {
name: string;
version: string;
qualifiedName: string;
peerId: string;
remotePeerId?: string;
definition: Definition;
};
export type ServiceUnexposeEvent = {
name: string;
version: string;
qualifiedName: string;
peerId: string;
remotePeerId?: string;
defId: string;
};
export type PeerConnectEvent = {
peerId: string;
};
export type PeerDisconnectEvent = {
peerId: string;
};