diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..45e0083 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,36 @@ +import type { JSONSchemaType } from "ajv"; +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; +} +export declare const RPC_REQUEST_SCHEMA: JSONSchemaType; +export interface StreamFileResponse { + data?: Uint8Array; + done: boolean; +} +export interface PluginAPI { + config: any; + registerMethod: (methodName: string, method: RPCMethod) => void; + loadPlugin: (moduleName: string) => Promise; + getMethods: () => string[]; +} +export declare type PluginFunction = (api: PluginAPI) => Promise; +export interface Plugin { + name: string; + plugin: PluginFunction; + exports?: any; + default?: Plugin; +} +export declare type RPCStreamHandler = (stream: AsyncIterable) => Promise; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map new file mode 100644 index 0000000..bf65f23 --- /dev/null +++ b/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CACP,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,KAAK,IAAI,KACpD,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAClC;AAGD,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,UAAU,CAiBzD,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,GAAG,CAAC;IACZ,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAChE,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,UAAU,EAAE,MAAM,MAAM,EAAE,CAAC;CAC5B;AAED,oBAAY,cAAc,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/D,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,gBAAgB,GAAG,CAC7B,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,KAC9B,OAAO,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..813b3bc --- /dev/null +++ b/dist/index.js @@ -0,0 +1,19 @@ +// @ts-ignore +export const RPC_REQUEST_SCHEMA = { + type: "object", + properties: { + module: { + type: "string", + }, + method: { + type: "string", + }, + data: { + type: ["number", "string", "boolean", "object", "array"], + }, + bypassCache: { + type: "boolean", + nullable: true, + }, + }, +};