forked from AGROSICA/agro-jsonrpc
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,277 additions
and
2,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 2016 | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"never" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
node_modules/ | ||
coverage/ | ||
coverage/ | ||
.nyc_output/ | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
language: node_js | ||
node_js: | ||
- 0.8 | ||
- 0.10 | ||
- 0.12 | ||
before_install: | ||
npm install -g npm@1.4.x | ||
- 8 | ||
- 10 | ||
|
||
after_script: | ||
npm run coveralls | ||
|
||
notifications: | ||
email: | ||
recipients: | ||
- dispatch@uber.com | ||
on_success: change | ||
on_failure: change | ||
email: | ||
recipients: | ||
- isv.damocles@gmail.com | ||
on_success: change | ||
on_failure: change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
The MIT License | ||
|
||
Portions Copyright (C) 2018 by David Ellis | ||
|
||
Portions Copyright (C) 2013 by Uber Technologies, Inc, David Ellis | ||
|
||
Portions Copyright (C) 2011 by Agrosica, Inc, David Ellis, Alain Rodriguez, Hector Lugo | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
#!/usr/bin/env node | ||
|
||
var repl = require('repl'); | ||
var commander = require('commander'); | ||
var l = require('lambda-js'); | ||
var jsonrpc = require('../lib/index'); | ||
var Client = jsonrpc.client; | ||
var TcpTransport = jsonrpc.transports.client.tcp; | ||
var HttpTransport = jsonrpc.transports.client.http; | ||
var repl = require('repl') | ||
var commander = require('commander') | ||
var l = require('lambda-js') | ||
var jsonrpc = require('../lib/index') | ||
var Client = jsonrpc.client | ||
var TcpTransport = jsonrpc.transports.client.tcp | ||
var HttpTransport = jsonrpc.transports.client.http | ||
|
||
commander | ||
.option('-s, --server <hostname>', 'The hostname the server is located on. (Default: "localhost")', 'localhost') | ||
.option('-p, --port <portnumber>', 'The port the server is bound to. (Default: 80)', 80) | ||
.option('-t, --tcp', 'Connects to the server via TCP instead of HTTP (Default: false)', false) | ||
.option('--path <path>', 'The path part of the URL, e.g. "/rpc" (Default: "/")', '/') | ||
.parse(process.argv); | ||
.option('-s, --server <hostname>', 'The hostname the server is located on. (Default: "localhost")', 'localhost') | ||
.option('-p, --port <portnumber>', 'The port the server is bound to. (Default: 80)', 80) | ||
.option('-t, --tcp', 'Connects to the server via TCP instead of HTTP (Default: false)', false) | ||
.option('--path <path>', 'The path part of the URL, e.g. "/rpc" (Default: "/")', '/') | ||
.parse(process.argv) | ||
|
||
var Transport = commander.tcp ? TcpTransport : HttpTransport; | ||
var Transport = commander.tcp ? TcpTransport : HttpTransport | ||
|
||
new Client(new Transport(commander.server, commander.port, { path: commander.path }), {}, function(client) { | ||
console.log('Connected to ' + commander.server + ':' + commander.port + commander.path + ' over ' + (commander.tcp ? 'TCP' : 'HTTP')); | ||
console.log('The server reported the following methods:'); | ||
console.log(Object.getOwnPropertyNames(client).filter(l('name', 'name !== "transport"')).join(', ')); | ||
console.log('Access them with `rpc.foo(arg1, arg2, callbackFunction)`'); | ||
var r = repl.start({ prompt: 'jsonrpc> ', useGlobal: true }); | ||
r.context.rpc = client; | ||
r.on('exit', process.exit.bind(process)); | ||
}); | ||
/* eslint-disable no-console */ | ||
console.log('Connected to ' + commander.server + ':' + commander.port + commander.path + ' over ' + (commander.tcp ? 'TCP' : 'HTTP')) | ||
console.log('The server reported the following methods:') | ||
console.log(Object.getOwnPropertyNames(client).filter(l('name', 'name !== "transport"')).join(', ')) | ||
console.log('Access them with `rpc.foo(arg1, arg2, callbackFunction)`') | ||
/* eslint-enable no-console */ | ||
var r = repl.start({ prompt: 'jsonrpc> ', useGlobal: true }) | ||
r.context.rpc = client | ||
r.on('exit', process.exit.bind(process)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
module.exports = { | ||
paserError: -32700, | ||
invalidRequest: -32600, | ||
methodNotFound: -32601, | ||
invalidParams: -32602, | ||
internalError: -32603, | ||
serverErrorStart: -32000, | ||
serverErrorLast: -32099 | ||
}; | ||
paserError: -32700, | ||
invalidRequest: -32600, | ||
methodNotFound: -32601, | ||
invalidParams: -32602, | ||
internalError: -32603, | ||
serverErrorStart: -32000, | ||
serverErrorLast: -32099 | ||
} | ||
|
Oops, something went wrong.