Skip to content

Releases: tatethurston/TwirpScript

v0.0.51

28 Mar 19:52
84f7ae6
Compare
Choose a tag to compare

What's Changed

  • When using protobuf map fields, map keys are now typed as strings: Record<string, $SomeType>. Previously other types were accepted, which would cause type checking to fail when the key was boolean, bigint, or number. This is also more correct because JavaScript always encodes object keys as strings. Generated type definitions for map types are no longer exported. See #151 for more background.
  • Empty messages now generate the full serialization interface implemented by other messages. This resolves an issue where messages with fields whose value was an empty message would fail code generation.
  • Enum serializers now have two private serialization helpers. This resolves an issue where Enums imported into other protobuf files failed code generation. See #150 for more background.

Full Changelog: v0.0.50...v0.0.51

v0.0.50

17 Mar 16:45
fef0279
Compare
Choose a tag to compare

What's Changed

  • Add typescript.emitDeclarationOnly only option. This will only emit TypeScript type definitions and not any runtime. See #147 for more context.

Full Changelog: v0.0.49...v0.0.50

v0.0.49

04 Mar 23:01
efa2eb5
Compare
Choose a tag to compare

What's Changed

This version has 2 breaking changes that are unlikely to impact users:

  1. Enums are now represented by the enum value specified in proto instead of an integer. Eg: "FOO_BAR" instead of 0. This improves the developer experience when printing messages. This is a breaking change, but users using protobuf serialization should be unimpacted unless their code directly references enums via their integer value instead of the generated constants.

Eg:

// this code will now need to migrate to the string value instead of an integer
`if (foo.someEnum === 0)`
// this code will continue to work without change
`if (foo.someEnum === SomeEnum.Field)`

JSON serialization now also uses the enum value instead of an integer value, as described by the protobuf JSON specification. This is a breaking change for JSON clients.

  1. Bytes are now Base64 encoded when JSON serializing as described by the protobuf JSON specification above. This is a breaking change for JSON clients.

Full Changelog: v0.0.48...v0.0.49

v0.0.48

01 Mar 04:59
4036b4a
Compare
Choose a tag to compare

What's Changed

This version has the following bug fixes:

  • Fix nested message definitions. Previously this would cause "ReferenceError: Cannot access before initialization" error.
  • Fix repeated int64 generation. The generated code would not compile for repeated bigint cases
  • Fix bigint json serialization for maps
  • Fix comment escaping
  • Fix reserved names for internal variables

Code generation for map types are no longer inlined. This is an internal refactor that should not impact consumption, but there will be changes to generated .pb.ts files the next time yarn twirpscript runs.

Full Changelog: v0.0.47...v0.0.48

v0.0.47

23 Feb 00:50
2b74bd7
Compare
Choose a tag to compare

What's Changed

See the README's configuration section for more context.

Full Changelog: v0.0.46...v0.0.47

v0.0.46

16 Feb 19:42
a4d83f9
Compare
Choose a tag to compare

What's Changed

This version has 3 breaking changes:

  1. (Only impacts TypeScript users) The 'Service' naming suffix has been removed from the generated TypeScript types for services. Given the following proto:
service Haberdasher {
  rpc MakeHat(Size) returns (Hat);
}

The generated service type will now be Haberdasher instead of HaberdasherService. This enables better out of the box compatibility with buf which expects all service names to end with Service. Following this recommendation would generate TwirpScript types with 'ServiceService' suffixes.

<Service>Service => <Service>

  1. The 'Handler' suffix has been removed from the generated create<Service>Handler helper.

Given the proto above, the generated helper is now createHaberdasher instead of createHaberdasherHandler.

create<Service>Handler=> create<Service>

  1. (Only impacts TypeScript users) optional types now accept null and undefined. This enables better compatibility with other tools that may type optionals as some type | null

Changes:

Full Changelog: v0.0.45...v0.0.46

v0.0.45

09 Feb 19:45
75c2605
Compare
Choose a tag to compare

What's Changed

  • no longer generate _readMessageJSON for empty messages
  • fix map types in _readMessageJSON

Full Changelog: v0.0.43...v0.0.45

v0.0.44

02 Feb 23:42
22051b0
Compare
Choose a tag to compare

What's Changed

This version has breaking changes between the generated code and the runtime. Run yarn twirspcript to update your generated .pb.ts when updating to this version.

TwirpScript now ships with JSON serializers and supports the json_name option described here. This enables clients to specify custom JSON field names.

Breaking change: int64 types were previously encoded as strings, but are now encoded as bigint.

Changes:

Full Changelog: v0.0.43...v0.0.44

v0.0.43

28 Jan 01:57
949503b
Compare
Choose a tag to compare

v0.0.43

What's Changed

Full Changelog: v0.0.42...v0.0.43

v0.0.42

24 Jan 21:22
a82b180
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.0.41...v0.0.42