Commit Graph

249 Commits

Author SHA1 Message Date
Stanley Cheung 0c62fe8a3a Fix non-determinism in code generator 2020-10-05 20:49:15 -07:00
Yannic Bonenberger fecfe1cef4 Fix Protobuf .d.ts typings for .proto files without package
Fixes #939
2020-09-01 14:14:05 -07:00
Stanley Cheung 3d921fffb7 Review fixes 2020-08-18 12:39:10 -07:00
Stanley Cheung 0238da3b6e Add immutable methods withGrpcCallOption, withMetadata to grpc.web.request, response 2020-08-18 12:39:10 -07:00
Stanley Cheung 6f5ecb0ad1 Some more internal refactor 2020-08-13 16:26:21 -07:00
Stanley Cheung 91702e7461 Migrate to ES6 classes 2020-08-10 10:42:31 -07:00
Stanley Cheung 68c1810a37 Refactor ClientUnaryCallImpl 2020-08-08 23:20:10 -07:00
Stanley Cheung 0599c38922 Roll forward of #853 2020-08-07 15:50:24 -07:00
Stanley Cheung 0a4b48e2d0 Fix some type annotations 2020-08-05 17:10:44 -07:00
Stanley Cheung bcdf3520b0 Update MethodDescriptorInterface 2020-07-24 18:24:47 -07:00
Stanley Cheung 85f7751e77 Remove duplicate decodeURIComponent call 2020-07-24 13:27:03 -07:00
wapa5pow 1e450e683c refactor hanndle error 2020-07-24 13:12:41 -07:00
wapa5pow 630ab16f4a add decode error message 2020-07-24 13:12:41 -07:00
Jack Pearkes 6ad62b1670 guard against null getResponseText()
Given the READY_STATE_CHANGE event can be trigged from for various
reasons and be in a situation where the response is not yet
written, this guards against a null value which is possible per
the specification:

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText
2020-07-21 21:31:14 -07:00
Stanley Cheung 5276b1e36d Add error handling to a few error conditions 2020-07-17 11:45:12 -07:00
Stanley Cheung 0aac5494fe Revert "Use methoddescriptorinterface"
This reverts commit 1ac8aa5a63.
2020-07-13 21:44:18 -07:00
Stanley Cheung 1ac8aa5a63 Use methoddescriptorinterface 2020-07-13 17:23:52 -07:00
Stanley Cheung 9b73daa521 Add missing types definitions 2020-07-13 10:56:43 -07:00
Stanley Cheung a913c18158 Minor tweak to methoddescriptor argument type 2020-07-08 15:11:00 -07:00
Stanley Cheung dfa6e478f2 Add @interface MethodDescroptorInterface 2020-07-08 14:42:47 -07:00
Stanley Cheung e27be18859 Update code generator to support Proto3 optional 2020-07-08 11:45:32 -07:00
Yannic Bonenberger cd059a28b2 [generator] Refactor dependency management
No functional changes intended.
2020-07-06 14:18:47 -07:00
Stanley Cheung e0835e2d1c Bug fix 2020-07-02 21:24:12 -07:00
Stanley Cheung 95db26456b Add an option goog_promise to generator 2020-07-02 21:24:12 -07:00
Stanley Cheung 550c8d2375 Make UnaryResponse an interface 2020-06-24 11:19:02 -07:00
Stanley Cheung 01c3421c74 Revert #738 2020-06-23 13:57:44 -07:00
Stanley Cheung a8416b5e7a Refactor error handling in grpcwebclientbase 2020-06-21 22:18:52 -07:00
Stanley Cheung c9b2e34e57 Fix @fileoverview comments 2020-06-19 10:52:40 -07:00
Stanley Cheung 670326124a Migrate to ES6 classes 2020-06-19 10:52:40 -07:00
Stanley Cheung 7a93e7f93e Rollback a change to streambodyclientreadablestream 2020-06-11 17:57:47 -07:00
Stanley Cheung 6e632b4183 Add a ThenableCall base class for the promise-based unaryCall function 2020-06-11 15:37:32 -07:00
Stanley Cheung 6900db20c0 Fix issues with callbacks 2020-06-09 17:38:01 -07:00
Stanley Cheung aadbdb7e3b Some refactor on streambodyclientreadablestream 2020-06-08 22:58:45 -07:00
Stanley Cheung 05029f3d00 Fix code generator bug and add tests 2020-06-05 22:03:38 -07:00
Yannic Bonenberger a055960f80 Add experimental ES6 import style
This change adds a new `import_style` that emits ES6 modules.
For now, this only re-exports the symbols from `import_style=closure`.

