{"name":"mschema-rpc","version":"0.5.1","description":"Minimalistic Remote Procedural Call library using mschema validation for remote method's input and output.","keywords":["rpc","remote","method","schema","mschema","validator"],"main":"index.js","directories":{"example":"examples","test":"tap test/"},"scripts":{"test":"tap test"},"repository":{"type":"git","url":"http://github.com/mschema/mschema-rpc.git"},"dependencies":{"mschema":"0.5.x"},"devDependencies":{"tap":"~0.4.4"},"author":{"name":"Marak Squires","email":"support@marak.com"},"license":"MIT","bugs":{"url":"https://github.com/mschema/mschema-rpc/issues"},"_id":"mschema-rpc@0.5.1","dist":{"shasum":"811f70b61b63a5dd83cc884aa81ca739f23560af","tarball":"http://registry-npm.ywwl.com/mschema-rpc/download/mschema-rpc-0.5.1.tgz","integrity":"sha512-HmlYHiNWGNnGLiLcU02+dkbJRg2PQ0OBcpD0tmOsXzUi6xEj74qvt9MvEw6SP7J1qgEOaHsnAJtH7dipj+NdfQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWCrwbQeFylnpmP11ZShXOlHpaqR/L2w+bNkqjzVcJ4AIgTJAJE1JReLBl0+i7MDe0xSU88OgNRNx1p9QzL6AFGPM="}],"size":6449,"noattachment":false,"key":"/mschema-rpc/-/mschema-rpc-0.5.1.tgz"},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"marak","email":"marak.squires@gmail.com"},"maintainers":[{"name":"marak","email":"marak.squires@gmail.com"}],"readme":"# mschema-rpc\n\n<img src=\"https://travis-ci.org/mschema/mschema-rpc.svg?branch=master\"/>\n\nMinimalistic [Remote Procedural Call](http://en.wikipedia.org/wiki/Remote_procedure_call) library using [mschema](http://mschema.org) validation for remote method's input and output.\n\n## Features\n\n - Provides validation to functions incoming arguments and outgoing results\n - Validation based on [mschema](http://mschema.org)\n\n# API\n\n### rpc.invoke(inputData, method, methodSchema, callback)\n\n### inputData\nthe input data to be sent to `method`\n\n### method\nthe method to be executed remotely\n\n### methodSchema\nthe schema to be used to validate the input and output of `method`\n\n**schema format**\n```json\n{\n  \"input\": {\n    \"key\": \"val\"\n  },\n  \"output\": {\n    \"key\": \"val\"\n  }\n}\n```\n*see: http://github.com/mschema/mschema for full schema format documentation*\n\n### callback\n\nthe callback to be executed after `method` has been invoked\n\n## Example\n\n```js \n\nvar rpc = require('mschema-rpc');\n\nvar fireSchema = {\n  \"description\": \"fires missle\",\n  \"input\": {\n    \"name\": \"string\",\n      \"power\": {\n        \"type\": \"string\",\n        \"enum\": [\"high\", \"medium\", \"low\"]\n      },\n      \"warheads\": {\n        \"type\": \"number\",\n        \"min\": 1,\n        \"max\": 8\n      }\n    },\n  \"output\": {\n    \"result\": \"string\"\n  }\n};\n\nfunction fireFn (input, callback) {\n  callback(null, 'weapon fired');\n}\n\nvar data = {\n  \"name\": \"small missle\",\n  \"power\": \"low\",\n  \"warheads\": 8\n};\n\nrpc.invoke(data, fireFn, fireSchema, function(errors, result) {\n  console.log('errors', errors);\n  console.log('result', result);\n});\n```","publish_time":1386642893176,"_cnpm_publish_time":1386642893176,"dist-tags":{"latest":"0.7.0"}}