{"_id":"@arista/grpc-web","name":"@arista/grpc-web","dist-tags":{"latest":"0.15.1"},"versions":{"0.15.1":{"name":"@arista/grpc-web","version":"0.15.1","description":"gRPC-Web client for browsers (JS/TS)","main":"dist/grpc-web-client.js","browser":"dist/grpc-web-client.umd.js","types":"dist/typings/index.d.ts","scripts":{"clean":"rm -rf dist","postbootstrap":"npm run lib:build","lib:build":"npm run clean && webpack"},"publishConfig":{"access":"public"},"author":{"name":"Improbable"},"license":"Apache-2.0","repository":{"type":"git","url":"github.com/improbable-eng/grpc-web"},"keywords":["grpc","grpc-web","protobuf","typescript","ts"],"peerDependencies":{"google-protobuf":"^3.14.0"},"dependencies":{"@arista/browser-headers":"^0.4.2"},"devDependencies":{"@types/google-protobuf":"^3.7.4","@types/node":"^14.14.22","google-protobuf":"^3.14.0","ts-loader":"^8.0.14","typescript":"4.1.3","webpack":"^5.19.0","webpack-cli":"^4.4.0"},"gitHead":"3f12bcd25b88f67cc35a0add5edefcb9a279f1b6","_id":"@arista/grpc-web@0.15.1","_nodeVersion":"16.13.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-CJ2YtBo5NUYa/hkW/Cvir04nUOfiGE4er01yay+H2w9lDdXLDOhYw78HHZ7C3W4Hi7MicxUWTK5kc4j5Gooh4Q==","shasum":"172f412aa48072a57c1359567401dea6cc0b3ca8","tarball":"https://registry.npmjs.org/@arista/grpc-web/-/grpc-web-0.15.1.tgz","fileCount":22,"unpackedSize":65695,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHl2tlBDL2gAuxddGxe2HJP59qXBX6/4WUmObbJY4dFRAiBSCM6WFTj73DrjzJSThk0ztMLoG5H2wqTp1aqk8XgXxA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0bC8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/PA//QmORLT8buo7mvEneyDK5jKiQv8U3dtQbFiiYGzr6bTBv8WdI\r\nVA9BV83iXHSwiAWPfzMZ8E8kQN2nLsyyaoaU7ArRneCzrgAIqVJhmSoEgZgN\r\ncWKnMn4AM+/vA0Ipm9OOXL/1MNBgLVNLeRStQ+xg26WN4KcjH5wWoy/DhU39\r\ng+7U6JrWh9D8uOFcIinWY2+R+K264a6C6YOM8uC3/eElMJfJVWzZ3wGsehUP\r\nTXrz9AkCWI9UDl7jwcRo3NcUGyNsl4vK/cyTekyLJenflDSw/mQNU5TQqO0U\r\noQgIEme6NslTPyLO69fK0H/MEBtp+4gxpF2MotXeN32B7P+C4DjmG7FgKUcY\r\nbxOHMfEPgc1H38ZDYJOnsw8CV6Lc3Ne/sUqTYwWz4xEcxYhhaNgXMGe59H8Z\r\nnLSs6IAJfO6nqvbQBCg8z3PityRO3ehqVK99Qs/WBCmWgHtBGz5BPG+Q43pY\r\nC4DLzu0ubEkElWj8hsIlOqpLGMDz5PDtZ28mcxoH/a4bpbF+HIxoAsEMrGYe\r\nDeXTwB5uuTLRYw+/qPSYBuK1ATaXvcvoEsXJEW/JEIdXF7itn7vKM2Xi58K3\r\nuc2o6/ZqbpAG2n93oNZVRS+/bEHsTCogFVfy561ERUfD5CJSRYsXzBnhh21S\r\nop25gtT9N1ob3PV0hrwHyg4PSPlK3CWKPoM=\r\n=96V6\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gurkohli","email":"gursimransinghkohli@gmail.com"},"directories":{},"maintainers":[{"name":"rufman","email":"s@zurita-rufer.com"},{"name":"madsen","email":"ryan.madsen@gmail.com"},{"name":"gurkohli","email":"gursimransinghkohli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grpc-web_0.15.1_1657909436654_0.21670455292583002"},"_hasShrinkwrap":false}},"time":{"created":"2022-07-15T18:23:56.606Z","0.15.1":"2022-07-15T18:23:56.877Z","modified":"2022-07-15T18:23:57.031Z"},"maintainers":[{"name":"rufman","email":"s@zurita-rufer.com"},{"name":"madsen","email":"ryan.madsen@gmail.com"},{"name":"gurkohli","email":"gursimransinghkohli@gmail.com"}],"description":"gRPC-Web client for browsers (JS/TS)","keywords":["grpc","grpc-web","protobuf","typescript","ts"],"repository":{"type":"git","url":"github.com/improbable-eng/grpc-web"},"author":{"name":"Improbable"},"license":"Apache-2.0","readme":"# @improbable-eng/grpc-web\n> Library for making gRPC-Web requests from a browser\n\nThis library is intended for both JavaScript and TypeScript usage from a web browser or NodeJS (see [Usage with NodeJS](#usage-with-nodejs)).\n\n*Note: This only works if the server supports [gRPC-Web](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md)*\n\nA Golang gRPC-Web middleware and a Golang-based gRPC-Web proxy are [available here](https://github.com/improbable-eng/grpc-web).\n\nPlease see the full [gRPC-Web README](https://github.com/improbable-eng/grpc-web) for known limitations.\n\n## Installation\n\n`@improbable-eng/grpc-web` has peer dependencies of `google-protobuf` and `@types/google-protobuf`.\n\n`npm install google-protobuf @types/google-protobuf @improbable-eng/grpc-web --save`\n\n## Example Project\n\nThere is an [example project available here](https://github.com/improbable-eng/grpc-web/tree/master/client/grpc-web-react-example)\n\n## Usage Overview\n* Use [`ts-protoc-gen`](https://www.npmjs.com/package/ts-protoc-gen) with [`protoc`](https://github.com/google/protobuf) to generate `.js` and `.d.ts` files for your request and response classes. `ts-protoc-gen` can also generate gRPC service definitions with the `service=true` argument.\n  * [Go to code generation docs](docs/code-generation.md)\n* Make a request using [`unary()`](docs/unary.md), [`invoke()`](docs/invoke.md) or [`client()`](docs/client.md)\n\n```javascript\nimport {grpc} from \"@improbable-eng/grpc-web\";\n\n// Import code-generated data structures.\nimport {BookService} from \"./generated/proto/examplecom/library/book_service_pb_service\";\nimport {GetBookRequest} from \"./generated/proto/examplecom/library/book_service_pb\";\n\nconst getBookRequest = new GetBookRequest();\ngetBookRequest.setIsbn(60929871);\ngrpc.unary(BookService.GetBook, {\n  request: getBookRequest,\n  host: host,\n  onEnd: res => {\n    const { status, statusMessage, headers, message, trailers } = res;\n    if (status === grpc.Code.OK && message) {\n      console.log(\"all ok. got book: \", message.toObject());\n    }\n  }\n});\n```\n\n* Requests can be aborted/closed before they complete:\n\n```javascript\nconst request = grpc.unary(BookService.GetBook, { ... });\nrequest.close();\n```\n\n## Available Request Functions\n\nThere are three functions for making gRPC requests:\n\n### [`grpc.unary`](docs/unary.md)\nThis is a convenience function for making requests that consist of a single request message and single response message. It can only be used with unary methods.\n\n```protobuf\nrpc GetBook(GetBookRequest) returns (Book) {}\n```\n\n### [`grpc.invoke`](docs/invoke.md)\nThis is a convenience function for making requests that consist of a single request message and a stream of response messages (server-streaming). It can also be used with unary methods.\n\n```protobuf\nrpc GetBook(GetBookRequest) returns (Book) {}\nrpc QueryBooks(QueryBooksRequest) returns (stream Book) {}\n```\n\n### [`grpc.client`](docs/client.md)\n`grpc.client` returns a client. Dependant upon [transport compatibility](docs/transport.md) this client is capable of sending multiple request messages (client-streaming) and receiving multiple response messages (server-streaming). It can be used with any type of method, but will enforce limiting the sending of messages for unary methods.\n\n```protobuf\nrpc GetBook(GetBookRequest) returns (Book) {}\nrpc QueryBooks(QueryBooksRequest) returns (stream Book) {}\nrpc LogReadPages(stream PageRead) returns (google.protobuf.Empty) {}\nrpc ListenForBooks(stream QueryBooksRequest) returns (stream Book) {}\n```\n\n## Usage with NodeJS\nRefer to [grpc-web-node-http-transport](https://www.npmjs.com/package/@improbable-eng/grpc-web-node-http-transport).\n\n## All Docs\n\n* [unary()](docs/unary.md)\n* [invoke()](docs/invoke.md)\n* [client()](docs/client.md)\n* [Code Generation](docs/code-generation.md)\n* [Concepts](docs/concepts.md)\n* [Transport](docs/transport.md)\n","readmeFilename":"README.md"}