In the future, this will no longer require emitting google modules
(`goog.provide`). If protobuf ever adds support for emitting ES6
modules, we will use them instead of the `goog.provided`'d versions
as well.

Note that the Bazel integration is currently broken because of a
limitation in `rules_closure`.
2020-06-04 16:46:05 -07:00
Stanley Cheung f516ccbf3c Removed some unused code 2020-06-04 15:31:04 -07:00
Stanley Cheung 721afdf958 Linter changes 2020-06-02 11:40:06 -07:00
Stanley Cheung de0f650a72 Generate the callback client and promise client in two different files 2020-06-01 19:08:30 -07:00
hanabi1224 825dd2a9ee add missing comma 2020-05-31 22:01:01 -07:00
hanabi1224 9d96b7a4b8 Avoid double slash in url when client hostname has tailing slash 2020-05-31 22:01:01 -07:00
Stanley Cheung 5c1b6c7060 Quote string keys 2020-04-30 15:01:47 -07:00
Stanley Cheung 5864e5dd80 Fix a bug in test: callback not properly intercepted 2020-04-30 15:01:47 -07:00
Stanley Cheung cc6cdfb428 Linter changes 2020-04-27 18:51:58 -07:00
Stanley Cheung b62d3629c2 grpc-web interceptors implementation 2020-04-27 17:32:56 -07:00
Tomi Äijö 289ec8020f Add missing separator to imports from external files 2020-04-08 16:37:59 -07:00
Stanley Cheung b0ea6a1e55 Some refactoring prework before interceptors 2020-04-07 23:31:33 -07:00
Stanley Cheung d2858c7440 Add .on(metadata,...) callback to distinguish initial metadata 2020-04-06 15:28:45 -07:00
Stanley Cheung eeb65e66f9 fix whitespace 2020-04-03 14:33:23 -07:00
Yannic Bonenberger 1bcdae540a Remove extra semicolon 2020-04-03 13:27:47 -07:00
Yannic Bonenberger 2badafa034 Fix compilation error 2020-04-03 13:27:47 -07:00
Yannic Bonenberger fe3617c511 [generator] Move options parsing into dedicated class
*** Note: There is no behavior change from this patch. ***
2020-04-03 13:27:47 -07:00
Stanley Cheung d2f9e0a1eb Add Status to UnaryResponse 2020-04-02 16:21:08 -07:00
Stanley Cheung cc5cbf6e40 Fix BUILD.bazel 2020-03-23 23:20:35 -07:00
Stanley Cheung 508f50a32e Update generic client 2020-03-23 23:20:35 -07:00
Stanley Cheung 40aeadef9a Some cleanup 2020-03-19 13:01:27 -07:00
IagoLast 87209cb94b Disable static checkers on generated js files 2020-03-19 01:06:03 -07:00
Florent Castelli b7fb330e3e Enable builder pattern in Typescript protobuf messages. 2020-03-18 23:41:06 -07:00
Yannic Bonenberger 40cbb49772 [bazel] Update rules_closure + fix linter warnings
Working towards resolving #744, #575, #550, #700
2020-03-18 22:56:59 -07:00
Florent Castelli 7f9f7e8e5a Generate Promise based overloads for unary calls in Typescript
Fixes #580
2020-03-18 21:26:13 -07:00
travikk 410ca10711 Added @override to address compiler issues 2020-03-18 18:38:41 -07:00
travikk ebb0ec6549 Added missing semicolons 2020-03-18 18:38:41 -07:00
travikk 4206f4a546 Allow GrpcWebStreamParser to accept Uint8Array 2020-03-18 18:38:41 -07:00
Stanley Cheung 69f23cb5cf Remove two unused goog.require 2020-01-22 11:55:42 -08:00
Holger Finger 764d5bcd18 fix bug that grpc-status response headers resulted in doubled execution of the callback provided to rpcCall. 2020-01-21 14:34:48 -08:00
Stanley Cheung d03435fc6e Do not hardcode CXX to g++ 2019-12-06 14:04:14 -08:00
Stanley Cheung 55ebde4719 Revert #683 2019-12-05 11:30:14 -08:00
travikk 5c65dc4a2c Pass raw buffer to stream parser 2019-12-02 13:22:36 -08:00
travikk 03b73fbe45 Optimise parsing incoming payload 2019-12-02 13:22:36 -08:00
Stanley Cheung 37636129a0 Fix bazel.build 2019-10-29 10:51:42 -07:00
Stanley Cheung a96b958120 Add metadata to error callback 2019-10-29 10:51:42 -07:00
Stanley Cheung 0f79fb4366 Revert "Add metadata in gRPC error"
This reverts commit fe2ea6b351.
2019-10-29 02:15:14 -07:00
A. Ishikawa fe2ea6b351 Add metadata in gRPC error 2019-10-29 01:03:38 -07:00
Stanley Cheung c22f57497b Remove unused require 2019-10-18 11:23:34 -07:00
Julien Roncaglia 401e54063c Ensure that the end callback is called
Previously the end callback was called by checking the state at the end of
the READY_STATE_CHANGE event. The problem with this approach is that there
are multiple early exit cases in this function and when they happen the
consumer is never informed of the end of the stream.

