@webfaas/webfaas-core
Version:
WebFaaS Framework - Core
44 lines (43 loc) • 1.64 kB
TypeScript
import { IMessage } from "../MessageManager/IMessage";
export interface IMessageErrorDetail {
name: string;
[header: string]: any;
}
export interface IMessageError {
code: number;
message: string;
detail: IMessageErrorDetail;
}
export interface IJsonRpcResponse {
jsonrpc: string;
result: any;
error?: IMessageError;
id: string | number | null;
}
export interface IJsonRpcRequest {
jsonrpc?: string;
method: string;
params: any;
id: string | number | null;
}
export declare enum JsonRpcErrorTypeEnum {
PARSE_ERROR = -32700,
INVALID_REQUEST = -32600,
METHOD_NOT_FOUND = -32601,
INVALID_PARAMS = -32602,
INTERNAL_ERROR = -32603,
SERVER_ERROR = -32000
}
export declare class MessageUtil {
private static parseModuleInfo;
private static parseAuthorizationHeader;
static parseString(value: any): string;
static parseVersion(version: string): string;
static parseMessageByUrlPath(urlPath: string, urlBasePath: string, payload: any, http_method?: string, http_headers?: any): IMessage | null;
static parseJsonRpcResponseError(typeErrorOrCode: JsonRpcErrorTypeEnum | number, err: Error): IJsonRpcResponse;
static parseJsonRpcResponseSuccess(payload: any, id: string | number): IJsonRpcResponse;
static parseJsonRpcRequest(payload: any): IJsonRpcRequest;
static parseMessageByPayloadJsonRpc(payloadJsonRpcRequest: IJsonRpcRequest, http_urlPath?: string, http_method?: string, http_headers?: any): IMessage | null;
static convertErrorToCodeHttp(errSend: Error): number;
static convertErrorToCodeJsonRpc(errSend: Error): number;
}