1.0.0 • Published 8 months ago

@sv-tools/protoc-gen-ts-pblite v1.0.0

Weekly downloads
-
License
MIT OR Apache-2.0
Repository
-
Last release
8 months ago

protoc-gen-ts-pblite

Compile .proto files to simple, dependency-free TypeScript classes, for use with Google's PBLite format.

  • Messages become typescript classes.
  • Enums become typescript enums.
  • Fields become getters/setter properties.
  • The output does not have a dependency on google-protobuf.

PBLite is the format used for storage by google-protobuf and for data transfer by some Google GRPC services. It encodes protobuf messages as nested JSON arrays.

Options

--ts-pblite_opt=generic (default)

Generate serialize() methods using the google-protobuf API.

--ts-pblite_opt=url

Generate standalone stringify${MessageName} functions that serialize to Google's PBLite URL string format.

import { stringifyTilePanoramasRequest, TilePanoramasRequest } from './protos'
declare const request: TilePanoramasRequest
const pb: string = stringifyTilePanoramasRequest(request)
const query = new URLSearchParams(['pb', pb])
// Use in a URL

Using the URL format requires installing this base64 package to handle bytes fields:

npm install @jsonjoy.com/base64@^1.0.0

License

MIT · ⓒ 2022 Renée Kooi

1.0.0

8 months ago

0.1.0-alpha.4

12 months ago

0.1.0-alpha.3

12 months ago

0.1.0-alpha.2

2 years ago

0.1.0-alpha.1

2 years ago