new protocols

This commit is contained in:
k8w 2022-04-19 16:05:40 +08:00
parent 238ebb9857
commit e197b2842a
20 changed files with 803 additions and 1729 deletions

View File

@ -5,6 +5,8 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "tsrpc-cli dev", "dev": "tsrpc-cli dev",
"dev:hall": "tsrpc-cli dev --entry src/hallServer.ts",
"dev:room": "tsrpc-cli dev --entry src/roomServer.ts",
"build": "tsrpc-cli build", "build": "tsrpc-cli build",
"doc": "tsrpc-cli doc", "doc": "tsrpc-cli doc",
"test": "mocha test/**/*.test.ts", "test": "mocha test/**/*.test.ts",
@ -24,4 +26,4 @@
"dependencies": { "dependencies": {
"tsrpc": "^3.3.0" "tsrpc": "^3.3.0"
} }
} }

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqRegister, ResRegister } from "../../shared/protocols/hallServer/admin/PtlRegisterRoomServer";
export async function ApiRegister(call: ApiCall<ReqRegister, ResRegister>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqCreateRoom, ResCreateRoom } from "../../../shared/protocols/hallServer-roomManager/roomServer/PtlCreateRoom";
export async function ApiCreateRoom(call: ApiCall<ReqCreateRoom, ResCreateRoom>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqPreJoinRoom, ResPreJoinRoom } from "../../../shared/protocols/hallServer-roomManager/roomServer/PtlPreJoinRoom";
export async function ApiPreJoinRoom(call: ApiCall<ReqPreJoinRoom, ResPreJoinRoom>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqCreateRoom, ResCreateRoom } from "../../shared/protocols/hallServer/PtlCreateRoom";
export async function ApiCreateRoom(call: ApiCall<ReqCreateRoom, ResCreateRoom>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqListRooms, ResListRooms } from "../../shared/protocols/hallServer/PtlListRooms";
export async function ApiListRooms(call: ApiCall<ReqListRooms, ResListRooms>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqStartMatch, ResStartMatch } from "../../shared/protocols/hallServer/PtlStartMatch";
export async function ApiStartMatch(call: ApiCall<ReqStartMatch, ResStartMatch>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqExitRoom, ResExitRoom } from "../../shared/protocols/roomServer/PtlExitRoom";
export async function ApiExitRoom(call: ApiCall<ReqExitRoom, ResExitRoom>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqJoinRoom, ResJoinRoom } from "../../shared/protocols/roomServer/PtlJoinRoom";
export async function ApiJoinRoom(call: ApiCall<ReqJoinRoom, ResJoinRoom>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -1,7 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqUpdateRoomInfo, ResUpdateRoomInfo } from "../../shared/protocols/roomServer/PtlUpdateRoom";
export async function ApiUpdateRoomInfo(call: ApiCall<ReqUpdateRoomInfo, ResUpdateRoomInfo>) {
// TODO
call.error('API Not Implemented');
}

View File

@ -0,0 +1,188 @@
import { ServiceProto } from 'tsrpc-proto';
import { ReqRegisterRoomServer, ResRegisterRoomServer } from '../shared/protocols/hallServer/admin/PtlRegisterRoomServer';
import { ReqCreateRoom, ResCreateRoom } from '../shared/protocols/hallServer/PtlCreateRoom';
import { ReqListRooms, ResListRooms } from '../shared/protocols/hallServer/PtlListRooms';
import { ReqLogin, ResLogin } from '../shared/protocols/hallServer/PtlLogin';
import { ReqStartMatch, ResStartMatch } from '../shared/protocols/hallServer/PtlStartMatch';
export interface ServiceType {
api: {
"admin/RegisterRoomServer": {
req: ReqRegisterRoomServer,
res: ResRegisterRoomServer
},
"CreateRoom": {
req: ReqCreateRoom,
res: ResCreateRoom
},
"ListRooms": {
req: ReqListRooms,
res: ResListRooms
},
"Login": {
req: ReqLogin,
res: ResLogin
},
"StartMatch": {
req: ReqStartMatch,
res: ResStartMatch
}
},
msg: {
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"services": [
{
"id": 0,
"name": "admin/RegisterRoomServer",
"type": "api",
"conf": {}
},
{
"id": 1,
"name": "CreateRoom",
"type": "api",
"conf": {}
},
{
"id": 2,
"name": "ListRooms",
"type": "api",
"conf": {}
},
{
"id": 3,
"name": "Login",
"type": "api"
},
{
"id": 4,
"name": "StartMatch",
"type": "api",
"conf": {}
}
],
"types": {
"admin/PtlRegisterRoomServer/ReqRegisterRoomServer": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"../base/BaseRequest": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "sso",
"type": {
"type": "String"
},
"optional": true
}
]
},
"admin/PtlRegisterRoomServer/ResRegisterRoomServer": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"../base/BaseResponse": {
"type": "Interface"
},
"PtlCreateRoom/ReqCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlCreateRoom/ResCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlListRooms/ReqListRooms": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlListRooms/ResListRooms": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlLogin/ReqLogin": {
"type": "Interface"
},
"PtlLogin/ResLogin": {
"type": "Interface"
},
"PtlStartMatch/ReqStartMatch": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlStartMatch/ResStartMatch": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
}
}
};

