ts-proto 1.131.1 → 1.131.2

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.131.2](https://github.com/stephenh/ts-proto/compare/v1.131.1...v1.131.2) (2022-11-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Adding a failing regression test for wrapper types ([#689](https://github.com/stephenh/ts-proto/issues/689)) ([bde2e28](https://github.com/stephenh/ts-proto/commit/bde2e28ad70bf05ebb21effcdb1caad7217c8291))
7
+
1
8
  ## [1.131.1](https://github.com/stephenh/ts-proto/compare/v1.131.0...v1.131.1) (2022-11-13)
2
9
 
3
10
 
@@ -76,17 +76,17 @@ function generateRegularRpcMethod(ctx, fileDesc, serviceDesc, methodDesc) {
76
76
  (0, utils_1.assertInstanceOf)(methodDesc, utils_1.FormattedMethodDescriptor);
77
77
  const { options, utils } = ctx;
78
78
  const Reader = (0, utils_1.impFile)(ctx.options, "Reader@protobufjs/minimal");
79
- const rawInputType = (0, types_1.rawRequestType)(ctx, methodDesc);
79
+ const rawInputType = (0, types_1.rawRequestType)(ctx, methodDesc, { keepValueType: true });
80
80
  const inputType = (0, types_1.requestType)(ctx, methodDesc);
81
81
  const outputType = (0, types_1.responseType)(ctx, methodDesc);
82
82
  const rawOutputType = (0, types_1.responseType)(ctx, methodDesc, { keepValueType: true });
83
83
  const params = [...(options.context ? [(0, ts_poet_1.code) `ctx: Context`] : []), (0, ts_poet_1.code) `request: ${inputType}`];
84
84
  const maybeCtx = options.context ? "ctx," : "";
85
85
  let encode = (0, ts_poet_1.code) `${rawInputType}.encode(request).finish()`;
86
- let decode = (0, ts_poet_1.code) `data => ${outputType}.decode(new ${Reader}(data))`;
87
- if (options.useDate && rawOutputType.toString().includes("Timestamp")) {
88
- decode = (0, ts_poet_1.code) `data => ${utils.fromTimestamp}(${rawOutputType}.decode(new ${Reader}(data)))`;
89
- }
86
+ let decode = (0, ts_poet_1.code) `data => ${rawOutputType}.decode(new ${Reader}(data))`;
87
+ // if (options.useDate && rawOutputType.toString().includes("Timestamp")) {
88
+ // decode = code`data => ${utils.fromTimestamp}(${rawOutputType}.decode(new ${Reader}(data)))`;
89
+ // }
90
90
  if (methodDesc.clientStreaming) {
91
91
  if (options.useAsyncIterable) {
92
92
  encode = (0, ts_poet_1.code) `${rawInputType}.encodeTransform(request)`;
package/build/types.js CHANGED
@@ -615,8 +615,8 @@ function detectMapType(ctx, messageDesc, fieldDesc) {
615
615
  return undefined;
616
616
  }
617
617
  exports.detectMapType = detectMapType;
618
- function rawRequestType(ctx, methodDesc) {
619
- return messageToTypeName(ctx, methodDesc.inputType);
618
+ function rawRequestType(ctx, methodDesc, typeOptions = {}) {
619
+ return messageToTypeName(ctx, methodDesc.inputType, typeOptions);
620
620
  }
621
621
  exports.rawRequestType = rawRequestType;
622
622
  function observableType(ctx) {
@@ -627,7 +627,7 @@ function observableType(ctx) {
627
627
  }
628
628
  exports.observableType = observableType;
629
629
  function requestType(ctx, methodDesc, partial = false) {
630
- let typeName = rawRequestType(ctx, methodDesc);
630
+ let typeName = rawRequestType(ctx, methodDesc, { keepValueType: true });
631
631
  if (partial) {
632
632
  typeName = (0, ts_poet_1.code) `${ctx.utils.DeepPartial}<${typeName}>`;
633
633
  }
@@ -638,15 +638,15 @@ function requestType(ctx, methodDesc, partial = false) {
638
638
  }
639
639
  exports.requestType = requestType;
640
640
  function responseType(ctx, methodDesc, typeOptions = {}) {
641
- return messageToTypeName(ctx, methodDesc.outputType, typeOptions);
641
+ return messageToTypeName(ctx, methodDesc.outputType, { keepValueType: true });
642
642
  }
643
643
  exports.responseType = responseType;
644
644
  function responsePromise(ctx, methodDesc) {
645
- return (0, ts_poet_1.code) `Promise<${responseType(ctx, methodDesc)}>`;
645
+ return (0, ts_poet_1.code) `Promise<${responseType(ctx, methodDesc, { keepValueType: true })}>`;
646
646
  }
647
647
  exports.responsePromise = responsePromise;
648
648
  function responseObservable(ctx, methodDesc) {
649
- return (0, ts_poet_1.code) `${observableType(ctx)}<${responseType(ctx, methodDesc)}>`;
649
+ return (0, ts_poet_1.code) `${observableType(ctx)}<${responseType(ctx, methodDesc, { keepValueType: true })}>`;
650
650
  }
651
651
  exports.responseObservable = responseObservable;
652
652
  function responsePromiseOrObservable(ctx, methodDesc) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.131.1",
3
+ "version": "1.131.2",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",