ts-proto 1.130.0 → 1.131.0

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.0](https://github.com/stephenh/ts-proto/compare/v1.130.0...v1.131.0) (2022-10-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * option useSnakeTypeName ([#694](https://github.com/stephenh/ts-proto/issues/694)) ([ad73ff9](https://github.com/stephenh/ts-proto/commit/ad73ff9341d0d593156d10b5d96c4a47afdc802d))
7
+
1
8
  # [1.130.0](https://github.com/stephenh/ts-proto/compare/v1.129.0...v1.130.0) (2022-10-22)
2
9
 
3
10
 
package/README.markdown CHANGED
@@ -464,6 +464,24 @@ Generated code will be placed in the Gradle build directory.
464
464
 
465
465
  - With `--ts_proto_opt=useReadonlyTypes=true`, the generated types will be declared as immutable using typescript's `readonly` modifer.
466
466
 
467
+ - With `--ts_proto_opt=useSnakeTypeName=false` will remove snake casing from types.
468
+
469
+ Example Protobuf
470
+ ```protobuf
471
+ message Box {
472
+ message Element {
473
+ message Image {
474
+ enum Alignment {
475
+ LEFT = 1;
476
+ CENTER = 2;
477
+ RIGHT = 3;
478
+ }
479
+ }
480
+ }
481
+ }
482
+ ```
483
+ by default this is enabled which would generate a type of `Box_Element_Image_Alignment`. By disabling this option the type that is generated would be `BoxElementImageAlignment`.
484
+
467
485
  ### NestJS Support
468
486
 
469
487
  We have a great way of working together with [nestjs](https://docs.nestjs.com/microservices/grpc). `ts-proto` generates `interfaces` and `decorators` for you controller, client. For more information see the [nestjs readme](NESTJS.markdown).
package/build/options.js CHANGED
@@ -74,6 +74,7 @@ function defaultOptions() {
74
74
  initializeFieldsAsUndefined: true,
75
75
  useMapType: false,
76
76
  useReadonlyTypes: false,
77
+ useSnakeTypeName: true,
77
78
  M: {},
78
79
  };
79
80
  }
package/build/visit.js CHANGED
@@ -23,7 +23,8 @@ function visit(proto, sourceInfo, messageFn, options, enumFn = () => { }, tsPref
23
23
  const tsFullName = tsPrefix + (0, case_1.maybeSnakeToCamel)(messageName(message), options);
24
24
  const nestedSourceInfo = sourceInfo.open(childType, index);
25
25
  messageFn(tsFullName, message, nestedSourceInfo, protoFullName);
26
- visit(message, nestedSourceInfo, messageFn, options, enumFn, tsFullName + "_", protoFullName + ".");
26
+ const delim = options.useSnakeTypeName ? "_" : "";
27
+ visit(message, nestedSourceInfo, messageFn, options, enumFn, tsFullName + delim, protoFullName + ".");
27
28
  });
28
29
  }
29
30
  exports.visit = visit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.130.0",
3
+ "version": "1.131.0",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",