View File

@ -0,0 +1,252 @@
import { ServiceProto } from 'tsrpc-proto';
import { MsgUpdateRoomState } from '../shared/protocols/roomServer/admin/MsgUpdateRoomState';
import { ReqAuth, ResAuth } from '../shared/protocols/roomServer/admin/PtlAuth';
import { ReqCreateRoom, ResCreateRoom } from '../shared/protocols/roomServer/admin/PtlCreateRoom';
import { ReqPreJoinRoom, ResPreJoinRoom } from '../shared/protocols/roomServer/admin/PtlPreJoinRoom';
import { ReqExitRoom, ResExitRoom } from '../shared/protocols/roomServer/PtlExitRoom';
import { ReqJoinRoom, ResJoinRoom } from '../shared/protocols/roomServer/PtlJoinRoom';
import { ReqUpdateRoom, ResUpdateRoom } from '../shared/protocols/roomServer/PtlUpdateRoom';
import { MsgChat } from '../shared/protocols/roomServer/roomMsg/MsgChat';
import { MsgUpdateRoomInfo } from '../shared/protocols/roomServer/roomMsg/MsgUpdateRoomInfo';
export interface ServiceType {
api: {
"admin/Auth": {
req: ReqAuth,
res: ResAuth
},
"admin/CreateRoom": {
req: ReqCreateRoom,
res: ResCreateRoom
},
"admin/PreJoinRoom": {
req: ReqPreJoinRoom,
res: ResPreJoinRoom
},
"ExitRoom": {
req: ReqExitRoom,
res: ResExitRoom
},
"JoinRoom": {
req: ReqJoinRoom,
res: ResJoinRoom
},
"UpdateRoom": {
req: ReqUpdateRoom,
res: ResUpdateRoom
}
},
msg: {
"admin/UpdateRoomState": MsgUpdateRoomState,
"roomMsg/Chat": MsgChat,
"roomMsg/UpdateRoomInfo": MsgUpdateRoomInfo
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"services": [
{
"id": 0,
"name": "admin/UpdateRoomState",
"type": "msg"
},
{
"id": 1,
"name": "admin/Auth",
"type": "api"
},
{
"id": 2,
"name": "admin/CreateRoom",
"type": "api",
"conf": {}
},
{
"id": 3,
"name": "admin/PreJoinRoom",
"type": "api",
"conf": {}
},
{
"id": 4,
"name": "ExitRoom",
"type": "api",
"conf": {}
},
{
"id": 5,
"name": "JoinRoom",
"type": "api",
"conf": {}
},
{
"id": 6,
"name": "UpdateRoom",
"type": "api",
"conf": {}
},
{
"id": 7,
"name": "roomMsg/Chat",
"type": "msg"
},
{
"id": 8,
"name": "roomMsg/UpdateRoomInfo",
"type": "msg"
}
],
"types": {
"admin/MsgUpdateRoomState/MsgUpdateRoomState": {
"type": "Interface"
},
"admin/PtlAuth/ReqAuth": {
"type": "Interface"
},
"admin/PtlAuth/ResAuth": {
"type": "Interface"
},
"admin/PtlCreateRoom/ReqCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"../base/BaseRequest": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "sso",
"type": {
"type": "String"
},
"optional": true
}
]
},
"admin/PtlCreateRoom/ResCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"../base/BaseResponse": {
"type": "Interface"
},
"admin/PtlPreJoinRoom/ReqPreJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"admin/PtlPreJoinRoom/ResPreJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlExitRoom/ReqExitRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlExitRoom/ResExitRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlJoinRoom/ReqJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlJoinRoom/ResJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlUpdateRoom/ReqUpdateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlUpdateRoom/ResUpdateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"roomMsg/MsgChat/MsgChat": {
"type": "Interface"
},
"roomMsg/MsgUpdateRoomInfo/MsgUpdateRoomInfo": {
"type": "Interface"
}
}
};

