From c3476924905f6459eace265cee83f9e0005fbac1 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 28 Aug 2022 22:35:07 -0400 Subject: [PATCH] *Move code to types package --- src/types.ts | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/src/types.ts b/src/types.ts index 00e7a53..7593a6e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,27 +1,4 @@ import { JSONSchemaType } from "ajv"; -import { PluginApiManager } from "./plugin.js"; -import { RPCServer } from "./rpc/server.js"; - -export interface RPCRequest { - bypassCache?: boolean; - module: string; - method: string; - data: any; -} - -export interface RPCResponse { - updated?: number; - data?: any; - error?: string; -} - -export interface RPCMethod { - cacheable: boolean; - handler: ( - request: RPCRequest, - sendStream: (stream: AsyncIterable) => void - ) => Promise; -} // @ts-ignore export const RPC_REQUEST_SCHEMA: JSONSchemaType = { @@ -42,28 +19,3 @@ export const RPC_REQUEST_SCHEMA: JSONSchemaType = { }, }, }; - -export interface StreamFileResponse { - data?: Uint8Array; - done: boolean; -} - -export interface PluginAPI { - config: any; - registerMethod: (methodName: string, method: RPCMethod) => void; - loadPlugin: PluginApiManager["loadPlugin"]; - getMethods: RPCServer["getMethods"]; -} - -export type PluginFunction = (api: PluginAPI) => Promise; - -export interface Plugin { - name: string; - plugin: PluginFunction; - exports?: any; - default?: Plugin; -} - -export type RPCStreamHandler = ( - stream: AsyncIterable -) => Promise;