0.1.19 • Published 5 years ago

tsbuf-nestjs v0.1.19

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

tsbuf npm@version Build Status Coverage Status

Generate TypeScript enum and interface with proto buffer.

Usage

npm install -g tsbuf
tsbuf example/proto -o example/typescript/global
# or
tsbuf example/proto -o example/typescript/module -m module

See example/

$ tsbuf -h
Usage: tsbuf [options] <inputPath>

protobuf-parser
Generate TypeScript interface with Protobuf.

Options:
  -V, --version          output the version number
  -o, --output <output>  output path (default: ".")
  -m, --mode <mode>      "global": Global Definition, "module": Module Definition (default: "global")
  -h, --help             output usage information

Example

syntax = "proto3";

service MyService {
  rpc rpcMethod(Fruit) returns (Package) {}
}

enum Fruit {
  Apple = 0;
  Banana = 1;
}

message Package {
  string id = 1;
  float price = 2;
}

Will be transformed to

interface MyService {
  rpcMethod: {
    request: Request;
    response: Response;
  };
}

declare enum Fruit {
  Apple = 0,
  Banana = 1,
}

interface Package {
  id: string;
  price: number;
}

Or TypeScript module

export interface MyService {
  rpcMethod: {
    request: Request;
    response: Response;
  };
}

export enum Fruit {
  Apple = 0,
  Banana = 1,
}

export interface Package {
  id: string;
  price: number;
}

Roadmap

  • Basic Support
  • ExtendedType Field
  • Cli
  • Oneof Field
  • Map Field
  • Nested Type
  • Generate Global Declaration
  • Import (Generate Module)
  • Other Options

License

MIT

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago