interface-relay/dist/plugin.d.ts

42 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-12-19 20:09:07 +00:00
import type { EventEmitter2 } from "eventemitter2";
2023-01-08 04:40:24 +00:00
import type { RPCMethod, RPCServer } from "./rpc.js";
import type { Logger } from "pino";
import type SSLManager from "./ssl.js";
2022-12-19 20:09:07 +00:00
import type { HDKey } from "micro-ed25519-hdkey";
2022-12-21 20:19:10 +00:00
import type Config from "@lumeweb/cfg";
2022-12-30 06:06:52 +00:00
import type { ProtocolManager } from "./swarm.js";
2023-01-08 04:40:24 +00:00
import type { Util } from "./util.js";
2022-12-15 09:47:36 +00:00
export type PluginFunction = (api: PluginAPI) => Promise<void>;
2022-11-26 07:54:14 +00:00
export interface Plugin {
name: string;
plugin: PluginFunction;
exports?: any;
default?: Plugin;
}
2022-12-19 20:13:43 +00:00
export declare class PluginAPI extends EventEmitter2 {
2022-12-19 20:09:07 +00:00
constructor({
config,
logger,
server,
swarm,
}: {
config: Config;
logger: Logger;
server: RPCServer;
swarm: any;
});
2023-01-08 04:40:24 +00:00
get util(): Util;
2022-12-19 20:09:07 +00:00
get swarm(): any;
get config(): Config;
2022-12-21 20:19:10 +00:00
get pluginConfig(): Config;
2022-12-19 20:09:07 +00:00
get logger(): Logger;
get rpcServer(): RPCServer;
get seed(): Uint8Array;
get identity(): HDKey;
get ssl(): SSLManager;
2022-12-30 06:06:52 +00:00
get protocols(): ProtocolManager;
2022-12-19 20:09:07 +00:00
loadPlugin(moduleName: string): (moduleName: string) => Promise<Plugin>;
registerMethod(methodName: string, method: RPCMethod): void;
2022-11-26 07:54:14 +00:00
}
//# sourceMappingURL=plugin.d.ts.map