@toruslabs/openlogin-jrpc
Advanced tools
Comparing version 3.2.0 to 4.0.0
@@ -120,31 +120,29 @@ /******/ (() => { // webpackBootstrap | ||
/***/ 238: | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
/***/ 850: | ||
/***/ (() => { | ||
"use strict"; | ||
// EXPORTS | ||
__webpack_require__.d(__webpack_exports__, { | ||
"Pk": () => (/* binding */ createAsyncMiddleware), | ||
"O7": () => (/* binding */ createErrorMiddleware), | ||
"Rq": () => (/* binding */ createIdRemapMiddleware), | ||
"yh": () => (/* binding */ createLoggerMiddleware), | ||
"v0": () => (/* binding */ createScaffoldMiddleware), | ||
"AP": () => (/* binding */ createStreamMiddleware), | ||
"nE": () => (/* binding */ getRpcPromiseCallback) | ||
}); | ||
;// CONCATENATED MODULE: external "@toruslabs/openlogin-utils" | ||
const openlogin_utils_namespaceObject = require("@toruslabs/openlogin-utils"); | ||
// EXTERNAL MODULE: external "readable-stream" | ||
var external_readable_stream_ = __webpack_require__(44); | ||
// EXTERNAL MODULE: ./src/safeEventEmitter.ts + 1 modules | ||
var safeEventEmitter = __webpack_require__(388); | ||
// EXTERNAL MODULE: ./src/serializableError.ts + 1 modules | ||
var serializableError = __webpack_require__(794); | ||
;// CONCATENATED MODULE: ./src/jrpc.ts | ||
/***/ }), | ||
/***/ 883: | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "AP": () => (/* binding */ createStreamMiddleware), | ||
/* harmony export */ "O7": () => (/* binding */ createErrorMiddleware), | ||
/* harmony export */ "Pk": () => (/* binding */ createAsyncMiddleware), | ||
/* harmony export */ "Rq": () => (/* binding */ createIdRemapMiddleware), | ||
/* harmony export */ "nE": () => (/* binding */ getRpcPromiseCallback), | ||
/* harmony export */ "v0": () => (/* binding */ createScaffoldMiddleware), | ||
/* harmony export */ "yh": () => (/* binding */ createLoggerMiddleware) | ||
/* harmony export */ }); | ||
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44); | ||
/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var _safeEventEmitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(388); | ||
/* harmony import */ var _serializableError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(794); | ||
const getRpcPromiseCallback = function (resolve, reject) { | ||
@@ -167,3 +165,3 @@ let unwrapResult = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
if (typeof req.method !== "string" || !req.method) { | ||
res.error = new serializableError/* default */.Z({ | ||
res.error = new _serializableError__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z({ | ||
code: -32603, | ||
@@ -187,3 +185,3 @@ message: "invalid method" | ||
log.error(`OpenLogin - RPC Error thrown: ${error.message}`, error); | ||
res.error = new serializableError/* default */.Z({ | ||
res.error = new _serializableError__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z({ | ||
code: -32603, | ||
@@ -201,3 +199,3 @@ message: error.message | ||
} | ||
const events = new safeEventEmitter/* default */.Z(); | ||
const events = new _safeEventEmitter__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z(); | ||
function processResponse(res) { | ||
@@ -233,3 +231,3 @@ const context = idMap[res.id]; | ||
} | ||
const stream = new external_readable_stream_.Duplex({ | ||
const stream = new readable_stream__WEBPACK_IMPORTED_MODULE_0__.Duplex({ | ||
objectMode: true, | ||
@@ -275,3 +273,3 @@ read: readNoop, | ||
const originalId = req.id; | ||
const newId = (0,openlogin_utils_namespaceObject.randomId)(); | ||
const newId = Math.random().toString(36).slice(2); | ||
req.id = newId; | ||
@@ -492,2 +490,26 @@ res.id = newId; | ||
/** | ||
* Handle an array of JSON-RPC requests, and return an array of responses. | ||
* | ||
* @param request - The requests to handle. | ||
* @param callback - An error-first callback that will receive the array of | ||
* responses. | ||
*/ | ||
/** | ||
* Handle a JSON-RPC request, and return a response. | ||
* | ||
* @param request - The request to handle. | ||
* @returns A promise that resolves with the response, or rejects with an | ||
* error. | ||
*/ | ||
/** | ||
* Handle an array of JSON-RPC requests, and return an array of responses. | ||
* | ||
* @param request - The requests to handle. | ||
* @returns A promise that resolves with the array of responses, or rejects | ||
* with an error. | ||
*/ | ||
handle(req, cb) { | ||
@@ -541,2 +563,6 @@ if (cb && typeof cb !== "function") { | ||
/** | ||
* Like _handle, but for batch requests. | ||
*/ | ||
async _handleBatch(reqs, cb) { | ||
@@ -1050,9 +1076,2 @@ // The order here is important | ||
/***/ 337: | ||
/***/ (() => { | ||
/***/ }), | ||
/***/ 195: | ||
@@ -1149,33 +1168,33 @@ /***/ ((module) => { | ||
/* harmony export */ "BasePostMessageStream": () => (/* reexport safe */ _basePostMessageStream__WEBPACK_IMPORTED_MODULE_0__.Z), | ||
/* harmony export */ "IGNORE_SUBSTREAM": () => (/* reexport safe */ _mux__WEBPACK_IMPORTED_MODULE_3__.yN), | ||
/* harmony export */ "JRPCEngine": () => (/* reexport safe */ _jrpcEngine__WEBPACK_IMPORTED_MODULE_2__.eI), | ||
/* harmony export */ "ObjectMultiplex": () => (/* reexport safe */ _mux__WEBPACK_IMPORTED_MODULE_3__.O4), | ||
/* harmony export */ "PostMessageStream": () => (/* reexport safe */ _postMessageStream__WEBPACK_IMPORTED_MODULE_4__.Z), | ||
/* harmony export */ "SafeEventEmitter": () => (/* reexport safe */ _safeEventEmitter__WEBPACK_IMPORTED_MODULE_5__.Z), | ||
/* harmony export */ "SerializableError": () => (/* reexport safe */ _serializableError__WEBPACK_IMPORTED_MODULE_6__.Z), | ||
/* harmony export */ "Substream": () => (/* reexport safe */ _substream__WEBPACK_IMPORTED_MODULE_7__.Z), | ||
/* harmony export */ "createAsyncMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.Pk), | ||
/* harmony export */ "createEngineStream": () => (/* reexport safe */ _jrpcEngine__WEBPACK_IMPORTED_MODULE_2__.QK), | ||
/* harmony export */ "createErrorMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.O7), | ||
/* harmony export */ "createIdRemapMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.Rq), | ||
/* harmony export */ "createLoggerMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.yh), | ||
/* harmony export */ "createScaffoldMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.v0), | ||
/* harmony export */ "createStreamMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.AP), | ||
/* harmony export */ "getRpcPromiseCallback": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_1__.nE), | ||
/* harmony export */ "mergeMiddleware": () => (/* reexport safe */ _jrpcEngine__WEBPACK_IMPORTED_MODULE_2__.UZ), | ||
/* harmony export */ "setupMultiplex": () => (/* reexport safe */ _mux__WEBPACK_IMPORTED_MODULE_3__.V2) | ||
/* harmony export */ "IGNORE_SUBSTREAM": () => (/* reexport safe */ _mux__WEBPACK_IMPORTED_MODULE_4__.yN), | ||
/* harmony export */ "JRPCEngine": () => (/* reexport safe */ _jrpcEngine__WEBPACK_IMPORTED_MODULE_3__.eI), | ||
/* harmony export */ "ObjectMultiplex": () => (/* reexport safe */ _mux__WEBPACK_IMPORTED_MODULE_4__.O4), | ||
/* harmony export */ "PostMessageStream": () => (/* reexport safe */ _postMessageStream__WEBPACK_IMPORTED_MODULE_5__.Z), | ||
/* harmony export */ "SafeEventEmitter": () => (/* reexport safe */ _safeEventEmitter__WEBPACK_IMPORTED_MODULE_6__.Z), | ||
/* harmony export */ "SerializableError": () => (/* reexport safe */ _serializableError__WEBPACK_IMPORTED_MODULE_7__.Z), | ||
/* harmony export */ "Substream": () => (/* reexport safe */ _substream__WEBPACK_IMPORTED_MODULE_8__.Z), | ||
/* harmony export */ "createAsyncMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.Pk), | ||
/* harmony export */ "createEngineStream": () => (/* reexport safe */ _jrpcEngine__WEBPACK_IMPORTED_MODULE_3__.QK), | ||
/* harmony export */ "createErrorMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.O7), | ||
/* harmony export */ "createIdRemapMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.Rq), | ||
/* harmony export */ "createLoggerMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.yh), | ||
/* harmony export */ "createScaffoldMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.v0), | ||
/* harmony export */ "createStreamMiddleware": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.AP), | ||
/* harmony export */ "getRpcPromiseCallback": () => (/* reexport safe */ _jrpc__WEBPACK_IMPORTED_MODULE_2__.nE), | ||
/* harmony export */ "mergeMiddleware": () => (/* reexport safe */ _jrpcEngine__WEBPACK_IMPORTED_MODULE_3__.UZ), | ||
/* harmony export */ "setupMultiplex": () => (/* reexport safe */ _mux__WEBPACK_IMPORTED_MODULE_4__.V2) | ||
/* harmony export */ }); | ||
/* harmony import */ var _basePostMessageStream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(393); | ||
/* harmony import */ var _jrpc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(238); | ||
/* harmony import */ var _jrpcEngine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(929); | ||
/* harmony import */ var _mux__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(376); | ||
/* harmony import */ var _postMessageStream__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(568); | ||
/* harmony import */ var _safeEventEmitter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(388); | ||
/* harmony import */ var _serializableError__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(794); | ||
/* harmony import */ var _substream__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(486); | ||
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(337); | ||
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_utils__WEBPACK_IMPORTED_MODULE_8__); | ||
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(850); | ||
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_interfaces__WEBPACK_IMPORTED_MODULE_1__); | ||
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; | ||
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _utils__WEBPACK_IMPORTED_MODULE_8__) if(["default","BasePostMessageStream","PostMessageStream","SafeEventEmitter","SerializableError","Substream","createAsyncMiddleware","createErrorMiddleware","createIdRemapMiddleware","createLoggerMiddleware","createScaffoldMiddleware","createStreamMiddleware","getRpcPromiseCallback","JRPCEngine","createEngineStream","mergeMiddleware","IGNORE_SUBSTREAM","ObjectMultiplex","setupMultiplex"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _utils__WEBPACK_IMPORTED_MODULE_8__[__WEBPACK_IMPORT_KEY__] | ||
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interfaces__WEBPACK_IMPORTED_MODULE_1__) if(["default","BasePostMessageStream","PostMessageStream","SafeEventEmitter","SerializableError","Substream"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interfaces__WEBPACK_IMPORTED_MODULE_1__[__WEBPACK_IMPORT_KEY__] | ||
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); | ||
/* harmony import */ var _jrpc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(883); | ||
/* harmony import */ var _jrpcEngine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(929); | ||
/* harmony import */ var _mux__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(376); | ||
/* harmony import */ var _postMessageStream__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(568); | ||
/* harmony import */ var _safeEventEmitter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(388); | ||
/* harmony import */ var _serializableError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(794); | ||
/* harmony import */ var _substream__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(486); | ||
@@ -1182,0 +1201,0 @@ |
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import { Duplex } from 'readable-stream'; | ||
import { randomId } from '@toruslabs/openlogin-utils'; | ||
import { EventEmitter } from 'events'; | ||
@@ -327,3 +326,3 @@ import stringify from 'fast-safe-stringify'; | ||
const originalId = req.id; | ||
const newId = randomId(); | ||
const newId = Math.random().toString(36).slice(2); | ||
req.id = newId; | ||
@@ -330,0 +329,0 @@ res.id = newId; |
export { default as BasePostMessageStream } from "./basePostMessageStream"; | ||
export * from "./interfaces"; | ||
export * from "./jrpc"; | ||
@@ -9,2 +10,1 @@ export * from "./jrpcEngine"; | ||
export { default as Substream } from "./substream"; | ||
export * from "./utils"; |
import { Duplex } from "readable-stream"; | ||
import { AsyncJRPCMiddleware, ConsoleLike, JRPCMiddleware, JRPCResponse, Json } from "./interfaces"; | ||
import SafeEventEmitter from "./safeEventEmitter"; | ||
export type Json = boolean | number | string | null | { | ||
[property: string]: Json; | ||
} | Json[]; | ||
export type JRPCVersion = "2.0"; | ||
export type JRPCId = number | string | void; | ||
export type ConsoleLike = Pick<Console, "log" | "warn" | "error" | "debug" | "info" | "trace">; | ||
export interface JRPCBase { | ||
jsonrpc?: JRPCVersion; | ||
id?: JRPCId; | ||
} | ||
export interface JRPCResponse<T> extends JRPCBase { | ||
result?: T; | ||
error?: any; | ||
} | ||
export declare const getRpcPromiseCallback: (resolve: (value?: any) => void, reject: (error?: Error) => void, unwrapResult?: boolean) => (error: Error, response: JRPCResponse<unknown>) => void; | ||
export interface JRPCRequest<T> extends JRPCBase { | ||
method: string; | ||
params?: T; | ||
} | ||
export type JRPCEngineNextCallback = (cb?: (done: (error?: Error) => void) => void) => void; | ||
export type JRPCEngineEndCallback = (error?: Error) => void; | ||
export type JRPCEngineReturnHandler = (done: (error?: Error) => void) => void; | ||
export type JRPCMiddleware<T, U> = (req: JRPCRequest<T>, res: JRPCResponse<U>, next: JRPCEngineNextCallback, end: JRPCEngineEndCallback) => void; | ||
export declare function createErrorMiddleware(log: ConsoleLike): JRPCMiddleware<unknown, unknown>; | ||
@@ -38,22 +17,3 @@ export declare function createStreamMiddleware(): { | ||
export declare function createLoggerMiddleware(logger: ConsoleLike): JRPCMiddleware<unknown, unknown>; | ||
export type AsyncJRPCEngineNextCallback = () => Promise<void>; | ||
type Maybe<T> = Partial<T> | null | undefined; | ||
export interface JRPCSuccess<T> extends JRPCBase { | ||
result: Maybe<T>; | ||
} | ||
export interface JRPCError { | ||
code: number; | ||
message: string; | ||
data?: unknown; | ||
stack?: string; | ||
} | ||
export interface PendingJRPCResponse<T> extends JRPCBase { | ||
result?: T; | ||
error?: Error | JRPCError; | ||
} | ||
export interface JRPCFailure extends JRPCBase { | ||
error: JRPCError; | ||
} | ||
export type AsyncJRPCMiddleware<T, U> = (req: JRPCRequest<T>, res: PendingJRPCResponse<U>, next: AsyncJRPCEngineNextCallback) => Promise<void>; | ||
export declare function createAsyncMiddleware<T, U>(asyncMiddleware: AsyncJRPCMiddleware<T, U>): JRPCMiddleware<T, U>; | ||
export {}; |
import { Duplex } from "readable-stream"; | ||
import { JRPCMiddleware, JRPCRequest, JRPCResponse } from "./jrpc"; | ||
import { JRPCMiddleware, JRPCRequest, JRPCResponse } from "./interfaces"; | ||
import SafeEventEmitter from "./safeEventEmitter"; | ||
@@ -4,0 +4,0 @@ /** |
/// <reference types="node" /> | ||
import { BufferEncoding } from "@toruslabs/openlogin-utils"; | ||
import { Duplex } from "readable-stream"; | ||
import type { Readable, Writable } from "stream"; | ||
import { BufferEncoding } from "./interfaces"; | ||
import Substream from "./substream"; | ||
@@ -6,0 +6,0 @@ export declare const IGNORE_SUBSTREAM: unique symbol; |
@@ -1,3 +0,3 @@ | ||
import { BufferEncoding } from "@toruslabs/openlogin-utils"; | ||
import { Duplex } from "readable-stream"; | ||
import { BufferEncoding } from "./interfaces"; | ||
export default class Substream extends Duplex { | ||
@@ -4,0 +4,0 @@ private readonly _parent; |
{ | ||
"name": "@toruslabs/openlogin-jrpc", | ||
"version": "3.2.0", | ||
"version": "4.0.0", | ||
"homepage": "https://github.com/torusresearch/OpenLoginSdk#readme", | ||
@@ -23,3 +23,3 @@ "license": "ISC", | ||
"dependencies": { | ||
"@toruslabs/openlogin-utils": "^3.0.0", | ||
"@toruslabs/openlogin-utils": "^4.0.0", | ||
"end-of-stream": "^1.4.4", | ||
@@ -63,3 +63,3 @@ "eth-rpc-errors": "^4.0.3", | ||
}, | ||
"gitHead": "72ce70a74211749db5e0dc2f859c79658f63b5ad" | ||
"gitHead": "dbb238b951f30fe8d6bb6656c93978870a890182" | ||
} |
export { default as BasePostMessageStream } from "./basePostMessageStream"; | ||
export * from "./interfaces"; | ||
export * from "./jrpc"; | ||
@@ -9,2 +10,1 @@ export * from "./jrpcEngine"; | ||
export { default as Substream } from "./substream"; | ||
export * from "./utils"; |
@@ -1,23 +0,7 @@ | ||
import { randomId } from "@toruslabs/openlogin-utils"; | ||
import { Duplex } from "readable-stream"; | ||
import { AsyncJRPCMiddleware, ConsoleLike, IdMap, JRPCMiddleware, JRPCRequest, JRPCResponse, Json, ReturnHandlerCallback } from "./interfaces"; | ||
import SafeEventEmitter from "./safeEventEmitter"; | ||
import SerializableError from "./serializableError"; | ||
export type Json = boolean | number | string | null | { [property: string]: Json } | Json[]; | ||
export type JRPCVersion = "2.0"; | ||
export type JRPCId = number | string | void; | ||
export type ConsoleLike = Pick<Console, "log" | "warn" | "error" | "debug" | "info" | "trace">; | ||
export interface JRPCBase { | ||
jsonrpc?: JRPCVersion; | ||
id?: JRPCId; | ||
} | ||
export interface JRPCResponse<T> extends JRPCBase { | ||
result?: T; | ||
error?: any; | ||
} | ||
export const getRpcPromiseCallback = | ||
@@ -35,24 +19,2 @@ (resolve: (value?: any) => void, reject: (error?: Error) => void, unwrapResult = true) => | ||
export interface JRPCRequest<T> extends JRPCBase { | ||
method: string; | ||
params?: T; | ||
} | ||
export type JRPCEngineNextCallback = (cb?: (done: (error?: Error) => void) => void) => void; | ||
export type JRPCEngineEndCallback = (error?: Error) => void; | ||
export type JRPCEngineReturnHandler = (done: (error?: Error) => void) => void; | ||
interface IdMapValue { | ||
req: JRPCRequest<unknown>; | ||
res: JRPCResponse<unknown>; | ||
next: JRPCEngineNextCallback; | ||
end: JRPCEngineEndCallback; | ||
} | ||
interface IdMap { | ||
[requestId: string]: IdMapValue; | ||
} | ||
export type JRPCMiddleware<T, U> = (req: JRPCRequest<T>, res: JRPCResponse<U>, next: JRPCEngineNextCallback, end: JRPCEngineEndCallback) => void; | ||
export function createErrorMiddleware(log: ConsoleLike): JRPCMiddleware<unknown, unknown> { | ||
@@ -166,3 +128,3 @@ return (req, res, next, end) => { | ||
const originalId = req.id; | ||
const newId = randomId(); | ||
const newId = Math.random().toString(36).slice(2); | ||
req.id = newId; | ||
@@ -185,30 +147,2 @@ res.id = newId; | ||
export type AsyncJRPCEngineNextCallback = () => Promise<void>; | ||
type Maybe<T> = Partial<T> | null | undefined; | ||
export interface JRPCSuccess<T> extends JRPCBase { | ||
result: Maybe<T>; | ||
} | ||
export interface JRPCError { | ||
code: number; | ||
message: string; | ||
data?: unknown; | ||
stack?: string; | ||
} | ||
export interface PendingJRPCResponse<T> extends JRPCBase { | ||
result?: T; | ||
error?: Error | JRPCError; | ||
} | ||
export interface JRPCFailure extends JRPCBase { | ||
error: JRPCError; | ||
} | ||
export type AsyncJRPCMiddleware<T, U> = (req: JRPCRequest<T>, res: PendingJRPCResponse<U>, next: AsyncJRPCEngineNextCallback) => Promise<void>; | ||
type ReturnHandlerCallback = (error: null | Error) => void; | ||
export function createAsyncMiddleware<T, U>(asyncMiddleware: AsyncJRPCMiddleware<T, U>): JRPCMiddleware<T, U> { | ||
@@ -215,0 +149,0 @@ return async (req, res, next, end) => { |
import { serializeError } from "eth-rpc-errors"; | ||
import { Duplex } from "readable-stream"; | ||
import { JRPCEngineEndCallback, JRPCEngineNextCallback, JRPCEngineReturnHandler, JRPCMiddleware, JRPCRequest, JRPCResponse } from "./jrpc"; | ||
import { JRPCEngineEndCallback, JRPCEngineNextCallback, JRPCEngineReturnHandler, JRPCMiddleware, JRPCRequest, JRPCResponse } from "./interfaces"; | ||
import SafeEventEmitter from "./safeEventEmitter"; | ||
@@ -6,0 +6,0 @@ import SerializableError from "./serializableError"; |
@@ -1,2 +0,1 @@ | ||
import { BufferEncoding } from "@toruslabs/openlogin-utils"; | ||
import eos from "end-of-stream"; | ||
@@ -8,2 +7,3 @@ import once from "once"; | ||
import { BufferEncoding } from "./interfaces"; | ||
import Substream from "./substream"; | ||
@@ -10,0 +10,0 @@ |
@@ -1,4 +0,5 @@ | ||
import { BufferEncoding } from "@toruslabs/openlogin-utils"; | ||
import { Duplex } from "readable-stream"; | ||
import { BufferEncoding } from "./interfaces"; | ||
export default class Substream extends Duplex { | ||
@@ -5,0 +6,0 @@ private readonly _parent: any; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
713148
3474
+ Added@toruslabs/openlogin-utils@4.7.0(transitive)
- Removed@toruslabs/openlogin-utils@3.0.0(transitive)
- Removedkeccak@3.0.4(transitive)
- Removednode-addon-api@2.0.2(transitive)
- Removednode-gyp-build@4.8.2(transitive)
- Removedrandombytes@2.1.0(transitive)