ts-proto 2.2.5 → 2.2.7

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.
@@ -10,13 +10,13 @@ const CallOptions = (0, ts_poet_1.imp)("t:CallOptions@@grpc/grpc-js");
10
10
  const ChannelCredentials = (0, ts_poet_1.imp)("ChannelCredentials@@grpc/grpc-js");
11
11
  const ClientOptions = (0, ts_poet_1.imp)("t:ClientOptions@@grpc/grpc-js");
12
12
  const Client = (0, ts_poet_1.imp)("Client@@grpc/grpc-js");
13
- const ClientDuplexStream = (0, ts_poet_1.imp)("ClientDuplexStream@@grpc/grpc-js");
14
- const ClientReadableStream = (0, ts_poet_1.imp)("ClientReadableStream@@grpc/grpc-js");
13
+ const ClientDuplexStream = (0, ts_poet_1.imp)("t:ClientDuplexStream@@grpc/grpc-js");
14
+ const ClientReadableStream = (0, ts_poet_1.imp)("t:ClientReadableStream@@grpc/grpc-js");
15
15
  const ClientUnaryCall = (0, ts_poet_1.imp)("t:ClientUnaryCall@@grpc/grpc-js");
16
- const ClientWritableStream = (0, ts_poet_1.imp)("ClientWritableStream@@grpc/grpc-js");
17
- const handleBidiStreamingCall = (0, ts_poet_1.imp)("handleBidiStreamingCall@@grpc/grpc-js");
18
- const handleClientStreamingCall = (0, ts_poet_1.imp)("handleClientStreamingCall@@grpc/grpc-js");
19
- const handleServerStreamingCall = (0, ts_poet_1.imp)("handleServerStreamingCall@@grpc/grpc-js");
16
+ const ClientWritableStream = (0, ts_poet_1.imp)("t:ClientWritableStream@@grpc/grpc-js");
17
+ const handleBidiStreamingCall = (0, ts_poet_1.imp)("t:handleBidiStreamingCall@@grpc/grpc-js");
18
+ const handleClientStreamingCall = (0, ts_poet_1.imp)("t:handleClientStreamingCall@@grpc/grpc-js");
19
+ const handleServerStreamingCall = (0, ts_poet_1.imp)("t:handleServerStreamingCall@@grpc/grpc-js");
20
20
  const handleUnaryCall = (0, ts_poet_1.imp)("t:handleUnaryCall@@grpc/grpc-js");
21
21
  const UntypedServiceImplementation = (0, ts_poet_1.imp)("t:UntypedServiceImplementation@@grpc/grpc-js");
22
22
  const makeGenericClientConstructor = (0, ts_poet_1.imp)("makeGenericClientConstructor@@grpc/grpc-js");
@@ -169,7 +169,10 @@ function getExtensionValue(ctx, extension, data) {
169
169
  return Buffer.from(bytes);
170
170
  }));
171
171
  const result = resultBuffer.toString("base64");
172
- return (0, ts_poet_1.code) `'${extension.name}': ${typeName}.decode(Buffer.from('${result}', 'base64'))`;
172
+ const encoded = ctx.options.env === options_1.EnvOption.NODE
173
+ ? (0, ts_poet_1.code) `Buffer.from('${result}', 'base64')`
174
+ : (0, ts_poet_1.code) `${ctx.utils.bytesFromBase64}("${result}")`;
175
+ return (0, ts_poet_1.code) `'${extension.name}': ${typeName}.decode(${encoded})`;
173
176
  }
174
177
  else {
175
178
  const reader = new wire_1.BinaryReader(data[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "",
5
5
  "main": "build/src/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",