{"name":"mschema-rpc","version":"0.5.0","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.0","dist":{"shasum":"7797412aee67de193e0080b439aa46b707244b59","tarball":"http://registry-npm.ywwl.com/mschema-rpc/download/mschema-rpc-0.5.0.tgz","integrity":"sha512-q2pneoGDuc9yjmOyln97je3CO0cAeHvs3D/ypEIkcb+op/OyLKuRqyU6RDqfob6Mo4hQ2G1mRNyck4xSvlJ4Zg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAUse/sAWTF9SOVcRJ9YkSTsqNs2HfQwceGhMdLL6IBaAiBU77GvjGRFN4qcpC7+8mg1OwBhYyOhpBzB0KBh7jwyNA=="}],"size":5605,"noattachment":false,"key":"/mschema-rpc/-/mschema-rpc-0.5.0.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":1385746718512,"_cnpm_publish_time":1385746718512,"dist-tags":{"latest":"0.7.0"}}