ts-proto 1.117.1 → 1.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.118.0](https://github.com/stephenh/ts-proto/compare/v1.117.1...v1.118.0) (2022-07-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * add dynamic upStreamCodes option ([#618](https://github.com/stephenh/ts-proto/issues/618)) ([3091023](https://github.com/stephenh/ts-proto/commit/309102313273e09aef3a8480f4b46360ad82adaa))
7
+
1
8
  ## [1.117.1](https://github.com/stephenh/ts-proto/compare/v1.117.0...v1.117.1) (2022-07-16)
2
9
 
3
10
 
package/README.markdown CHANGED
@@ -110,6 +110,8 @@ plugins:
110
110
 
111
111
  # Goals
112
112
 
113
+ In terms of the code that `ts-proto` generates, the general goals are:
114
+
113
115
  - Idiomatic TypeScript/ES6 types
114
116
  - `ts-proto` is a clean break from either the built-in Google/Java-esque JS code of `protoc` or the "make `.d.ts` files the `*.js` comments" approach of `protobufjs`
115
117
  - (Techically the `protobufjs/minimal` package is used for actually reading/writing bytes.)
@@ -118,6 +120,17 @@ plugins:
118
120
  - As much as possible, types are just interfaces, so you can work with messages just like regular hashes/data structures.
119
121
  - Only supports codegen `*.proto`-to-`*.ts` workflow, currently no runtime reflection/loading of dynamic `.proto` files
120
122
 
123
+ ## Non-Goals
124
+
125
+ Note that ts-proto is not an out-of-the-box RPC framework; instead it's more of a swiss-army knife (as witnessed by its many config options), that lets you build _exactly_ the RPC framework you'd like on top of it (i.e. that best integrates with your company's protobuf ecosystem; for better or worse, protobuf RPC is still a somewhat fragmented ecosystem).
126
+
127
+ If you'd like an out-of-the-box RPC framework built on top of ts-proto, there are a few examples:
128
+
129
+ - [nice-grpc](https://github.com/deeplay-io/nice-grpc)
130
+ - [starpc](https://github.com/aperturerobotics/starpc)
131
+
132
+ (Note for potential contributors, if you develop other frameworks/mini-frameworks, or even blog posts/tutorials, on using `ts-proto`, we're happy to link to them.)
133
+
121
134
  # Example Types
122
135
 
123
136
  The generated types are "just data", i.e.:
@@ -483,6 +496,8 @@ If you need ts-proto customizations or priority support for your company, you ca
483
496
 
484
497
  # Development
485
498
 
499
+ This section describes how to contribute directly to ts-proto, i.e. it's not required for running `ts-proto` in `protoc` or using the generated TypeScript.
500
+
486
501
  **Requirements**
487
502
 
488
503
  - [Docker](https://www.docker.com) or [protoc](https://github.com/protocolbuffers/protobuf/releases) v3.19.1
@@ -170,6 +170,7 @@ function generateGrpcWebImpl(ctx, returnObservable, hasStreamingMethods) {
170
170
  ${hasStreamingMethods ? 'streamingTransport?: grpc.TransportFactory,' : ``}
171
171
  debug?: boolean,
172
172
  metadata?: grpc.Metadata,
173
+ upStreamRetryCodes?: number[],
173
174
  }
174
175
  `;
175
176
  const chunks = [];
@@ -268,8 +269,7 @@ function createInvokeMethod(ctx) {
268
269
  _request: any,
269
270
  metadata: grpc.Metadata | undefined
270
271
  ): ${(0, types_1.observableType)(ctx)}<any> {
271
- // Status Response Codes (https://developers.google.com/maps-booking/reference/grpc-api/status_codes)
272
- const upStreamCodes = [2, 4, 8, 9, 10, 13, 14, 15];
272
+ const upStreamCodes = this.options.upStreamRetryCodes || [];
273
273
  const DEFAULT_TIMEOUT_TIME: number = 3_000;
274
274
  const request = { ..._request, ...methodDesc.requestType };
275
275
  const maybeCombinedMetadata =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.117.1",
3
+ "version": "1.118.0",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",