Skip to content

Commit

Permalink
Update all child packages to reference @improbable-eng/grpc-web (#297)
Browse files Browse the repository at this point in the history
* Update all child packages to reference @improbable-eng/grpc-web

* Purge last references to grpc-web-client.
  • Loading branch information
jonny-improbable authored Jan 13, 2019
1 parent 0120c83 commit 0b66909
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 88 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.0
### Breaking Changes
* Scoped npm package under the @improbable-eng org; consumers should now `npm install @improbable-eng/grpc-web`.

## 0.7.0
### Breaking Changes
* Removed built-in support for NodeJS Environments; if you want to use `grpc-web-client` in a NodeJS environment you will need to import `grpc-web-node-http-transport` and specify it as your Default Transport.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ With gRPC-Web, it is extremely easy to build well-defined, easy to reason about

In short, gRPC-Web moves the interaction between frontend code and microservices from the sphere of hand-crafted HTTP requests to well-defined user-logic methods.

## Client-side (grpc-web-client) Docs
## Client-side (grpc-web) Docs

**Note: You'll need to add gRPC-Web compatibility to your server through either [`grpcweb`](go/grpcweb) or [`grpcwebproxy`](go/grpcwebproxy).**

[API Docs for `grpc-web-client` can be found here](./client/grpc-web-client)
[API Docs for `grpc-web` client can be found here](./client/grpc-web)

## Example

Expand Down Expand Up @@ -102,7 +102,7 @@ func (s *bookService) QueryBooks(bookQuery *pb_library.QueryBooksRequest, stream
You will be able to access it in a browser using TypeScript (and equally JavaScript after transpiling):

```javascript
import {grpc} from "grpc-web-client";
import {grpc} from "@improbable-eng/grpc-web";

// Import code-generated data structures.
import {BookService} from "../_proto/examplecom/library/book_service_pb_service";
Expand Down Expand Up @@ -131,7 +131,7 @@ grpc.invoke(BookService.QueryBooks, {

## Browser Support

The `grpc-web-client` uses multiple techniques to efficiently invoke gRPC services. Most modern browsers support the [Fetch API](https://developer.mozilla.org/en/docs/Web/API/Fetch_API), which allows for efficient reading of partial, binary responses. For older browsers, it automatically falls back to [`XMLHttpRequest`](https://developer.mozilla.org/nl/docs/Web/API/XMLHttpRequest).
The `@improbable-eng/grpc-web` client uses multiple techniques to efficiently invoke gRPC services. Most modern browsers support the [Fetch API](https://developer.mozilla.org/en/docs/Web/API/Fetch_API), which allows for efficient reading of partial, binary responses. For older browsers, it automatically falls back to [`XMLHttpRequest`](https://developer.mozilla.org/nl/docs/Web/API/XMLHttpRequest).

The gRPC semantics encourage you to make multiple requests at once. With most modern browsers [supporting HTTP2](http://caniuse.com/#feat=http2), these can be executed over a single TLS connection. For older browsers, gRPC-Web falls back to HTTP/1.1 chunk responses.

Expand All @@ -144,9 +144,9 @@ This library is tested against:

## Node.js Support

`grpc-web-client` also [supports Node.js through a transport](./client/grpc-web/docs/transport.md#node-http-only-available-in-a-nodejs-environment) that uses the `http` and `https` packages. Usage does not vary from browser usage as transport is determined at runtime.
The `@improbable-eng/grpc-web` client also [supports Node.js through a transport](./client/grpc-web/docs/transport.md#node-http-only-available-in-a-nodejs-environment) that uses the `http` and `https` packages. Usage does not vary from browser usage as transport is determined at runtime.

If you want to use `grpc-web-client` in a node.js environment with Typescript, you must include `dom` in the `"lib"` Array in your `tsconfig.json` otherwise `tsc` will be unable to find some type declarations to compile. Note that `dom` will be included automatically if you do not declare `lib` in your configration and your target is one of `es5` or `es6`. (See [Typescript compiler options](https://www.typescriptlang.org/docs/handbook/compiler-options.html)).
If you want to use the `@improbable-eng/grpc-web` client in a node.js environment with Typescript, you must include `dom` in the `"lib"` Array in your `tsconfig.json` otherwise `tsc` will be unable to find some type declarations to compile. Note that `dom` will be included automatically if you do not declare `lib` in your configration and your target is one of `es5` or `es6`. (See [Typescript compiler options](https://www.typescriptlang.org/docs/handbook/compiler-options.html)).

```
{
Expand All @@ -171,7 +171,7 @@ This, however, is useful for a lot of frontend functionality.
The code here is `alpha` quality. It is being used for a subset of Improbable's frontend single-page apps in production.

## Known Limitations
See the grpc-web-client's Transport Documentation for [a list of Web Browser caveats](./client/grpc-web/docs/transport.md#http/2-based-transports).
See the `@improbable-eng/grpc-web` client Transport Documentation for [a list of Web Browser caveats](./client/grpc-web/docs/transport.md#http/2-based-transports).

### Contributing
See [CONTRIBUTING](./CONTRIBUTING.md)
6 changes: 3 additions & 3 deletions client/grpc-web-node-http-transport/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# grpc-web-node-http-transport
Node HTTP Transport for use with [grpc-web-client](https://github.com/improbable-eng/grpc-web)
Node HTTP Transport for use with [@improbable-eng/grpc-web](https://github.com/improbable-eng/grpc-web)

## Usage
When making a gRPC request, specify this transport:

```typescript
import { grpc } from 'grpc-web-client';
import { grpc } from '@improbable-eng/grpc-web';
import { NodeHttpTransport } from 'grpc-web-node-http-transport';

grpc.invoke(MyService.DoQuery, {
Expand All @@ -17,7 +17,7 @@ grpc.invoke(MyService.DoQuery, {

Alternatively specify the Default Transport when your server/application bootstraps:
```typescript
import { grpc } from "grpc-web-client";
import { grpc } from "@improbable-eng/grpc-web";
import { NodeHttpTransport } from "grpc-web-node-http-transport";

// Do this first, before you make any grpc requests!
Expand Down
13 changes: 0 additions & 13 deletions client/grpc-web-node-http-transport/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/grpc-web-node-http-transport/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grpc-web-node-http-transport",
"version": "0.0.1",
"description": "Node HTTP Transport for use with grpc-web-client",
"description": "Node HTTP Transport for use with @improbable-eng/grpc-web",
"main": "lib/index.js",
"repository": {
"type": "git",
Expand All @@ -14,7 +14,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"grpc-web-client": "^0.7.0"
"@improbable-eng/grpc-web": "^0.8.0"
},
"author": "",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion client/grpc-web-node-http-transport/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as http from "http";
import * as https from "https";
import * as url from "url";
import { grpc } from "grpc-web-client";
import { grpc } from "@improbable-eng/grpc-web";

export function NodeHttpTransport(): grpc.TransportFactory {
return (opts: grpc.TransportOptions) => {
Expand Down
36 changes: 6 additions & 30 deletions client/grpc-web-react-example/go/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions client/grpc-web-react-example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/grpc-web-react-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "none",
"dependencies": {
"google-protobuf": "^3.6.1",
"grpc-web-client": "^0.6.2"
"@improbable-eng/grpc-web": "^0.8.0"
},
"devDependencies": {
"@types/google-protobuf": "^3.2.5",
Expand Down
2 changes: 1 addition & 1 deletion client/grpc-web-react-example/ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {grpc} from "grpc-web-client";
import {grpc} from "@improbable-eng/grpc-web";
import {BookService} from "../_proto/examplecom/library/book_service_pb_service";
import {QueryBooksRequest, Book, GetBookRequest} from "../_proto/examplecom/library/book_service_pb";

Expand Down
2 changes: 1 addition & 1 deletion client/grpc-web/docs/code-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ To make gRPC requests the client requires generated code for the [method definit

[`protoc`](https://github.com/google/protobuf) is the google protobuf code generation tool. It can generate the JavaScript message classes and also supports using plugins for additional code generation.

[`ts-protoc-gen`](https://www.github.com/improbable-eng/ts-protoc-gen) is a package that can generate the `.d.ts` files that declare the contents of the protoc-generated JavaScript files. `ts-protoc-gen` can also generate `grpc-web-client` service/method definitions with the `protoc-gen-ts` plugin and `service=true` argument.
[`ts-protoc-gen`](https://www.github.com/improbable-eng/ts-protoc-gen) is a package that can generate the `.d.ts` files that declare the contents of the protoc-generated JavaScript files. `ts-protoc-gen` can also generate `@improbable-eng/grpc-web` client service/method definitions with the `protoc-gen-ts` plugin and `service=true` argument.

This is an example of a complete invokation of `protoc` with `ts-protoc-gen` assuming your `.proto` files are in a directory named `my-protos` within the current working directory:

Expand Down
8 changes: 0 additions & 8 deletions integration_test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration_test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"browser-headers": "^0.4.0",
"event-stream": "^3.3.4",
"google-protobuf": "^3.2.0",
"grpc-web-client": "^0.7.0",
"@improbable-eng/grpc-web": "^0.8.0",
"grpc-web-node-http-transport": "^0.0.1",
"typedarray": "0.0.6"
},
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/cancellation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// gRPC-Web library
import {
grpc,
} from "grpc-web-client";
} from "@improbable-eng/grpc-web";

import {debug} from "../../../client/grpc-web/src/debug";
import {assert} from "chai";
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// gRPC-Web library
import {grpc} from "grpc-web-client";
import {grpc} from "@improbable-eng/grpc-web";

import {debug} from "../../../client/grpc-web/src/debug";
import {assert} from "chai";
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/client.websocket.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// gRPC-Web library
import { grpc } from "grpc-web-client";
import { grpc } from "@improbable-eng/grpc-web";

import { debug } from "../../../client/grpc-web/src/debug";
import { assert } from "chai";
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/invoke.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// gRPC-Web library
import {
grpc,
} from "grpc-web-client";
} from "@improbable-eng/grpc-web";

import {debug} from "../../../client/grpc-web/src/debug";
import {assert} from "chai";
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/testRpcCombinations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
testHost,
corsHost
} from "../../hosts-config";
import {grpc} from "grpc-web-client";
import {grpc} from "@improbable-eng/grpc-web";
import {NodeHttpTransport} from "grpc-web-node-http-transport";

type TestConfig = {
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/unary.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// gRPC-Web library
import {
grpc,
} from "grpc-web-client";
} from "@improbable-eng/grpc-web";

import {debug} from "../../../client/grpc-web/src/debug";
import {assert} from "chai";
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ts/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {ContinueStreamRequest} from "../_proto/improbable/grpcweb/test/test_pb";
import {TestUtilService} from "../_proto/improbable/grpcweb/test/test_pb_service";
import {
grpc,
} from "grpc-web-client";
} from "@improbable-eng/grpc-web";

export const DEBUG: boolean = (global as any).DEBUG;

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "grpc-web-ci",
"private": true,
"scripts": {
"postinstall": "npm run bootstrap",
"bootstrap": "lerna bootstrap",
Expand Down

0 comments on commit 0b66909

Please sign in to comment.