@hibas123/jrpcgen (1.0.2)
Published 2023-10-12 20:46:21 +00:00 by hibas123
Installation
@hibas123:registry=
npm install @hibas123/jrpcgen@1.0.2
"@hibas123/jrpcgen": "1.0.2"
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 |
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 {
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.
//TODO: Make Documentation better
Dependencies
Development Dependencies
ID | Version |
---|---|
@types/debug | ^4.1.7 |
@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 |