@hibas123/jrpcgen (1.2.14)
Published 2023-10-12 20:47:24 +00:00 by hibas123
Installation
@hibas123:registry=
npm install @hibas123/jrpcgen@1.2.14
"@hibas123/jrpcgen": "1.2.14"
About this package
JSON-RPC 2.0 Code-Gen
Type/Service definition language and code generator for json-rpc 2.0. Currently generating code for NodeJS, Deno and the Web. Other targets are possible, but not implemented yet.
Name | Description |
---|---|
ts-node | Typescript for NodeJS |
ts-esm | Typescript in ESM format for Deno |
rust | Rust |
dart | Dart |
c# | C# |
Usage
Create a definition file like test.jrpc
:
enum TestEnum {
VAL1,
VAL2,
VAL10 = 10,
VAL11,
VAL12
}
type Test {
testen: TestEnum;
someString: string;
someNumber?: number;
array: string[];
map: {number, TestEnum};
}
service TestService {
@Description("This Function adds two number")
@Param("v1", "The first Number")
@Param("v2", "The second Number")
@Returns("The added values of the two numbers")
AddNumbers(v1: number, v2: number): number;
notification SendTest(test: Test);
}
Then run the generator like this jrpc compile test.jrpc -o=ts-node:output/
.
This will generate the Client and Server code in the specified folder.
TODOS
- Documentation
- Null Checks/Enforcements in all languages
- More and better tests
Dependencies
Dependencies
ID | Version |
---|---|
fs-extra | ^10.0.0 |
Development Dependencies
ID | Version |
---|---|
@types/debug | ^4.1.7 |
@types/fs-extra | ^9.0.13 |
@types/node | ^17.0.5 |
@types/prettier | ^2.4.2 |
@types/yargs | ^17.0.8 |
chalk | 4 |
debug | ^4.3.3 |
esbuild | ^0.14.10 |
prettier | ^2.5.1 |
ts-node | ^10.4.0 |
typescript | ^4.5.4 |
yargs | ^17.3.1 |