ts-proto 1.155.1 → 1.156.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/README.markdown CHANGED
@@ -376,6 +376,10 @@ Generated code will be placed in the Gradle build directory.
376
376
 
377
377
  This is also useful if you want "only types".
378
378
 
379
+ - With `--ts_proto_opt=outputJsonMethods=to-only` and `--ts_proto_opt=outputJsonMethods=from-only` you will be able to export only one between the `Message.toJSON` and `Message.fromJSON` methods.
380
+
381
+ This is useful if you're using ts-proto just to `encode` or `decode` and not for both.
382
+
379
383
  - With `--ts_proto_opt=outputPartialMethods=false`, the `Message.fromPartial` and `Message.create` methods for accepting partially-formed objects/object literals will not be output.
380
384
 
381
385
  - With `--ts_proto_opt=stringEnums=true`, the generated enum types will be string-based instead of int-based.
package/build/main.js CHANGED
@@ -123,8 +123,12 @@ function generateFile(ctx, fileDesc) {
123
123
  staticMembers.push((0, generate_async_iterable_1.generateDecodeTransform)(fullName));
124
124
  }
125
125
  if (options.outputJsonMethods) {
126
- staticMembers.push(generateFromJson(ctx, fullName, fullTypeName, message));
127
- staticMembers.push(generateToJson(ctx, fullName, fullTypeName, message));
126
+ if (options.outputJsonMethods === true || options.outputJsonMethods === "from-only") {
127
+ staticMembers.push(generateFromJson(ctx, fullName, fullTypeName, message));
128
+ }
129
+ if (options.outputJsonMethods === true || options.outputJsonMethods === "to-only") {
130
+ staticMembers.push(generateToJson(ctx, fullName, fullTypeName, message));
131
+ }
128
132
  }
129
133
  if (options.outputPartialMethods) {
130
134
  staticMembers.push(generateFromPartial(ctx, fullName, message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.155.1",
3
+ "version": "1.156.1",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",
@@ -68,7 +68,7 @@
68
68
  "case-anything": "^2.1.13",
69
69
  "protobufjs": "^7.2.4",
70
70
  "ts-poet": "^6.5.0",
71
- "ts-proto-descriptors": "1.14.0"
71
+ "ts-proto-descriptors": "1.15.0"
72
72
  },
73
73
  "packageManager": "yarn@3.6.0"
74
74
  }