json-rpc-engine
Advanced tools
Comparing version 5.4.0 to 6.0.0
@@ -10,2 +10,23 @@ # Changelog | ||
## [6.0.0] - 2020-11-19 | ||
### Added | ||
- Add docstrings for public `JsonRpcEngine` methods ([#70](https://github.com/MetaMask/json-rpc-engine/pull/70)) | ||
### Changed | ||
- **(BREAKING)** Refactor exports ([#69](https://github.com/MetaMask/json-rpc-engine/pull/69)) | ||
- All exports are now named, and available via the package entry point. | ||
- All default exports have been removed. | ||
- **(BREAKING)** Convert `asMiddleware` to instance method ([#69](https://github.com/MetaMask/json-rpc-engine/pull/69)) | ||
- The `asMiddleware` export has been removed. | ||
- **(BREAKING)** Add runtime typechecks to `JsonRpcEngine.handle()`, and error responses if they fail ([#70](https://github.com/MetaMask/json-rpc-engine/pull/70)) | ||
- Requests will now error if: | ||
- The request is not a plain object, or if the `method` property is not a `string`. Empty strings are allowed. | ||
- A `next` middleware callback is called with a truthy, non-function parameter. | ||
- Migrate to TypeScript ([#69](https://github.com/MetaMask/json-rpc-engine/pull/69)) | ||
- Hopefully improve stack traces by removing uses of `Promise.then` and `.catch` internally ([#70](https://github.com/MetaMask/json-rpc-engine/pull/70)) | ||
- Make some internal `JsonRpcEngine` methods `static` ([#71](https://github.com/MetaMask/json-rpc-engine/pull/71)) | ||
## [5.4.0] - 2020-11-07 | ||
@@ -37,1 +58,15 @@ | ||
- In general, it is a bad practice to work with state that depends on middleware execution, while the middleware are executing. | ||
[Unreleased]:https://github.com/MetaMask/json-rpc-engine/compare/v6.0.0...HEAD | ||
[6.0.0]:https://github.com/MetaMask/json-rpc-engine/compare/v5.4.0...v6.0.0 | ||
[5.4.0]:https://github.com/MetaMask/json-rpc-engine/compare/v5.3.0...v5.4.0 | ||
[5.3.0]:https://github.com/MetaMask/json-rpc-engine/compare/v5.2.0...v5.3.0 | ||
[5.2.0]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.8...v5.2.0 | ||
[5.1.8]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.6...v5.1.8 | ||
[5.1.6]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.5...v5.1.6 | ||
[5.1.5]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.4...v5.1.5 | ||
[5.1.4]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.3...v5.1.4 | ||
[5.1.3]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.1...v5.1.3 | ||
[5.1.1]:https://github.com/MetaMask/json-rpc-engine/compare/v5.1.0...v5.1.1 | ||
[5.1.0]:https://github.com/MetaMask/json-rpc-engine/compare/v5.0.0...v5.1.0 | ||
[5.0.0]:https://github.com/MetaMask/json-rpc-engine/compare/v4.0.0...v5.0.0 |
{ | ||
"name": "json-rpc-engine", | ||
"version": "5.4.0", | ||
"description": "a tool for processing JSON RPC", | ||
"version": "6.0.0", | ||
"description": "A tool for processing JSON-RPC messages.", | ||
"license": "ISC", | ||
"author": "kumavis", | ||
"main": "src/index.js", | ||
"types": "src/index.d.ts", | ||
"main": "dist/index.js", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
}, | ||
"files": [ | ||
"src" | ||
"dist" | ||
], | ||
"scripts": { | ||
"lint": "eslint . --ext js,json", | ||
"lint:fix": "eslint . --ext js,json --fix", | ||
"build": "tsc --project .", | ||
"lint": "eslint . --ext ts,js,json", | ||
"lint:fix": "eslint . --ext ts,js,json --fix", | ||
"test": "mocha ./test", | ||
@@ -19,14 +22,19 @@ "coverage": "nyc --check-coverage yarn test" | ||
"dependencies": { | ||
"eth-rpc-errors": "^3.0.0", | ||
"safe-event-emitter": "^1.0.1" | ||
"@metamask/safe-event-emitter": "^2.0.0", | ||
"eth-rpc-errors": "^4.0.2" | ||
}, | ||
"devDependencies": { | ||
"@metamask/eslint-config": "^2.1.0", | ||
"eslint": "^6.8.0", | ||
"@metamask/eslint-config": "^4.1.0", | ||
"@types/node": "^14.14.7", | ||
"@typescript-eslint/eslint-plugin": "^4.8.0", | ||
"@typescript-eslint/parser": "^4.8.0", | ||
"eslint": "^7.13.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-json": "^2.1.0", | ||
"eslint-plugin-mocha": "^6.3.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"mocha": "^7.1.1", | ||
"nyc": "^15.0.0", | ||
"sinon": "^9.0.2" | ||
"nyc": "^15.1.0", | ||
"sinon": "^9.0.2", | ||
"typescript": "^4.0.5" | ||
}, | ||
@@ -45,4 +53,5 @@ "repository": { | ||
"contributors": [ | ||
"kumavis <aaron@kumavis.me>" | ||
"kumavis <aaron@kumavis.me>", | ||
"Erik Marks <rekmarks@protonmail.com>" | ||
] | ||
} |
@@ -8,5 +8,5 @@ # json-rpc-engine | ||
```js | ||
const RpcEngine = require('json-rpc-engine') | ||
const { JsonRpcEngine } = require('json-rpc-engine') | ||
let engine = new RpcEngine() | ||
let engine = new JsonRpcEngine() | ||
``` | ||
@@ -29,6 +29,6 @@ | ||
engine.handle(request, function(err, response){ | ||
// do something with response.result | ||
// Do something with response.result, or handle response.error | ||
}) | ||
// there is also a Promise signature | ||
// There is also a Promise signature | ||
const response = await engine.handle(request) | ||
@@ -58,10 +58,8 @@ ``` | ||
RpcEngines can be nested by converting them to middleware using `asMiddleware(engine)`: | ||
Engines can be nested by converting them to middleware using `JsonRpcEngine.asMiddleware()`: | ||
```js | ||
const asMiddleware = require('json-rpc-engine/src/asMiddleware') | ||
let engine = new RpcEngine() | ||
let subengine = new RpcEngine() | ||
engine.push(asMiddleware(subengine)) | ||
const engine = new JsonRpcEngine() | ||
const subengine = new JsonRpcEngine() | ||
engine.push(subengine.asMiddleware()) | ||
``` | ||
@@ -74,3 +72,3 @@ | ||
```js | ||
const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware') | ||
const { createAsyncMiddleware } = require('json-rpc-engine') | ||
@@ -77,0 +75,0 @@ let engine = new RpcEngine() |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
46394
20
598
13
146
1
+ Added@metamask/safe-event-emitter@2.0.0(transitive)
+ Addedeth-rpc-errors@4.0.3(transitive)
- Removedsafe-event-emitter@^1.0.1
- Removedeth-rpc-errors@3.0.0(transitive)
- Removedevents@3.3.0(transitive)
- Removedsafe-event-emitter@1.0.1(transitive)
Updatedeth-rpc-errors@^4.0.2