ts-proto 1.142.0 → 1.142.1
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/build/generate-services.js +3 -3
- package/build/main.js +1 -1
- package/package.json +1 -1
|
@@ -90,9 +90,9 @@ function generateRegularRpcMethod(ctx, methodDesc) {
|
|
|
90
90
|
const maybeCtx = options.context ? "ctx," : "";
|
|
91
91
|
const maybeAbortSignal = options.useAbortSignal ? "abortSignal || undefined," : "";
|
|
92
92
|
let encode = (0, ts_poet_1.code) `${rawInputType}.encode(request).finish()`;
|
|
93
|
-
let decode = (0, ts_poet_1.code) `data => ${rawOutputType}.decode(
|
|
93
|
+
let decode = (0, ts_poet_1.code) `data => ${rawOutputType}.decode(${Reader}.create(data))`;
|
|
94
94
|
// if (options.useDate && rawOutputType.toString().includes("Timestamp")) {
|
|
95
|
-
// decode = code`data => ${utils.fromTimestamp}(${rawOutputType}.decode(
|
|
95
|
+
// decode = code`data => ${utils.fromTimestamp}(${rawOutputType}.decode(${Reader}.create(data)))`;
|
|
96
96
|
// }
|
|
97
97
|
if (methodDesc.clientStreaming) {
|
|
98
98
|
if (options.useAsyncIterable) {
|
|
@@ -239,7 +239,7 @@ function generateCachingRpcMethod(ctx, fileDesc, serviceDesc, methodDesc) {
|
|
|
239
239
|
const responses = requests.map(async request => {
|
|
240
240
|
const data = ${inputType}.encode(request).finish()
|
|
241
241
|
const response = await this.rpc.request(ctx, "${(0, utils_1.maybePrefixPackage)(fileDesc, serviceDesc.name)}", "${methodDesc.name}", data);
|
|
242
|
-
return ${outputType}.decode(
|
|
242
|
+
return ${outputType}.decode(${Reader}.create(response));
|
|
243
243
|
});
|
|
244
244
|
return Promise.all(responses);
|
|
245
245
|
}
|
package/build/main.js
CHANGED
|
@@ -669,7 +669,7 @@ function generateDecode(ctx, fullName, messageDesc) {
|
|
|
669
669
|
input: ${Reader} | Uint8Array,
|
|
670
670
|
length?: number,
|
|
671
671
|
): ${fullName} {
|
|
672
|
-
const reader = input instanceof ${Reader} ? input :
|
|
672
|
+
const reader = input instanceof ${Reader} ? input : ${Reader}.create(input);
|
|
673
673
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
674
674
|
`);
|
|
675
675
|
chunks.push((0, ts_poet_1.code) `const message = ${createBase}${maybeAsAny(options)};`);
|