Socket
Socket
Sign inDemoInstall

cyfs-objs-generator

Package Overview
Dependencies
58
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cyfs-objs-generator

Implement the conversion of .proto files into custom object typescript files quickly.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

cyfs-objs-generator

You can use this tool to implement the conversion of .proto files into custom object typescript files quickly.

Installation

Currently, the supported .proto Types are: double, float, int32, int64, uint32, uint64, bool, string, bytes and enum. Nested definitions are not supported.

Note

Every .proto file should contain a NoneObject, As follows:

message NoneObject {
}

Command

  1. Convert a .proto file into several custom object typescript files.
cyfs-objs-generator -i ./obj_proto.proto -o ./test_out
  1. To retrieve the tool version.
cyfs-objs-generator --version
  1. For helps.
cyfs-objs-generator --help

Usage

Use protoc to compile .proto files into XX_pb.js and XX_pb.d.ts. It is recommended to use cyfs-dapp-cli to create template projects. The project project already contains protoc programs and quick generation commands. Then, You can use this tool to generate objects .ts files.

Reference .proto

syntax = "proto3";

enum ArticleType {
	NEWS = 0;
	ENTERTAINMENT = 1;
	HEALTHY = 2;
	HISTORY = 3;
}

message Article {
	ArticleType type = 1;
	string title = 2;
	string content = 3;
	bytes authorId = 4;
	float rewardAmount = 5;
	bool isPassed = 6;
	uint64 timestamp = 7;
}

message NoneObject {
}

Keywords

FAQs

Last updated on 20 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc