*Add dist
This commit is contained in:
parent
eb2d441670
commit
890d593cff
|
@ -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<Uint8Array>) => void) => Promise<RPCResponse | null>;
|
||||
}
|
||||
export declare const RPC_REQUEST_SCHEMA: JSONSchemaType<RPCRequest>;
|
||||
export interface StreamFileResponse {
|
||||
data?: Uint8Array;
|
||||
done: boolean;
|
||||
}
|
||||
export interface PluginAPI {
|
||||
config: any;
|
||||
registerMethod: (methodName: string, method: RPCMethod) => void;
|
||||
loadPlugin: (moduleName: string) => Promise<Plugin>;
|
||||
getMethods: () => string[];
|
||||
}
|
||||
export declare type PluginFunction = (api: PluginAPI) => Promise<void>;
|
||||
export interface Plugin {
|
||||
name: string;
|
||||
plugin: PluginFunction;
|
||||
exports?: any;
|
||||
default?: Plugin;
|
||||
}
|
||||
export declare type RPCStreamHandler = (stream: AsyncIterable<Uint8Array>) => Promise<RPCResponse>;
|
||||
//# sourceMappingURL=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"}
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue