{"_id":"@coozzy/grpc-mock","_rev":"3-b56004eb7e29e2e6f900a3a89817fcf0","name":"@coozzy/grpc-mock","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@coozzy/grpc-mock","version":"1.0.0","keywords":["grpc","mock"],"author":{"name":"Marco Egger"},"license":"MIT","_id":"@coozzy/grpc-mock@1.0.0","maintainers":[{"name":"kszymiczek_propbase","email":"k.szymiczek@propbase.ch"},{"name":"coozzyag","email":"developer@coozzy.com"}],"homepage":"https://github.com/marcoEgger/grpc-mock#readme","bugs":{"url":"https://github.com/marcoEgger/grpc-mock/issues"},"dist":{"shasum":"fd09efaddeec6790459274cfd05efe1fb29070d6","tarball":"https://registry.npmjs.org/@coozzy/grpc-mock/-/grpc-mock-1.0.0.tgz","fileCount":8,"integrity":"sha512-FxgaTwK6vVK3zY7whw05hMDtTSeXqwThWPN/iXCcK3LUKSHvAzPaaBpeAktnrMM1msKkDIwNVGk55VqHDiRxrw==","signatures":[{"sig":"MEQCIGlqT9kB70W0/Tw8oHJlCcivueI5AjvGAfSapGxMJ/+DAiB83fGYO04TxuZm18qnI1EQnLaOFOYWsKY338LqhC8dDg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6hbIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFcA/5ANbGucuQtJ+T8CBNfI/CcZqo7bFpmMeKpSO9C/scYdkwOm3a\r\noWYuSFt12UtIj82blfQ9XSq88XL6l72A8kR0+vy7hTkyGaTttlTK/PnkQOb2\r\n4VpIZx+ndFpHzKCaDE80vuSl2pi26voBbkUYxYOSq7BlCK2VKf/MsRLpsL3i\r\nDoSjkdQm/+lhdUmrR+UdgiVuWez59KIY4TrU5kCVCtf8gwonb5wA0OfmOUUW\r\nxBx29mOO/hPJu8mpn1/kEg7JcxOubKMYYYNGtsPSZZCd8INXuFHw4l+CqG9j\r\nGQoxa+oKoeh5j9ZdsPLNXMB/AAw4Kt4/SR6/2wNoe/pDgFUQeY6mcySYL8za\r\nOY+LfkY2ecusKQbcyq0LfUCKMi3TQunudyeExrdY/KMu8dK1PIhiLeafuzjE\r\nlPbl8dD0tlTqscMfEpQ6GeqfhbmP3APOz3iDl8oY49cHot5fflDTeA8WmLkh\r\nI5tVSQJUoP/loNKl345jWiMifjianZ06a8WeJS7zCT29/uOxG7XBwFlumudK\r\n2o7Q2t9K4Hme5Tz916Es7BmnF/2xLlaLfwVGf2gT/nDGACgHLCJjwQq/OREt\r\ngHR2lG7fau6v05EINAADaFTg1n9hRGPWJplxrfAV3x459FXGlIDakvgpb7F8\r\nJM9wgnf7ORgLb6tclnW7L7mxzm71jtkBmK4=\r\n=54p0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"2a855083dff444942db25087694f65e9e5688bbc","scripts":{"test":"mocha --require intelli-espower-loader test"},"_npmUser":{"name":"coozzyag","email":"developer@coozzy.com"},"repository":{"url":"git+https://github.com/marcoEgger/grpc-mock.git","type":"git"},"_npmVersion":"9.3.1","description":"a simple grpc mock server based on grpc-mock","directories":{},"_nodeVersion":"18.14.0","dependencies":{"@grpc/grpc-js":"1.8.8","partial-compare":"1.0.1","@grpc/proto-loader":"0.7.4"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"10.2.0","power-assert":"1.6.1","intelli-espower-loader":"1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/grpc-mock_1.0.0_1676285639862_0.007985500945553836","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@coozzy/grpc-mock","version":"1.0.1","keywords":["grpc","mock"],"author":{"name":"Marco Egger"},"license":"MIT","_id":"@coozzy/grpc-mock@1.0.1","maintainers":[{"name":"mehdi.darmiche","email":"mehdi.darmiche@gmail.com"},{"name":"kszymiczek_propbase","email":"k.szymiczek@propbase.ch"},{"name":"coozzyag","email":"developer@coozzy.com"}],"homepage":"https://github.com/marcoEgger/grpc-mock#readme","bugs":{"url":"https://github.com/marcoEgger/grpc-mock/issues"},"dist":{"shasum":"5892e066636b1d5b64c455889a17999e4434be60","tarball":"https://registry.npmjs.org/@coozzy/grpc-mock/-/grpc-mock-1.0.1.tgz","fileCount":8,"integrity":"sha512-MlNL4k3sO0sAyIPIcoXdDNzVe5ZAYBNBZI+E1lwhDVD8KuqfkPLLADsKLhgMMK3vpkmHVLhBM9faooRKdHdipg==","signatures":[{"sig":"MEUCIQDUhYpdV3NsUZjAM/Q2fq80nmXcaPPYyAH94i05H+SKygIgTQR3a3irO5NG3h2/egeO/1zyuKM2NBvc9Skzd0oSjis=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37369},"main":"index.js","gitHead":"364a636f1a4157ca38420f8e2e3f5299be4c1065","scripts":{"test":"mocha --require intelli-espower-loader test"},"_npmUser":{"name":"coozzyag","email":"developer@coozzy.com"},"repository":{"url":"git+https://github.com/marcoEgger/grpc-mock.git","type":"git"},"_npmVersion":"10.2.3","description":"a simple grpc mock server based on grpc-mock","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@grpc/grpc-js":"1.9.12","partial-compare":"1.0.1","@grpc/proto-loader":"0.7.10"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"10.2.0","power-assert":"1.6.1","intelli-espower-loader":"1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/grpc-mock_1.0.1_1701947803860_0.6039630312254758","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@coozzy/grpc-mock","version":"1.0.2","description":"a simple grpc mock server based on grpc-mock","main":"index.js","scripts":{"test":"mocha --require intelli-espower-loader test"},"repository":{"type":"git","url":"git+https://github.com/marcoEgger/grpc-mock.git"},"keywords":["grpc","mock"],"author":{"name":"Marco Egger"},"license":"MIT","bugs":{"url":"https://github.com/marcoEgger/grpc-mock/issues"},"homepage":"https://github.com/marcoEgger/grpc-mock#readme","dependencies":{"@grpc/proto-loader":"0.7.13","@grpc/grpc-js":"1.11.1","partial-compare":"1.0.1"},"devDependencies":{"intelli-espower-loader":"1.1.0","mocha":"10.7.3","power-assert":"1.6.1"},"_id":"@coozzy/grpc-mock@1.0.2","gitHead":"6ec8640ea3e493e95c8c566f078100a2e87eb577","_nodeVersion":"20.15.1","_npmVersion":"10.7.0","dist":{"integrity":"sha512-GDRe0RRe+YRIa/QcICcn0EpcgawheCRSnV+qGKX+mCq/TXttYNHfrl50BJTbkNUEGQhHI7m3AcMb91Ntwt+9FA==","shasum":"d724b060785061ffb788d95c54c6539e36422b6d","tarball":"https://registry.npmjs.org/@coozzy/grpc-mock/-/grpc-mock-1.0.2.tgz","fileCount":8,"unpackedSize":37369,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDp3ziRCQVKLZlok1u1ZkpMmQ9E5sN4axEePvh8rVnyUwIgOtkJQtFL7JFQzu/5EhzXM0jULDD93Vf0GE58GlA78FQ="}]},"_npmUser":{"name":"coozzyag","email":"developer@coozzy.com"},"directories":{},"maintainers":[{"name":"mehdi.darmiche","email":"mehdi.darmiche@gmail.com"},{"name":"kszymiczek_propbase","email":"k.szymiczek@propbase.ch"},{"name":"coozzyag","email":"developer@coozzy.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grpc-mock_1.0.2_1724853768707_0.3846085615455186"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-13T10:53:59.773Z","modified":"2024-08-28T14:02:49.092Z","1.0.0":"2023-02-13T10:53:59.986Z","1.0.1":"2023-12-07T11:16:44.046Z","1.0.2":"2024-08-28T14:02:48.882Z"},"bugs":{"url":"https://github.com/marcoEgger/grpc-mock/issues"},"author":{"name":"Marco Egger"},"license":"MIT","homepage":"https://github.com/marcoEgger/grpc-mock#readme","keywords":["grpc","mock"],"repository":{"type":"git","url":"git+https://github.com/marcoEgger/grpc-mock.git"},"description":"a simple grpc mock server based on grpc-mock","maintainers":[{"name":"mehdi.darmiche","email":"mehdi.darmiche@gmail.com"},{"name":"kszymiczek_propbase","email":"k.szymiczek@propbase.ch"},{"name":"coozzyag","email":"developer@coozzy.com"}],"readme":"# grpc-mock\r\n[![npm version](https://badge.fury.io/js/grpc-mock.svg)](https://badge.fury.io/js/grpc-mock)\r\n\r\nA simple mock gRPC server on Node.js.\r\n\r\n```js\r\nconst {createMockServer} = require(\"grpc-mock\");\r\nconst mockServer = createMockServer({\r\n  protoPath: \"/path/to/greeter.proto\",\r\n  packageName: \"greeter\",\r\n  serviceName: \"Greeter\",\r\n  rules: [\r\n    { method: \"hello\", input: { message: \"test\" }, output: { message: \"Hello\" } },\r\n    { method: \"goodbye\", input: \".*\", output: { message: \"Goodbye\" } },\r\n    \r\n    {\r\n      method: \"howAreYou\",\r\n      streamType: \"client\",\r\n      stream: [\r\n        { input: { message: \"Hi\" } },\r\n        { input: { message: \"How are you?\" } },\r\n      ],\r\n      output: { message: \"I'm fine, thank you\" }\r\n    },\r\n    \r\n    {\r\n      method: \"niceToMeetYou\",\r\n      streamType: \"server\",\r\n      stream: [\r\n        { output: { message: \"Hi, I'm Sana\" } },\r\n        { output: { message: \"Nice to meet you too\" } },\r\n      ],\r\n      input: { message: \"Hi. I'm John. Nice to meet you\" }\r\n    },\r\n    \r\n    {\r\n      method: \"chat\",\r\n      streamType: \"mutual\",\r\n      stream: [\r\n        { input: { message: \"Hi\" }, output: { message: \"Hi there\" } },\r\n        { input: { message: \"How are you?\" }, output: { message: \"I'm fine, thank you.\" } },\r\n      ]\r\n    },\r\n    \r\n    { method: \"returnsError\", input: { }, error: { code: 3, message: \"Message text is required\"} },\r\n    \r\n    {\r\n      method: \"returnsErrorWithMetadata\",\r\n      streamType: \"server\",\r\n      input: { },\r\n      error: { code: 3, message: \"Message text is required\", metadata: { key: \"value\"}}\r\n    }\r\n  ]\r\n});\r\nmockServer.listen(\"0.0.0.0:50051\");\r\n```\r\n\r\n```proto\r\nsyntax=\"proto3\";\r\n\r\npackage greeter;\r\n\r\nservice Greeter {\r\n  rpc Hello (RequestGreet) returns (ResponseGreet) {}\r\n  rpc Goodbye (RequestGreet) returns (ResponseGreet) {}\r\n  rpc HowAreYou (stream RequestGreet) returns (ResponseGreet) {}\r\n  rpc NiceToMeetYou (RequestGreet) returns (stream ResponseGreet) {}\r\n  rpc Chat (stream RequestGreet) returns (stream ResponseGreet) {}\r\n}\r\n\r\nmessage RequestGreet {\r\n  string message = 1;\r\n}\r\n\r\nmessage ResponseGreet {\r\n  string message = 1;\r\n}\r\n```\r\n\r\n## api\r\n### createMockServer({`protoPath`,`packageName`,`serviceName`,`options`,`rules`}): [grpc-kit](https://github.com/YoshiyukiKato/grpc-kit).GrpcServer\r\n\r\n|arg name|type|required/optional|description|\r\n|:-------|:---|:----------------|:----------|\r\n|**`protoPath`**|String|Required|path to `.proto` file|\r\n|**`packageName`**|String|Required|name of package|\r\n|**`serviceName`**|String|Required|name of service|\r\n|**`options`**|@grpc/proto-loader.Options|Optional|options for `@grpc/proto-loader` to load `.proto` file. In detail, please check [here](https://github.com/grpc/grpc-node/blob/master/packages/proto-loader/README.md) out. Default is `null`|\r\n|**`rules`**|Array\\<Rule\\>|Required|Array of Rules|\r\n\r\n### Rule\r\n|prop name|type|required/optional|description|\r\n|:-------|:---|:----------------|:----------|\r\n|**`method`**|String|Required|path to `.proto` file|\r\n|**`streamType`**|Enum<\"client\"\\|\"server\"\\|\"mutual\">|Optional|Type of stream. Set `client` if only using client side stream, set `server` if only using server side stream, and set `mutual` if using both of client and server side stream. Set null/undefined if not using stream. Default is null|\r\n|**`input`**|Object\\|String|Required when `streamType` is null or `server`|Specifying an expected input. Raw object or pattern string(RegExp) is available|\r\n|**`output`**|String|Required when `streamType` is null or `client`|Specifying an output to an expected input|\r\n|**`stream`**|Array\\<Chunk\\>|Required when `streamType` is `client`, `server` and `mutual`|Array of Chunks|\r\n|**`error`**|Object|Optional|If provided, server will respond with this error object|\r\n\r\n#### Chunk\r\n|prop name|type|required/optional|description|\r\n|:-------|:---|:----------------|:----------|\r\n|**`input`**|Object\\|String|Required when `streamType` is `client`. Optional when `streamType` is `mutual`|Specifying an expected input. Raw object or pattern string(RegExp) is available.|\r\n|**`output`**|Object|Required when `streamType` is `server`. Optional when `streamType` is `mutual`|Specifying an output to an expected input|\r\n","readmeFilename":"README.md"}