waveterm/src/types.ts

232 lines
4.6 KiB
TypeScript
Raw Normal View History

2022-07-09 10:37:19 +02:00
import * as mobx from "mobx";
type SessionDataType = {
sessionid : string,
name : string,
notifynum : number,
2022-07-13 08:29:39 +02:00
activescreenid : string,
sessionidx : number,
2022-07-13 08:29:39 +02:00
screens : ScreenDataType[],
2022-08-11 20:49:46 +02:00
remotes : RemoteInstanceType[],
// for updates
remove? : boolean,
full? : boolean,
2022-07-09 10:37:19 +02:00
};
type LineType = {
sessionid : string,
windowid : string,
lineid : string,
2022-07-09 10:37:19 +02:00
ts : number,
userid : string,
linetype : string,
text : string,
cmdid : string,
2022-08-23 22:14:57 +02:00
ephemeral? : boolean,
2022-08-11 20:49:46 +02:00
remove? : boolean,
2022-07-09 10:37:19 +02:00
};
2022-07-13 08:29:39 +02:00
type ScreenOptsType = {
tabcolor? : string,
}
type ScreenDataType = {
sessionid : string,
screenid : string,
screenidx : number,
activewindowid : string,
name : string,
windows : ScreenWindowType[],
screenopts : ScreenOptsType,
// for updates
remove? : boolean,
full? : boolean,
2022-07-13 08:29:39 +02:00
};
type LayoutType = {
type : string,
parent? : string,
zindex? : number,
float? : boolean,
top? : string,
bottom? : string,
left? : string,
right? : string,
width? : string,
height? : string,
};
type ScreenWindowType = {
sessionid : string,
screenid : string,
windowid : string,
name : string,
layout : LayoutType,
// for updates
remove? : boolean,
2022-07-13 08:29:39 +02:00
};
2022-07-09 10:37:19 +02:00
type RemoteType = {
remotetype : string,
remoteid : string,
physicalid : string,
remotealias : string,
remotecanonicalname : string,
2022-07-09 10:37:19 +02:00
remotevars : Record<string, string>,
status : string,
defaultstate : RemoteStateType,
2022-08-21 21:26:10 +02:00
connectmode : string,
2022-07-09 10:37:19 +02:00
};
type RemoteStateType = {
cwd : string,
2022-08-23 01:28:14 +02:00
env0 : string, // in base64 "env -0" form
2022-07-09 10:37:19 +02:00
};
type RemoteInstanceType = {
riid : string,
name : string,
sessionid : string,
windowid : string,
remoteid : string,
sessionscope : boolean,
state : RemoteStateType,
remove? : boolean,
2022-07-09 10:37:19 +02:00
}
type WindowDataType = {
sessionid : string,
windowid : string,
curremote : string,
lines : LineType[],
2022-07-12 02:55:03 +02:00
cmds : CmdDataType[],
remotes : RemoteInstanceType[],
// for updates
remove? : boolean,
2022-07-09 10:37:19 +02:00
};
type HistoryItem = {
2022-08-12 08:46:52 +02:00
historyid : string,
ts : number,
userid : string,
sessionid : string,
screenid : string,
windowid : string,
lineid : string,
2022-08-12 08:46:52 +02:00
haderror : boolean,
cmdid : string,
2022-07-12 02:55:03 +02:00
cmdstr : string,
2022-08-12 08:46:52 +02:00
remove : boolean,
2022-07-09 10:37:19 +02:00
};
type CmdRemoteStateType = {
remoteid : string
remotename : string,
cwd : string,
};
type FeCmdPacketType = {
type : string,
2022-07-16 02:38:58 +02:00
metacmd : string,
metasubcmd? : string,
args : string[],
kwargs : Record<string, string>;
2022-07-13 23:16:47 +02:00
};
type WatchScreenPacketType = {
type : string,
sessionid : string,
screenid : string,
};
2022-07-09 10:37:19 +02:00
type TermOptsType = {
rows : number,
cols : number,
2022-07-13 08:29:39 +02:00
flexrows? : boolean,
maxptysize? : number,
2022-07-09 10:37:19 +02:00
};
type CmdStartPacketType = {
type : string,
respid : string,
ts : number,
ck : string,
pid : number,
mshellpid : number,
};
type CmdDonePacketType = {
type : string,
ts : number,
ck : string,
exitcode : number,
durationms : number,
};
type CmdDataType = {
sessionid : string,
cmdid : string,
remoteid : string,
cmdstr : string,
remotestate : RemoteStateType,
termopts : TermOptsType,
status : string,
startpk : CmdStartPacketType,
donepk : CmdDonePacketType,
runout : any[],
2022-07-11 23:43:18 +02:00
usedrows : number,
remove? : boolean,
2022-07-09 10:37:19 +02:00
};
2022-07-13 23:16:47 +02:00
type PtyDataUpdateType = {
sessionid : string,
cmdid : string,
ptypos : number,
ptydata64 : string,
ptydatalen : number,
};
type SessionUpdateType = {
2022-07-16 02:48:25 +02:00
sessions : SessionDataType[],
2022-08-11 20:49:46 +02:00
activesessionid? : string,
};
2022-07-16 02:48:25 +02:00
type LineCmdUpdateType = {
line : LineType,
cmd : CmdDataType,
remove : boolean,
2022-08-11 20:49:46 +02:00
};
type CmdLineUpdateType = {
insertchars : string,
insertpos : number,
};
type InfoUpdateType = {
cmdline : CmdLineUpdateType,
info : InfoType,
};
2022-07-16 02:48:25 +02:00
2022-08-11 20:49:46 +02:00
type UpdateMessage = PtyDataUpdateType | SessionUpdateType | LineCmdUpdateType | InfoUpdateType;
2022-07-16 02:38:58 +02:00
type WindowUpdateType = {
window: WindowDataType,
}
2022-08-11 20:49:46 +02:00
type InfoType = {
infotitle? : string,
infomsg? : string,
infoerror? : string,
2022-08-23 03:54:01 +02:00
infolines? : string[],
2022-08-11 20:49:46 +02:00
infocomps? : string[],
infocompsmore? : boolean,
timeoutms? : number,
};
export type {SessionDataType, LineType, RemoteType, RemoteStateType, RemoteInstanceType, WindowDataType, HistoryItem, CmdRemoteStateType, FeCmdPacketType, TermOptsType, CmdStartPacketType, CmdDonePacketType, CmdDataType, ScreenDataType, ScreenOptsType, ScreenWindowType, LayoutType, PtyDataUpdateType, SessionUpdateType, WindowUpdateType, UpdateMessage, LineCmdUpdateType, InfoType, CmdLineUpdateType};