View File

@ -8,7 +8,11 @@ export interface BaseResponse {
} }
export interface BaseConf { export interface BaseConf {
/**
*
* @defaultValue false
*/
allowGuest?: boolean
} }
export interface BaseMessage { export interface BaseMessage {

View File

@ -0,0 +1,9 @@
export interface ReqLogin {
}
export interface ResLogin {
}
// export const conf = {}

View File

@ -0,0 +1,9 @@
export interface ReqAuth {
}
export interface ResAuth {
}
// export const conf = {}

View File

@ -1,376 +0,0 @@
import { ServiceProto } from 'tsrpc-proto';
import { ReqRegister, ResRegister } from './hallServer/admin/PtlRegisterRoomServer';
import { MsgUpdateRoomState } from './roomServer/admin/MsgUpdateRoomState';
import { ReqCreateRoom, ResCreateRoom } from './hallServer-roomManager/roomServer/PtlCreateRoom';
import { ReqPreJoinRoom, ResPreJoinRoom } from './hallServer-roomManager/roomServer/PtlPreJoinRoom';
import { ReqCreateRoom as ReqCreateRoom_1, ResCreateRoom as ResCreateRoom_1 } from './hallServer/PtlCreateRoom';
import { ReqListRooms, ResListRooms } from './hallServer/PtlListRooms';
import { ReqStartMatch, ResStartMatch } from './hallServer/PtlStartMatch';
import { ReqExitRoom, ResExitRoom } from './roomServer/PtlExitRoom';
import { ReqJoinRoom, ResJoinRoom } from './roomServer/PtlJoinRoom';
import { ReqUpdateRoomInfo, ResUpdateRoomInfo } from './roomServer/PtlUpdateRoom';
import { MsgChat } from './roomServer/roomMsg/MsgChat';
import { MsgUpdateRoomInfo } from './roomServer/roomMsg/MsgUpdateRoomInfo';
export interface ServiceType {
api: {
"hallServer-roomManager/Register": {
req: ReqRegister,
res: ResRegister
},
"hallServer-roomManager/roomServer/CreateRoom": {
req: ReqCreateRoom,
res: ResCreateRoom
},
"hallServer-roomManager/roomServer/PreJoinRoom": {
req: ReqPreJoinRoom,
res: ResPreJoinRoom
},
"hallServer/CreateRoom": {
req: ReqCreateRoom_1,
res: ResCreateRoom_1
},
"hallServer/ListRooms": {
req: ReqListRooms,
res: ResListRooms
},
"hallServer/StartMatch": {
req: ReqStartMatch,
res: ResStartMatch
},
"roomServer/ExitRoom": {
req: ReqExitRoom,
res: ResExitRoom
},
"roomServer/JoinRoom": {
req: ReqJoinRoom,
res: ResJoinRoom
},
"roomServer/UpdateRoomInfo": {
req: ReqUpdateRoomInfo,
res: ResUpdateRoomInfo
}
},
msg: {
"hallServer-roomManager/roomServer/UpdateRoomState": MsgUpdateRoomState,
"roomServer/roomMsg/Chat": MsgChat,
"roomServer/roomMsg/UpdateRoomInfo": MsgUpdateRoomInfo
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"services": [
{
"id": 0,
"name": "hallServer-roomManager/Register",
"type": "api",
"conf": {}
},
{
"id": 1,
"name": "hallServer-roomManager/roomServer/UpdateRoomState",
"type": "msg"
},
{
"id": 2,
"name": "hallServer-roomManager/roomServer/CreateRoom",
"type": "api",
"conf": {}
},
{
"id": 3,
"name": "hallServer-roomManager/roomServer/PreJoinRoom",
"type": "api",
"conf": {}
},
{
"id": 4,
"name": "hallServer/CreateRoom",
"type": "api",
"conf": {}
},
{
"id": 5,
"name": "hallServer/ListRooms",
"type": "api",
"conf": {}
},
{
"id": 6,
"name": "hallServer/StartMatch",
"type": "api",
"conf": {}
},
{
"id": 7,
"name": "roomServer/ExitRoom",
"type": "api",
"conf": {}
},
{
"id": 8,
"name": "roomServer/JoinRoom",
"type": "api",
"conf": {}
},
{
"id": 9,
"name": "roomServer/UpdateRoomInfo",
"type": "api",
"conf": {}
},
{
"id": 10,
"name": "roomServer/roomMsg/Chat",
"type": "msg"
},
{
"id": 11,
"name": "roomServer/roomMsg/UpdateRoomInfo",
"type": "msg"
}
],
"types": {
"hallServer-roomManager/PtlRegister/ReqRegister": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"base/BaseRequest": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "sso",
"type": {
"type": "String"
},
"optional": true
}
]
},
"hallServer-roomManager/PtlRegister/ResRegister": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"base/BaseResponse": {
"type": "Interface"
},
"hallServer-roomManager/roomServer/MsgUpdateRoomState/MsgUpdateRoomState": {
"type": "Interface"
},
"hallServer-roomManager/roomServer/PtlCreateRoom/ReqCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"hallServer-roomManager/roomServer/PtlCreateRoom/ResCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"hallServer-roomManager/roomServer/PtlPreJoinRoom/ReqPreJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"hallServer-roomManager/roomServer/PtlPreJoinRoom/ResPreJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"hallServer/PtlCreateRoom/ReqCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"hallServer/PtlCreateRoom/ResCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"hallServer/PtlListRooms/ReqListRooms": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"hallServer/PtlListRooms/ResListRooms": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"hallServer/PtlStartMatch/ReqStartMatch": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"hallServer/PtlStartMatch/ResStartMatch": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"roomServer/PtlExitRoom/ReqExitRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"roomServer/PtlExitRoom/ResExitRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"roomServer/PtlJoinRoom/ReqJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"roomServer/PtlJoinRoom/ResJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"roomServer/PtlUpdateRoomInfo/ReqUpdateRoomInfo": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseRequest"
}
}
]
},
"roomServer/PtlUpdateRoomInfo/ResUpdateRoomInfo": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "base/BaseResponse"
}
}
]
},
"roomServer/roomMsg/MsgChat/MsgChat": {
"type": "Interface"
},
"roomServer/roomMsg/MsgUpdateRoomInfo/MsgUpdateRoomInfo": {
"type": "Interface"
}
}
};

View File

@ -0,0 +1,154 @@
import { ServiceProto } from 'tsrpc-proto';
import { ReqCreateRoom, ResCreateRoom } from './hallServer/PtlCreateRoom';
import { ReqListRooms, ResListRooms } from './hallServer/PtlListRooms';
import { ReqLogin, ResLogin } from './hallServer/PtlLogin';
import { ReqStartMatch, ResStartMatch } from './hallServer/PtlStartMatch';
export interface ServiceType {
api: {
"CreateRoom": {
req: ReqCreateRoom,
res: ResCreateRoom
},
"ListRooms": {
req: ReqListRooms,
res: ResListRooms
},
"Login": {
req: ReqLogin,
res: ResLogin
},
"StartMatch": {
req: ReqStartMatch,
res: ResStartMatch
}
},
msg: {
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"version": 1,
"services": [
{
"id": 1,
"name": "CreateRoom",
"type": "api",
"conf": {}
},
{
"id": 2,
"name": "ListRooms",
"type": "api",
"conf": {}
},
{
"id": 3,
"name": "Login",
"type": "api"
},
{
"id": 4,
"name": "StartMatch",
"type": "api",
"conf": {}
}
],
"types": {
"PtlCreateRoom/ReqCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"../base/BaseRequest": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "sso",
"type": {
"type": "String"
},
"optional": true
}
]
},
"PtlCreateRoom/ResCreateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"../base/BaseResponse": {
"type": "Interface"
},
"PtlListRooms/ReqListRooms": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlListRooms/ResListRooms": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlLogin/ReqLogin": {
"type": "Interface"
},
"PtlLogin/ResLogin": {
"type": "Interface"
},
"PtlStartMatch/ReqStartMatch": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlStartMatch/ResStartMatch": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
}
}
};

View File

