{"_id":"@changyenh/protoc-gen-ts","_rev":"2-5af06b424e39e3a14176dda671399e82","name":"@changyenh/protoc-gen-ts","dist-tags":{"latest":"0.8.3"},"versions":{"0.8.2":{"name":"@changyenh/protoc-gen-ts","description":"Compile protocol buffers descriptors to Typescript.","version":"0.8.2","license":"MIT","author":{"name":"thesayyn","email":"thesayyn@gmail.com","url":"https://github.com/thesayyn"},"funding":{"type":"individual","url":"https://www.buymeacoffee.com/thesayyn"},"repository":{"type":"git","url":"git+https://github.com/changyenh/protoc-gen-ts.git"},"contributors":[{"name":"changyenh","email":"changyenhtw@gmail.com","url":"https://github.com/changyenh"}],"scripts":{"test":"bazel build //test:codegen //test:codegen_experimental //test/conformance:codegen && node ./scripts/sync_generated_protos.js test && bazel test //test/... --test_output=errors","release":"npm publish --access public --tag latest --registry https://registry.npmjs.org","codegen":"node ./scripts/sync_compiler_protos.js && bazel build //src:codegen && node ./scripts/sync_generated_protos.js src/compiler && bazel build //src:compiler && node ./scripts/sync_generated_protos.js src/compiler js"},"bin":{"protoc-gen-ts":"bin/protoc-gen-ts.js"},"peerDependencies":{"google-protobuf":"^3.13.0","typescript":">=4"},"devDependencies":{"@bazel/bazelisk":"^1.9.0","@bazel/jasmine":"next","@bazel/typescript":"next","@grpc/grpc-js":"^1.3.4","@types/google-protobuf":"^3.15.5","@types/jasmine":"^3.7.7","@types/node":"^15.12.5","google-protobuf":"^3.17.3","jasmine":"^3.7.0","jasmine-core":"^3.7.1","typescript":"^4.3.4"},"gitHead":"1e9dede38d83af8a65386130bc79f90efee22064","bugs":{"url":"https://github.com/changyenh/protoc-gen-ts/issues"},"homepage":"https://github.com/changyenh/protoc-gen-ts#readme","_id":"@changyenh/protoc-gen-ts@0.8.2","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","_npmUser":{"name":"changyenh","email":"changyenhtw@gmail.com"},"dist":{"integrity":"sha512-0H+ngbziQyJkGl2NwY7iwOrpkbydvcPlHJTwlwSKGChy3JOamfD1hsyrlQ74yQfaZV2/tFMKnee8vPByXsUSkA==","shasum":"1e68ac174ebec561629718a1cb77322e085285ae","tarball":"https://registry.npmjs.org/@changyenh/protoc-gen-ts/-/protoc-gen-ts-0.8.2.tgz","fileCount":12,"unpackedSize":296827,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzxp5CRA9TVsSAnZWagAAR+8QAJsxtYLfzgPHlhJqCuBE\npev0FbLyOFu1a8XjW1+52H0GmFLyulGNVdMUr7ZHWT9JvtXK+Iuyn/Io3oFH\nXDhucqZrT0cYOCl35pFzzOnKfg4zTURFmLWDvXBro/42if50KaXUvG/SEoUp\n8cz928Yvcnhbg0y/FrLjxC1hs/44lSW4ytkMoSdORXvHxAseSCI3Rtajs37L\noN9LKtJ/iSEmCxMiKV0nt2E7jYakgGjNY9aVK5sGj5Mv0btCLF8Xx8B970zF\nDwTeaKm7DgrfB5ZFyJEvpvpP5BtBTbzRp1WFke4Lhh8ozasi4hUmu86+e33s\nghfN+T702rJ4hyMZUsjPFzpzD91XeaV/Bzc/EL9tw2Lq7FL/lu/ISbymkb6p\nI/WHPsWKscO5dAAjBrHa5wmHispBm7jG6CEFwVLQZDytzxXn0goS1Fh5+wEb\nbwOS7VwbT+iq+O58x4FXd4Eq4l5VSi4JtwSTPC0XvQW31y2fHSbzGoTmL/4X\nrYo5MZBmyz0cMnOFG65+e/IynQ5snFydzL9m4WV5w2WYa20hb1GGFFrdFCvh\nzhIPgCSJdMV19uG6FpVTaVd1HFaDeismUIlgBaAEeO/y8euVSXtruxfPYxt2\nnzsNbY3GZaSKCLmlnE8HOnVwe3o8PLQnhyQ8H3Aik5EvuhsXz8/EuuDg1iQS\nBCcc\r\n=sc7q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDC7I9KzSDrtVzDJAnkCd4t+CCx5YLqB4cx40BQFU9m4AIgNwoKo1XE1d1TPrgbo9ugfEq+oJMW7JECSSrlzQ/fdGY="}]},"directories":{},"maintainers":[{"name":"changyenh","email":"changyenhtw@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/protoc-gen-ts_0.8.2_1640962680919_0.30627306302274393"},"_hasShrinkwrap":false},"0.8.3":{"name":"@changyenh/protoc-gen-ts","description":"Compile protocol buffers descriptors to Typescript.","version":"0.8.3","license":"MIT","author":{"name":"thesayyn","email":"thesayyn@gmail.com","url":"https://github.com/thesayyn"},"funding":{"type":"individual","url":"https://www.buymeacoffee.com/thesayyn"},"repository":{"type":"git","url":"git+https://github.com/changyenh/protoc-gen-ts.git"},"contributors":[{"name":"changyenh","email":"changyenhtw@gmail.com","url":"https://github.com/changyenh"}],"scripts":{"test":"bazel build //test:codegen //test:codegen_experimental //test/conformance:codegen && node ./scripts/sync_generated_protos.js test && bazel test //test/... --test_output=errors","release":"npm publish --access public --tag latest --registry https://registry.npmjs.org","codegen":"node ./scripts/sync_compiler_protos.js && bazel build //src:codegen && node ./scripts/sync_generated_protos.js src/compiler && bazel build //src:compiler && node ./scripts/sync_generated_protos.js src/compiler js"},"bin":{"protoc-gen-ts":"bin/protoc-gen-ts.js"},"peerDependencies":{"google-protobuf":"^3.13.0","typescript":">=4"},"devDependencies":{"@bazel/bazelisk":"^1.9.0","@bazel/jasmine":"next","@bazel/typescript":"next","@grpc/grpc-js":"^1.3.4","@types/google-protobuf":"^3.15.5","@types/jasmine":"^3.7.7","@types/node":"^15.12.5","google-protobuf":"^3.17.3","jasmine":"^3.7.0","jasmine-core":"^3.7.1","typescript":"^4.3.4"},"gitHead":"1e9dede38d83af8a65386130bc79f90efee22064","bugs":{"url":"https://github.com/changyenh/protoc-gen-ts/issues"},"homepage":"https://github.com/changyenh/protoc-gen-ts#readme","_id":"@changyenh/protoc-gen-ts@0.8.3","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","_npmUser":{"name":"changyenh","email":"changyenhtw@gmail.com"},"dist":{"integrity":"sha512-IOWnGjLpctN2BIJyf+o9txEB6Rl5A8lInR/w52/aYbvW03BEgOPeCGdeWL28LW9GxD4yMzzVC73FKVNoV7Yjng==","shasum":"66cd6f6dffe8aa2199765d29c62eb969139eb047","tarball":"https://registry.npmjs.org/@changyenh/protoc-gen-ts/-/protoc-gen-ts-0.8.3.tgz","fileCount":12,"unpackedSize":296437,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzx5ECRA9TVsSAnZWagAAFE0P/ApEovsfxmqR/CQ8EOUa\nxT04HlegDd2G+qZGFfc8vgS2yju9gBpI+OmrWgey6IQRvKNOkXzJNksuqQGv\n1OuxqPIH87+JKja07wz4u0IEIWqa7TVVAFQ8YsAkZ9sFtr97z4pInGiC67NX\n9LxokvT6ubivRv8bRv/e9MCyeKWSHi42XSdZlAaZHj9WYTcHFzcJLXtppuCW\npePteJNJYl6jbEy7aIWn89sl7ZwxAL5ANkVeqsjUaGR/X+Cc1O4H+yOP0CXG\nYUiPm2W+vIVNDUCIszEsJrO8M0gN53ekQlwAF9laMvvJqxL5beu7M1sJ6Bip\nN4l2GETXbcUkf74Z+y2u4Pwo1ulxebGE6hSqPwSpLPLMK/BLyN8xvwcQ81cN\ngYxhcjmCDEzZ0Yrk6Kddr/kv0a0k20vLg2B+ShubG30I/35o0zlAx57e81Qd\nXoOQIt3ckWdREvIO7MfU4RVTEkPqOmUG8sznD7sAYEIm3tvbV265jCEr7dXq\n/iAXZ/tRYCpmNO5boRtN/gM5e+wVEIE5yVkbqSdP8BlLYzjz6cPXDCzyxlGF\n+mukwL6EYf40K8BJrJR2SQbmKIT23IsrS5aGb63vr9FacXgy6ezzzlUJFSzj\nEdP5bHUA9JyW5H7TLlBRgpLm3zvAKC28RV95acVNKn9+/0VqG91jN57u7oPD\nzLC5\r\n=bk5Q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwcBxBMa+1W/dbq5bwBRxlPFZzeWGz7nsf2IdLLi7q8wIgPfsn3vNTBA/0py9vzRFoIHF5nRy2gTKR4/gQZiPCA/c="}]},"directories":{},"maintainers":[{"name":"changyenh","email":"changyenhtw@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/protoc-gen-ts_0.8.3_1640963651905_0.9176449097343047"},"_hasShrinkwrap":false}},"time":{"created":"2021-12-31T14:58:00.874Z","0.8.2":"2021-12-31T14:58:01.080Z","modified":"2022-04-04T22:30:27.633Z","0.8.3":"2021-12-31T15:14:12.156Z"},"maintainers":[{"name":"changyenh","email":"changyenhtw@gmail.com"}],"description":"Compile protocol buffers descriptors to Typescript.","homepage":"https://github.com/changyenh/protoc-gen-ts#readme","repository":{"type":"git","url":"git+https://github.com/changyenh/protoc-gen-ts.git"},"contributors":[{"name":"changyenh","email":"changyenhtw@gmail.com","url":"https://github.com/changyenh"}],"author":{"name":"thesayyn","email":"thesayyn@gmail.com","url":"https://github.com/thesayyn"},"bugs":{"url":"https://github.com/changyenh/protoc-gen-ts/issues"},"license":"MIT","readme":"# Protoc Gen Typescript \r\n\r\n[![test](https://github.com/thesayyn/protoc-gen-ts/actions/workflows/test.yaml/badge.svg?branch=master)](https://github.com/thesayyn/protoc-gen-ts/actions/workflows/test.yaml)\r\n![npm](https://img.shields.io/npm/v/protoc-gen-ts)\r\n![npm](https://img.shields.io/npm/dm/protoc-gen-ts)\r\n\r\nThis repository is forked from [thesayyn/protoc-gen-ts](https://github.com/thesayyn/protoc-gen-ts)\r\n\r\n---\r\n\r\nAim of this protoc plugin is to make usage of protocol buffers easy in Javascript/Typescript by taking modern approaches.  This plugin generates plain **Typescript** files that can be used AMD, UMD, CommonJS module systems.\r\n\r\n\r\n## Example\r\n\r\n```proto\r\nsyntax = \"proto3\";\r\n\r\nmessage Author {\r\n    string name = 1;\r\n    string role = 2;\r\n}\r\n\r\nmessage Change {\r\n    Kind kind = 1;\r\n    string patch = 2;\r\n    repeated string tags = 3; \r\n    oneof name_or_id {\r\n        string name = 4;\r\n        string id = 5;\r\n    }\r\n    Author author = 6;\r\n}\r\n\r\nenum Kind {\r\n    UPDATED = 0;\r\n    DELETED = 1;\r\n}\r\n```\r\n\r\n\r\n```typescript\r\n// Constructed message\r\nconst change = new Change({\r\n    kind: Kind.UPDATED,\r\n    patch: \"@@ -7,11 +7,15 @@\",\r\n    tags: [\"no prefix\", \"as is\"],\r\n    name: \"patch for typescript 4.5\",\r\n    author: new Author({\r\n        name: \"mary poppins\",\r\n        role: \"maintainer\"\r\n    })\r\n});\r\n\r\n// Sent over the wire\r\nconst bytes: Uint8Array = change.serialize();\r\n\r\nconst receivedChange: Change = Change.deserialize(bytes);\r\n\r\nconsole.log(receivedChange.kind == Kind.UPDATED) // true\r\nconsole.log(receivedChange.patch) // \"@@ -7,11 +7,15 @@\"\r\nconsole.log(receivedChange.tags) // [\"no prefix\", \"as is\"]\r\nconsole.log(receivedChange.name) // \"patch for typescript 4.5\"\r\n// see which one of the fields were filled\r\nconsole.log(receivedChange.name_or_id) // \"name\"\r\nconsole.log(receivedChange.author.name) // \"mary poppins\"\r\n```\r\n\r\n## Support for Message.fromObject and Message.toObject\r\n\r\nWhen mapping raw json data to message classes, dealing with nested structures can be rather annoying.\r\nTo overcome this problem, every generated message class has a static method called `fromObject` and `toObject` \r\nwhich can handle the mapping bidirectionally for you, even with the deeply structured messages. since it is \r\naware of the field graph, it does not rely on any runtime type information thus we get the chance to keep it fast.\r\n\r\nOne can write code as;\r\n\r\n```typescript\r\nconst change = Change.fromObject({\r\n    kind: Kind.UPDATED,\r\n    patch: \"@@ -7,11 +7,15 @@\",\r\n    tags: [\"no prefix\", \"as is\"],\r\n    name: \"patch for typescript 4.5\",\r\n    author: {\r\n        name: \"mary poppins\",\r\n        role: \"maintainer\"\r\n    }\r\n});\r\n\r\nconsole.log(change.author instanceof Author) // true\r\n```\r\n\r\n\r\n## Usage with `@grpc/grpc-js` or `grpc`\r\n\r\nThere is a seperate documentation for the usage of protoc-gen-ts along with either `@grpc/grpc-js` or `grpc`.  By default\r\nthis generated gRPC interfaces will use `@grpc/grpc-js`.\r\n\r\nCheckout [rpcs](docs/rpc.md).\r\n\r\n## Key Differences\r\n\r\nThis protoc plugin does generate;\r\n\r\n- Fields as **getter** **setters**.\r\n- No such prefixes as \"getField\" or \"getFieldList\". If you have repeated field named `users`, then the generated message class will have a `getter` named `users` not `getUsersList` \r\n- Enums as **enums**.\r\n- Messages within a **namespace** if the proto has a **package** directive.\r\n\r\n\r\n## Usage\r\n\r\n### Without Bazel\r\n```properties\r\nnpm install -g protoc-gen-ts\r\n\r\nprotoc -I=sourcedir --ts_out=dist myproto.proto\r\n```\r\n### With Bazel\r\n```py\r\n# Add protoc-gen-ts to dependencies section of your package.json file.\r\n# Then use it like you would use the other bazel compatible npm packages.\r\n\r\nload(\"@npm//protoc-gen-ts//:index.bzl\", \"ts_proto_library\")\r\n\r\nts_proto_library(\r\n    name = \"protos\",\r\n    deps = [\r\n        \":some_proto_library_target\"\r\n    ]\r\n)\r\n\r\n# Checkout the examples/bazel directory for an example.\r\n```\r\n\r\n## Supported Options\r\n\r\n* With `--ts_opt=unary_rpc_promise=true`, the service definition will contain a promise based rpc with a calling pattern of `const result = await client.METHOD(message)`.  Note: all othe `metadata` and `options` parameters are still available to you.\r\n\r\n* With `--ts_opt=grpc_package=xxxx`, you can specify a different package to import rather than `@grpc/grpc-js`.\r\n\r\n## Roadmap\r\n\r\n- <s>Support for repeated non-integer fields</s>\r\n- <s>Generate appropriate service code that is usable with node **grpc** package.</s>\r\n- <s>Support for creating protocol buffer messages directly from their constructors with an object.</s>\r\n- <s>Support for `import` directive.</s>\r\n- <s>Support for `Promise` in rpcs.</s>\r\n- <s>Make services strongly typed.</s>\r\n- <s>Support oneof fields</s>\r\n- <s>Support `map<TYPE, TYPE>` types as ES `Map`.</s>\r\n- Support grpc-web without any manual intervention.\r\n- Interopability with well knowns.\r\n\r\n\r\n## Alternatives\r\n\r\n| Plugin | google-protobuf | Typescript | Declarations | gRPC Node | gRPC Web | ES6 Support | Notes |\r\n|------------------------------|-----------------|:----------:|:------------:|:---------:|:--------:|:-----------:|:-----------------------------------------------------------------------------------------------------------------------------------:|\r\n| thesayyn/protoc-gen-ts | Yes | Yes | Yes | Yes | Partial | Yes | The generated messages are compatible with ever-green browsers.<br>However, you might need to use third-party packages to use rpcs. |\r\n| improbable-eng/ts-protoc-gen | Yes | No | Yes | No | Yes | Partial | Drawback: You can't bundle generated files with rollup since<br>they are not >= ES6 compatible. |\r\n| stephenh/ts-proto | No | Yes | Yes | No | No | Yes | There is no support for rpcs.<br>See: https://github.com/stephenh/ts-proto/issues/2 |\r\n\r\n\r\n## Development\r\n\r\nGenerates appropriate Protocol Buffer sources from Proto files directly through _TypeScript Compiler API_.\r\n\r\n```sh\r\n# to run test invoke\r\nyarn test\r\n# additionally if you want to see error details\r\nyarn test --test_output=errors\r\n\r\n```\r\n\r\n## Contributors\r\n\r\n![GitHub Contributors Image](https://contrib.rocks/image?repo=thesayyn/protoc-gen-ts)\r\n\r\n\r\n## Support\r\n\r\nIf you find this plugin useful please consider giving us a star to get into open collective.\r\n\r\nYou can also support me directly by buying us some coffees.\r\n\r\n<a href=\"https://www.buymeacoffee.com/thesayyn\">\r\n<img height=\"40px\" src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=🙌&slug=thesayyn&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff\">\r\n</a>\r\n","readmeFilename":"README.md"}