The new approach is to only dispatch the event when the COMPLETE event is
received (Except if an error is dispatched) so the last event is always
either 'error' or 'end').
2019-10-18 11:23:34 -07:00
Stanley Cheung ab6ff71786 Fix error callback 2019-10-16 11:13:18 -07:00
Stanley Cheung 06bda9256e Add CallOptions class 2019-09-30 15:40:48 -07:00
Stanley Cheung 2fa4270334 Fix generated code return type, and remove unused var 2019-09-18 13:10:53 -07:00
Stanley Cheung 8113edeeff Use nullptr instead 2019-09-09 15:34:04 -07:00
Alexey Smirnov 5ee2126d85 Fix output directory name when using import_style=typescript 2019-09-09 13:37:31 -07:00
Stanley Cheung ea4f1aa637 Added API for simple unary call 2019-09-09 13:19:11 -07:00
Harman Gakhal 1711674d66 Return specific grpc status code on http error 2019-08-23 16:10:03 -07:00
Stanley Cheung 9365fd62fc WIP: Generate method descriptors into multiple files 2019-08-22 10:49:30 -07:00
Stanley Cheung ab906036ea Add support in code generator for printing only method descriptors 2019-08-20 12:58:50 -07:00
Stanley Cheung 6a3b282fb0 Remove internal frameworks mode 2019-08-17 00:19:50 -07:00
Stanley Cheung e2f999a0df Some linter formatting changes 2019-08-05 14:39:48 -07:00
Stanley Cheung 36598a2ab1 Fixed semicolons 2019-08-03 00:09:53 -07:00
Stanley Cheung 3b76ca5810 Fix status and error callbacks 2019-08-03 00:09:53 -07:00
Stanley Cheung 8b501a96f4 Remove trailing whitespace; 2019-07-31 17:42:43 -07:00
Stanley Cheung 365783307e Add option to set withCredentials to true 2019-07-31 16:53:50 -07:00
Stanley Cheung 2ae8118d78 Adding some groundwork for generic client 2019-07-31 16:22:41 -07:00
lqs ab242d2bb9 fix wrong package name of input type 2019-07-30 17:51:33 -07:00
Markus Padourek db6cd68df9 Add missing newline 2019-07-01 11:16:08 -07:00
Markus Padourek 10828d7ccc Ensure credentials are not undefined in typescript
Fixes #581
2019-07-01 11:16:08 -07:00
Ben Foxall 0c24e95a38 Uppercase enum keys
To match the generated JS
2019-07-01 10:38:09 -07:00
Stanley Cheung d16364954a Make MethodType a separate class 2019-06-06 15:39:50 -07:00
Stanley Cheung cee964f746 Fix missing bazel def 2019-06-06 15:39:50 -07:00
Stanley Cheung a8e54b3885 Introducing MethodDescriptor 2019-06-06 15:39:50 -07:00
Henke Adolfsson 968b3d2bb2 Default to no grpc-timeout header when timeout is Infinity 2019-05-19 23:09:38 -07:00
Henke Adolfsson 9e666831d1 Use precalculated number for Infinity 2019-05-19 23:09:38 -07:00
Henke Adolfsson 81426015b3 Remove a isFinite that was already checked for 2019-05-19 23:09:38 -07:00