@ -0,0 +1,157 @@
import { ServiceProto } from 'tsrpc-proto';
import { ReqExitRoom, ResExitRoom } from './roomServer/PtlExitRoom';
import { ReqJoinRoom, ResJoinRoom } from './roomServer/PtlJoinRoom';
import { ReqUpdateRoom, ResUpdateRoom } from './roomServer/PtlUpdateRoom';
import { MsgChat } from './roomServer/roomMsg/MsgChat';
import { MsgUpdateRoomInfo } from './roomServer/roomMsg/MsgUpdateRoomInfo';
export interface ServiceType {
api: {
"ExitRoom": {
req: ReqExitRoom,
res: ResExitRoom
},
"JoinRoom": {
req: ReqJoinRoom,
res: ResJoinRoom
},
"UpdateRoom": {
req: ReqUpdateRoom,
res: ResUpdateRoom
}
},
msg: {
"roomMsg/Chat": MsgChat,
"roomMsg/UpdateRoomInfo": MsgUpdateRoomInfo
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"version": 1,
"services": [
{
"id": 4,
"name": "ExitRoom",
"type": "api",
"conf": {}
},
{
"id": 5,
"name": "JoinRoom",
"type": "api",
"conf": {}
},
{
"id": 6,
"name": "UpdateRoom",
"type": "api",
"conf": {}
},
{
"id": 7,
"name": "roomMsg/Chat",
"type": "msg"
},
{
"id": 8,
"name": "roomMsg/UpdateRoomInfo",
"type": "msg"
}
],
"types": {
"PtlExitRoom/ReqExitRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"../base/BaseRequest": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "sso",
"type": {
"type": "String"
},
"optional": true
}
]
},
"PtlExitRoom/ResExitRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"../base/BaseResponse": {
"type": "Interface"
},
"PtlJoinRoom/ReqJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlJoinRoom/ResJoinRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"PtlUpdateRoom/ReqUpdateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseRequest"
}
}
]
},
"PtlUpdateRoom/ResUpdateRoom": {
"type": "Interface",
"extends": [
{
"id": 0,
"type": {
"type": "Reference",
"target": "../base/BaseResponse"
}
}
]
},
"roomMsg/MsgChat/MsgChat": {
"type": "Interface"
},
"roomMsg/MsgUpdateRoomInfo/MsgUpdateRoomInfo": {
"type": "Interface"
}
}
};

View File

@ -3,14 +3,35 @@ import { CodeTemplate, TsrpcConfig } from 'tsrpc-cli';
const tsrpcConf: TsrpcConfig = { const tsrpcConf: TsrpcConfig = {
// Generate ServiceProto // Generate ServiceProto
proto: [ proto: [
// Proto for user
{ {
ptlDir: 'src/shared/protocols', // Protocol dir ptlDir: 'src/shared/protocols/hallServer', // Protocol dir
output: 'src/shared/protocols/serviceProto.ts', // Path for generated ServiceProto output: 'src/shared/protocols/serviceProto_hallServer.ts', // Path for generated ServiceProto
apiDir: 'src/api', // API dir ignore: 'src/shared/protocols/hallServer/admin/**' // User proto ignore admin
docDir: 'docs', // API documents dir },
{
ptlDir: 'src/shared/protocols/roomServer', // Protocol dir
output: 'src/shared/protocols/serviceProto_roomServer.ts', // Path for generated ServiceProto
ignore: 'src/shared/protocols/roomServer/admin/**' // User proto ignore admin
},
// Proto for server RPC
{
ptlDir: 'src/shared/protocols/hallServer', // Protocol dir
output: 'src/server_rpc/serviceProto_hallServer.ts', // Path for generated ServiceProto
apiDir: 'src/api/hallServer', // API dir
docDir: 'docs/hallServer', // API documents dir
ptlTemplate: CodeTemplate.getExtendedPtl(), ptlTemplate: CodeTemplate.getExtendedPtl(),
// msgTemplate: CodeTemplate.getExtendedMsg(), // msgTemplate: CodeTemplate.getExtendedMsg(),
} },
{
ptlDir: 'src/shared/protocols/roomServer', // Protocol dir
output: 'src/server_rpc/serviceProto_roomServer.ts', // Path for generated ServiceProto
apiDir: 'src/api/roomServer', // API dir
docDir: 'docs/roomServer', // API documents dir
ptlTemplate: CodeTemplate.getExtendedPtl(),
// msgTemplate: CodeTemplate.getExtendedMsg(),
},
], ],
// Sync shared code // Sync shared code
sync: [ sync: [

File diff suppressed because it is too large Load Diff