Use json-rpc-peer & json-rpc-protocol instead of deprecated @julien-f/json-rpc.

This commit is contained in:
Julien Fontanet 2015-06-05 14:59:54 +02:00
parent f839e76f4b
commit 206dfeb879
3 changed files with 11 additions and 5 deletions

View File

@ -28,7 +28,6 @@
"url": "git://github.com/vatesfr/xo-server.git" "url": "git://github.com/vatesfr/xo-server.git"
}, },
"dependencies": { "dependencies": {
"@julien-f/json-rpc": "^0.4.4",
"@julien-f/unzip": "^0.2.1", "@julien-f/unzip": "^0.2.1",
"app-conf": "^0.3.4", "app-conf": "^0.3.4",
"babel-runtime": "^5", "babel-runtime": "^5",
@ -47,6 +46,8 @@
"http-server-plus": "^0.5.1", "http-server-plus": "^0.5.1",
"human-format": "^0.3.0", "human-format": "^0.3.0",
"js-yaml": "^3.2.7", "js-yaml": "^3.2.7",
"json-rpc-peer": "^0.9.2",
"json-rpc-protocol": "^0.9.0",
"lodash.assign": "^3.0.0", "lodash.assign": "^3.0.0",
"lodash.bind": "^3.0.0", "lodash.bind": "^3.0.0",
"lodash.clone": "^3.0.1", "lodash.clone": "^3.0.1",

View File

@ -1,9 +1,14 @@
import {JsonRpcError} from '@julien-f/json-rpc/errors' import {JsonRpcError} from 'json-rpc-protocol'
// =================================================================== // ===================================================================
// Export standard JSON-RPC errors. // Export standard JSON-RPC errors.
export * from '@julien-f/json-rpc/errors' export {
InvalidJson,
InvalidParameters,
InvalidRequest,
MethodNotFound
} from 'json-rpc-protocol'
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -26,7 +26,7 @@ import {
NoSuchObject, NoSuchObject,
NotImplemented NotImplemented
} from './api-errors' } from './api-errors'
import {createPeer as createJsonRpcPeer} from '@julien-f/json-rpc' import JsonRpcPeer from 'json-rpc-peer'
import {readFile} from 'fs-promise' import {readFile} from 'fs-promise'
import Api from './api' import Api from './api'
@ -254,7 +254,7 @@ const setUpApi = (webServer, xo) => {
}) })
// Create the JSON-RPC server for this connection. // Create the JSON-RPC server for this connection.
const jsonRpc = createJsonRpcPeer(message => { const jsonRpc = new JsonRpcPeer(message => {
if (message.type === 'request') { if (message.type === 'request') {
return api.call(connection, message.method, message.params) return api.call(connection, message.method, message.params)
} }