Remove types from VCS
This commit is contained in:
-23
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* A single JSON value. This is the missing return type of JSON.parse().
|
||||
*/
|
||||
export declare type JsonCompatibleValue =
|
||||
| JsonCompatibleDictionary
|
||||
| JsonCompatibleArray
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
/**
|
||||
* An array of JsonCompatibleValue
|
||||
*/
|
||||
export interface JsonCompatibleArray extends ReadonlyArray<JsonCompatibleValue> {}
|
||||
/**
|
||||
* A string to json value dictionary.
|
||||
*/
|
||||
export interface JsonCompatibleDictionary {
|
||||
readonly [key: string]: JsonCompatibleValue | readonly JsonCompatibleValue[];
|
||||
}
|
||||
export declare function isJsonCompatibleValue(value: unknown): value is JsonCompatibleValue;
|
||||
export declare function isJsonCompatibleArray(value: unknown): value is JsonCompatibleArray;
|
||||
export declare function isJsonCompatibleDictionary(data: unknown): data is JsonCompatibleDictionary;
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Creates a new ID to be used for creating a JSON-RPC request.
|
||||
*
|
||||
* Multiple calls of this produce unique values.
|
||||
*
|
||||
* The output may be any value compatible to JSON-RPC request IDs with an undefined output format and generation logic.
|
||||
*/
|
||||
export declare function makeJsonRpcId(): number;
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
export { makeJsonRpcId } from "./id";
|
||||
export { JsonRpcClient, SimpleMessagingConnection } from "./jsonrpcclient";
|
||||
export {
|
||||
parseJsonRpcId,
|
||||
parseJsonRpcRequest,
|
||||
parseJsonRpcResponse,
|
||||
parseJsonRpcErrorResponse,
|
||||
parseJsonRpcSuccessResponse,
|
||||
} from "./parse";
|
||||
export {
|
||||
isJsonRpcErrorResponse,
|
||||
isJsonRpcSuccessResponse,
|
||||
JsonRpcError,
|
||||
JsonRpcErrorResponse,
|
||||
JsonRpcId,
|
||||
JsonRpcRequest,
|
||||
JsonRpcResponse,
|
||||
JsonRpcSuccessResponse,
|
||||
jsonRpcCode,
|
||||
} from "./types";
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
import { Stream } from "xstream";
|
||||
import { JsonRpcRequest, JsonRpcResponse, JsonRpcSuccessResponse } from "./types";
|
||||
export interface SimpleMessagingConnection<Request, Response> {
|
||||
readonly responseStream: Stream<Response>;
|
||||
readonly sendRequest: (request: Request) => void;
|
||||
}
|
||||
/**
|
||||
* A thin wrapper that is used to bring together requests and responses by ID.
|
||||
*
|
||||
* Using this class is only advised for continous communication channels like
|
||||
* WebSockets or WebWorker messaging.
|
||||
*/
|
||||
export declare class JsonRpcClient {
|
||||
private readonly connection;
|
||||
constructor(connection: SimpleMessagingConnection<JsonRpcRequest, JsonRpcResponse>);
|
||||
run(request: JsonRpcRequest): Promise<JsonRpcSuccessResponse>;
|
||||
}
|
||||
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
import {
|
||||
JsonRpcErrorResponse,
|
||||
JsonRpcId,
|
||||
JsonRpcRequest,
|
||||
JsonRpcResponse,
|
||||
JsonRpcSuccessResponse,
|
||||
} from "./types";
|
||||
/**
|
||||
* Extracts ID field from request or response object.
|
||||
*
|
||||
* Returns `null` when no valid ID was found.
|
||||
*/
|
||||
export declare function parseJsonRpcId(data: unknown): JsonRpcId | null;
|
||||
export declare function parseJsonRpcRequest(data: unknown): JsonRpcRequest;
|
||||
/** Throws if data is not a JsonRpcErrorResponse */
|
||||
export declare function parseJsonRpcErrorResponse(data: unknown): JsonRpcErrorResponse;
|
||||
/** Throws if data is not a JsonRpcSuccessResponse */
|
||||
export declare function parseJsonRpcSuccessResponse(data: unknown): JsonRpcSuccessResponse;
|
||||
/**
|
||||
* Returns a JsonRpcErrorResponse if input can be parsed as a JSON-RPC error. Otherwise parses
|
||||
* input as JsonRpcSuccessResponse. Throws if input is neither a valid error nor success response.
|
||||
*/
|
||||
export declare function parseJsonRpcResponse(data: unknown): JsonRpcResponse;
|
||||
Vendored
-46
@@ -1,46 +0,0 @@
|
||||
import { JsonCompatibleArray, JsonCompatibleDictionary, JsonCompatibleValue } from "./compatibility";
|
||||
export declare type JsonRpcId = number | string;
|
||||
export interface JsonRpcRequest {
|
||||
readonly jsonrpc: "2.0";
|
||||
readonly id: JsonRpcId;
|
||||
readonly method: string;
|
||||
readonly params: JsonCompatibleArray | JsonCompatibleDictionary;
|
||||
}
|
||||
export interface JsonRpcSuccessResponse {
|
||||
readonly jsonrpc: "2.0";
|
||||
readonly id: JsonRpcId;
|
||||
readonly result: any;
|
||||
}
|
||||
export interface JsonRpcError {
|
||||
readonly code: number;
|
||||
readonly message: string;
|
||||
readonly data?: JsonCompatibleValue;
|
||||
}
|
||||
/**
|
||||
* And error object as described in https://www.jsonrpc.org/specification#error_object
|
||||
*/
|
||||
export interface JsonRpcErrorResponse {
|
||||
readonly jsonrpc: "2.0";
|
||||
readonly id: JsonRpcId | null;
|
||||
readonly error: JsonRpcError;
|
||||
}
|
||||
export declare type JsonRpcResponse = JsonRpcSuccessResponse | JsonRpcErrorResponse;
|
||||
export declare function isJsonRpcErrorResponse(response: JsonRpcResponse): response is JsonRpcErrorResponse;
|
||||
export declare function isJsonRpcSuccessResponse(
|
||||
response: JsonRpcResponse,
|
||||
): response is JsonRpcSuccessResponse;
|
||||
/**
|
||||
* Error codes as specified in JSON-RPC 2.0
|
||||
*
|
||||
* @see https://www.jsonrpc.org/specification#error_object
|
||||
*/
|
||||
export declare const jsonRpcCode: {
|
||||
parseError: number;
|
||||
invalidRequest: number;
|
||||
methodNotFound: number;
|
||||
invalidParams: number;
|
||||
internalError: number;
|
||||
serverError: {
|
||||
default: number;
|
||||
};
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
/// <reference lib="webworker" />
|
||||
export {};
|
||||
Reference in New Issue
Block a user