{"_id":"@altrium/grpc-web","_rev":"5-f46d8dba5782f870285a425078a0a0d9","time":{"1.3.0":"2021-11-03T13:31:57.591Z","created":"2021-11-03T13:34:08.982Z","1.3.1":"2021-11-03T13:34:09.235Z","modified":"2022-04-04T13:40:38.486Z"},"name":"@altrium/grpc-web","dist-tags":{"latest":"1.3.1"},"versions":{"1.3.1":{"name":"@altrium/grpc-web","version":"1.3.1","author":{"name":"Google Inc."},"description":"gRPC-Web Client Runtime Library","homepage":"https://grpc.io/","repository":{"type":"git","url":"git+https://github.com/grpc/grpc-web.git"},"bugs":{"url":"https://github.com/grpc/grpc-web/issues"},"main":"index.js","typings":"index.d.ts","scripts":{"build":"node scripts/build.js","prepare":"npm run build","prepublishOnly":"npm run build","test":"npm run test-jsunit && npm run test-mocha","test-mocha":"mocha --timeout 10000 \"./test/**/*_test.js\"","test-jsunit":"./scripts/generate_test_files.sh && ./scripts/run_jsunit_tests.sh && rm -rf ./generated"},"license":"Apache-2.0","devDependencies":{"@types/google-protobuf":"~3.7.0","command-exists":"~1.2.8","google-closure-compiler":"~20200224.0.0","google-closure-deps":"~20210601.0.0","google-closure-library":"~20210808.0.0","google-protobuf":"~3.14.0","gulp":"~4.0.2","gulp-connect":"~5.7.0","gulp-eval":"~1.0.0","mocha":"~5.2.0","mock-xmlhttprequest":"~2.0.0","protractor":"~7.0.0","typescript":"~3.8.0"},"gitHead":"79f9332caa3a8f50cf933ddc6a24a67024d16724","_id":"@altrium/grpc-web@1.3.1","_nodeVersion":"14.17.5","_npmVersion":"7.24.2","dist":{"integrity":"sha512-+X+/k+frtIOT44QD1lkjhgdzJ19pKuAhcsTG6GyCGwBYTp8md/rXOq+xwMLikPWtd6JslkCJxeBb+hz0J3Jnrg==","shasum":"2fd4fe04284bfad16f4c81d31766dee4a62c8979","tarball":"https://registry.npmjs.org/@altrium/grpc-web/-/grpc-web-1.3.1.tgz","fileCount":4,"unpackedSize":45565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzFGgCRA9TVsSAnZWagAAm6AP/302eYKGNNOiIOV2eBdf\nEeQeN5VsFJN3L8JmyutbpsNj7lOiDyedtcn33xiv+G3RgkdmGtQz8pnbU/If\n2jIqvNEztlrXGDre8hEck3maUg6N2dVmIlueW97jirCpQDbOK6+gjnDXpII0\nSAnq1VmgBt/1cExLGMTs6Pa1cGOnf2XQWf10SVvSC7Cr76RXiOM4wWlJWBqh\nL/U8fVIV52Qfz3kCIF/EeZQS2WLM+sDOz+ZYhSxj6CyAQeC3kVSYbwfk5DbN\n1YN6pGVvPl7OxX/N81K5MWPzleBdQomQGUYzguocniHUfP94SdwFM/Dg/jI7\nKSDVWe99UbuEI6uNMYBtsZ2s4YsGa1jCWq/I8ZsQ3H6VVmAzQ9UhauqoLZ5m\na8dMzUUpHKHs5VB36nkVSxN2YpQnQAB+7f/ydpwskNg0qDEozIwsJbyJh8XA\n6cgEk3it6ULINkgr7b+RbURl00xIm4j2kKPoT0gUm+LrVPt3TSgjT26CTAi2\nAbpWo4NRNG+hCJ9GY9nTriWjr2OTlM+CnTzN5fCg4wwhHByXDr/7OLwtE8vl\n/Pc+nmfO02V/Qvp3apBSDmpm/6jo8u4a8hWDFXvGKIBqFY64Jl2BsUewTnbz\nzwzSm0Zp0ud7+2kBqLWARp1/HDqBpjVFKfDsYkjiw93vel9+m2yQi+WJEzWP\nvn7U\r\n=jgTN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAZgMWDlDlpqu7AfxEV4Yxd3fzuJI8JXeDMq4spQGTjvAiEA0l+L/b4FOoDGDrDQJBYBnCO3w73T2qb+YHU1ytydIU4="}]},"_npmUser":{"name":"cirillor","email":"cirillo.ferreira@gmail.com"},"directories":{},"maintainers":[{"name":"cirillor","email":"cirillo.ferreira@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grpc-web_1.3.1_1635946449035_0.46046480366237685"},"_hasShrinkwrap":false}},"maintainers":[{"name":"cirillor","email":"cirillo.ferreira@gmail.com"}],"description":"gRPC-Web Client Runtime Library","homepage":"https://grpc.io/","repository":{"type":"git","url":"git+https://github.com/grpc/grpc-web.git"},"author":{"name":"Google Inc."},"bugs":{"url":"https://github.com/grpc/grpc-web/issues"},"license":"Apache-2.0","readme":"# gRPC-Web Client Runtime Library\r\n\r\ngRPC-Web provides a Javascript library that lets browser clients access a gRPC\r\nservice. You can find out much more about gRPC in its own\r\n[website](https://grpc.io).\r\n\r\ngRPC-Web is now Generally Available, and considered stable enough for production use.\r\n\r\ngRPC-Web clients connect to gRPC services via a special gateway proxy: the\r\ncurrent version of the library uses [Envoy](https://www.envoyproxy.io/) by\r\ndefault, in which gRPC-Web support is built-in.\r\n\r\nIn the future, we expect gRPC-Web to be supported in language-specific Web\r\nframeworks, such as Python, Java, and Node. See the\r\n[roadmap](https://github.com/grpc/grpc-web/blob/master/doc/roadmap.md) doc.\r\n\r\n\r\n## Quick Start\r\n\r\nThis example is using the `echo.proto` file from the\r\n[Echo Example](https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/echo).\r\n\r\n 1. Add `grpc-web` as a dependency using `npm`.\r\n\r\n```sh\r\n$ npm i grpc-web\r\n```\r\n\r\n 2. Download `protoc` and the `protoc-gen-grpc-web` protoc plugin.\r\n\r\nYou can download the `protoc` binary from the official\r\n[protocolbuffers](https://github.com/protocolbuffers/protobuf/releases)\r\nrelease page.\r\n\r\nYou can download the `protoc-gen-grpc-web` protoc plugin from our Github\r\n[release](https://github.com/grpc/grpc-web/releases) page.\r\n\r\n\r\nMake sure they are both executable and are discoverable from your PATH.\r\n\r\n\r\n 3. Generate your proto messages and the service client stub classes with\r\n`protoc` and the `protoc-gen-grpc-web` plugin. You can set the\r\n`import_style=commonjs` option for both `--js_out` and `--grpc-web_out`.\r\n\r\n```sh\r\n$ protoc -I=$DIR echo.proto \\\r\n--js_out=import_style=commonjs:generated \\\r\n--grpc-web_out=import_style=commonjs,mode=grpcwebtext:generated\r\n```\r\n\r\n 4. Start using your generated client!\r\n\r\n```js\r\nconst {EchoServiceClient} = require('./generated/echo_grpc_web_pb.js');\r\nconst {EchoRequest} = require('./generated/echo_pb.js');\r\n\r\nconst client = new EchoServiceClient('localhost:8080');\r\n\r\nconst request = new EchoRequest();\r\nrequest.setMessage('Hello World!');\r\n\r\nconst metadata = {'custom-header-1': 'value1'};\r\n\r\nclient.echo(request, metadata, (err, response) => {\r\n  // ...\r\n});\r\n```\r\n\r\n\r\n## What's Next\r\n\r\nTo complete the example, you need to run a proxy that understands the\r\n[gRPC-Web protocol](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md#protocol-differences-vs-grpc-over-http2)\r\nbetween your browser client and your gRPC service. The default proxy currently\r\nis [Envoy](https://www.envoyproxy.io/). Please visit our\r\n[Github repo](https://github.com/grpc/grpc-web) for more information.\r\n\r\nHere's a quick way to get started!\r\n\r\n```sh\r\n$ git clone https://github.com/grpc/grpc-web\r\n$ cd grpc-web\r\n$ docker-compose up node-server envoy commonjs-client\r\n```\r\n\r\nOpen a browser tab, and go to:\r\n\r\n```\r\nhttp://localhost:8081/echotest.html\r\n```\r\n\r\n## TypeScript Support\r\n\r\nThe `grpc-web` module can now be imported as a TypeScript module. This is\r\ncurrently an experimental feature. Any feedback welcome!\r\n\r\nWhen using the `protoc-gen-grpc-web` protoc plugin, mentioned above, pass in\r\neither:\r\n\r\n - `import_style=commonjs+dts`: existing CommonJS style stub + `.d.ts` typings\r\n - `import_style=typescript`: full TypeScript output\r\n\r\n\r\n```ts\r\nimport * as grpcWeb from 'grpc-web';\r\nimport {EchoServiceClient} from './echo_grpc_web_pb';\r\nimport {EchoRequest, EchoResponse} from './echo_pb';\r\n\r\nconst echoService = new EchoServiceClient('http://localhost:8080', null, null);\r\n\r\nconst request = new EchoRequest();\r\nrequest.setMessage('Hello World!');\r\n\r\nconst call = echoService.echo(request, {'custom-header-1': 'value1'},\r\n  (err: grpcWeb.RpcError, response: EchoResponse) => {\r\n    console.log(response.getMessage());\r\n  });\r\ncall.on('status', (status: grpcWeb.Status) => {\r\n  // ...\r\n});\r\n```\r\n\r\nSee a full TypeScript example\r\n[here](https://github.com/grpc/grpc-web/blob/master/net/grpc/gateway/examples/echo/ts-example/client.ts).\r\n\r\n\r\n## Run Tests\r\n\r\nPre-requisites:\r\n - `protoc`\r\n - `protoc-gen-grpc-web` plugin\r\n\r\n\r\n```sh\r\n$ npm test\r\n```\r\n","readmeFilename":"README.md"}