Implement fs module (#3)
* Implements the fs module * Add stats object * Add not implemented to createWriteStream * Update mkdtemp to use tmp dir * Unexport Stats * Add client web socket for commands and restructure
This commit is contained in:
@ -1,221 +0,0 @@
|
||||
import { ReadWriteConnection } from "../common/connection";
|
||||
import { NewEvalMessage, ServerMessage, EvalDoneMessage, EvalFailedMessage, TypedValue, ClientMessage, NewSessionMessage, TTYDimensions, SessionOutputMessage, CloseSessionInputMessage } from "../proto";
|
||||
import { Emitter } from "@coder/events";
|
||||
import { logger, field } from "@coder/logger";
|
||||
import { ChildProcess, SpawnOptions, ServerProcess } from "./command";
|
||||
|
||||
/**
|
||||
* Client accepts an arbitrary connection intended to communicate with the Server.
|
||||
*/
|
||||
export class Client {
|
||||
private evalId: number = 0;
|
||||
private evalDoneEmitter: Emitter<EvalDoneMessage> = new Emitter();
|
||||
private evalFailedEmitter: Emitter<EvalFailedMessage> = new Emitter();
|
||||
|
||||
private sessionId: number = 0;
|
||||
private sessions: Map<number, ServerProcess> = new Map();
|
||||
|
||||
/**
|
||||
* @param connection Established connection to the server
|
||||
*/
|
||||
public constructor(
|
||||
private readonly connection: ReadWriteConnection,
|
||||
) {
|
||||
connection.onMessage((data) => {
|
||||
try {
|
||||
this.handleMessage(ServerMessage.deserializeBinary(data));
|
||||
} catch (ex) {
|
||||
logger.error("Failed to handle server message", field("length", data.byteLength), field("exception", ex));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public evaluate<R>(func: () => R): Promise<R>;
|
||||
public evaluate<R, T1>(func: (a1: T1) => R, a1: T1): Promise<R>;
|
||||
public evaluate<R, T1, T2>(func: (a1: T1, a2: T2) => R, a1: T1, a2: T2): Promise<R>;
|
||||
public evaluate<R, T1, T2, T3>(func: (a1: T1, a2: T2, a3: T3) => R, a1: T1, a2: T2, a3: T3): Promise<R>;
|
||||
public evaluate<R, T1, T2, T3, T4>(func: (a1: T1, a2: T2, a3: T3, a4: T4) => R, a1: T1, a2: T2, a3: T3, a4: T4): Promise<R>;
|
||||
public evaluate<R, T1, T2, T3, T4, T5>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => R, a1: T1, a2: T2, a3: T3, a4: T4, a5: T5): Promise<R>;
|
||||
public evaluate<R, T1, T2, T3, T4, T5, T6>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => R, a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6): Promise<R>;
|
||||
/**
|
||||
* Evaluates a function on the server.
|
||||
* To pass variables, ensure they are serializable and passed through the included function.
|
||||
* @example
|
||||
* const returned = await this.client.evaluate((value) => {
|
||||
* return value;
|
||||
* }, "hi");
|
||||
* console.log(returned);
|
||||
* // output: "hi"
|
||||
* @param func Function to evaluate
|
||||
* @returns {Promise} Promise rejected or resolved from the evaluated function
|
||||
*/
|
||||
public evaluate<R, T1, T2, T3, T4, T5, T6>(func: (a1?: T1, a2?: T2, a3?: T3, a4?: T4, a5?: T5, a6?: T6) => R, a1?: T1, a2?: T2, a3?: T3, a4?: T4, a5?: T5, a6?: T6): Promise<R> {
|
||||
const newEval = new NewEvalMessage();
|
||||
const id = this.evalId++;
|
||||
newEval.setId(id);
|
||||
newEval.setArgsList([a1, a2, a3, a4, a5, a6].filter(a => a).map(a => JSON.stringify(a)));
|
||||
newEval.setFunction(func.toString());
|
||||
|
||||
const clientMsg = new ClientMessage();
|
||||
clientMsg.setNewEval(newEval);
|
||||
this.connection.send(clientMsg.serializeBinary());
|
||||
|
||||
let res: (value?: R) => void;
|
||||
let rej: (err?: any) => void;
|
||||
const prom = new Promise<R>((r, e) => {
|
||||
res = r;
|
||||
rej = e;
|
||||
});
|
||||
|
||||
const d1 = this.evalDoneEmitter.event((doneMsg) => {
|
||||
if (doneMsg.getId() === id) {
|
||||
d1.dispose();
|
||||
d2.dispose();
|
||||
|
||||
const resp = doneMsg.getResponse();
|
||||
if (!resp) {
|
||||
res();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const rt = resp.getType();
|
||||
let val: any;
|
||||
switch (rt) {
|
||||
case TypedValue.Type.BOOLEAN:
|
||||
val = resp.getValue() === "true";
|
||||
break;
|
||||
case TypedValue.Type.NUMBER:
|
||||
val = parseInt(resp.getValue(), 10);
|
||||
break;
|
||||
case TypedValue.Type.OBJECT:
|
||||
val = JSON.parse(resp.getValue());
|
||||
break;
|
||||
case TypedValue.Type.STRING:
|
||||
val = resp.getValue();
|
||||
break;
|
||||
default:
|
||||
throw new Error(`unsupported typed value ${rt}`);
|
||||
}
|
||||
|
||||
res(val);
|
||||
}
|
||||
});
|
||||
|
||||
const d2 = this.evalFailedEmitter.event((failedMsg) => {
|
||||
if (failedMsg.getId() === id) {
|
||||
d1.dispose();
|
||||
d2.dispose();
|
||||
|
||||
rej(failedMsg.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return prom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns a process from a command. _Somewhat_ reflects the "child_process" API.
|
||||
* @example
|
||||
* const cp = this.client.spawn("echo", ["test"]);
|
||||
* cp.stdout.on("data", (data) => console.log(data.toString()));
|
||||
* cp.on("exit", (code) => console.log("exited with", code));
|
||||
* @param command
|
||||
* @param args Arguments
|
||||
* @param options Options to execute for the command
|
||||
*/
|
||||
public spawn(command: string, args: string[] = [], options?: SpawnOptions): ChildProcess {
|
||||
return this.doSpawn(command, args, options, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fork a module.
|
||||
* @param modulePath Path of the module
|
||||
* @param args Args to add for the module
|
||||
* @param options Options to execute
|
||||
*/
|
||||
public fork(modulePath: string, args: string[] = [], options?: SpawnOptions): ChildProcess {
|
||||
return this.doSpawn(modulePath, args, options, true);
|
||||
}
|
||||
|
||||
private doSpawn(command: string, args: string[] = [], options?: SpawnOptions, isFork: boolean = false): ChildProcess {
|
||||
const id = this.sessionId++;
|
||||
const newSess = new NewSessionMessage();
|
||||
newSess.setId(id);
|
||||
newSess.setCommand(command);
|
||||
newSess.setArgsList(args);
|
||||
newSess.setIsFork(isFork);
|
||||
if (options) {
|
||||
if (options.cwd) {
|
||||
newSess.setCwd(options.cwd);
|
||||
}
|
||||
if (options.env) {
|
||||
Object.keys(options.env).forEach((envKey) => {
|
||||
newSess.getEnvMap().set(envKey, options.env![envKey]);
|
||||
});
|
||||
}
|
||||
if (options.tty) {
|
||||
const tty = new TTYDimensions();
|
||||
tty.setHeight(options.tty.rows);
|
||||
tty.setWidth(options.tty.columns);
|
||||
newSess.setTtyDimensions(tty);
|
||||
}
|
||||
}
|
||||
const clientMsg = new ClientMessage();
|
||||
clientMsg.setNewSession(newSess);
|
||||
this.connection.send(clientMsg.serializeBinary());
|
||||
|
||||
const serverProc = new ServerProcess(this.connection, id, options ? options.tty !== undefined : false);
|
||||
serverProc.stdin.on("close", () => {
|
||||
console.log("stdin closed");
|
||||
const c = new CloseSessionInputMessage();
|
||||
c.setId(id);
|
||||
const cm = new ClientMessage();
|
||||
cm.setCloseSessionInput(c);
|
||||
this.connection.send(cm.serializeBinary());
|
||||
});
|
||||
this.sessions.set(id, serverProc);
|
||||
return serverProc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a message from the server. All incoming server messages should be
|
||||
* routed through here.
|
||||
*/
|
||||
private handleMessage(message: ServerMessage): void {
|
||||
if (message.hasEvalDone()) {
|
||||
this.evalDoneEmitter.emit(message.getEvalDone()!);
|
||||
} else if (message.hasEvalFailed()) {
|
||||
this.evalFailedEmitter.emit(message.getEvalFailed()!);
|
||||
} else if (message.hasNewSessionFailure()) {
|
||||
const s = this.sessions.get(message.getNewSessionFailure()!.getId());
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
s.emit("error", new Error(message.getNewSessionFailure()!.getMessage()));
|
||||
this.sessions.delete(message.getNewSessionFailure()!.getId());
|
||||
} else if (message.hasSessionDone()) {
|
||||
const s = this.sessions.get(message.getSessionDone()!.getId());
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
s.emit("exit", message.getSessionDone()!.getExitStatus());
|
||||
this.sessions.delete(message.getSessionDone()!.getId());
|
||||
} else if (message.hasSessionOutput()) {
|
||||
const output = message.getSessionOutput()!;
|
||||
const s = this.sessions.get(output.getId());
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
const data = new TextDecoder().decode(output.getData_asU8());
|
||||
const stream = output.getFd() === SessionOutputMessage.FD.STDOUT ? s.stdout : s.stderr;
|
||||
stream.emit("data", data);
|
||||
} else if (message.hasIdentifySession()) {
|
||||
const s = this.sessions.get(message.getIdentifySession()!.getId());
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
s.pid = message.getIdentifySession()!.getPid();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
import { SendableConnection } from "../common/connection";
|
||||
import { ShutdownSessionMessage, ClientMessage, SessionOutputMessage, WriteToSessionMessage, ResizeSessionTTYMessage, TTYDimensions as ProtoTTYDimensions } from "../proto";
|
||||
|
||||
export interface TTYDimensions {
|
||||
readonly columns: number;
|
||||
readonly rows: number;
|
||||
}
|
||||
|
||||
export interface SpawnOptions {
|
||||
cwd?: string;
|
||||
env?: { readonly [key: string]: string };
|
||||
tty?: TTYDimensions;
|
||||
}
|
||||
|
||||
export interface ChildProcess {
|
||||
readonly stdin: stream.Writable;
|
||||
readonly stdout: stream.Readable;
|
||||
readonly stderr: stream.Readable;
|
||||
|
||||
readonly killed?: boolean;
|
||||
readonly pid: number | undefined;
|
||||
|
||||
kill(signal?: string): void;
|
||||
send(message: string | Uint8Array): void;
|
||||
|
||||
on(event: "error", listener: (err: Error) => void): void;
|
||||
on(event: "exit", listener: (code: number, signal: string) => void): void;
|
||||
|
||||
resize?(dimensions: TTYDimensions): void;
|
||||
}
|
||||
|
||||
export class ServerProcess extends events.EventEmitter implements ChildProcess {
|
||||
public readonly stdin = new stream.Writable();
|
||||
public readonly stdout = new stream.Readable({ read: () => true });
|
||||
public readonly stderr = new stream.Readable({ read: () => true });
|
||||
public pid: number | undefined;
|
||||
|
||||
private _killed: boolean = false;
|
||||
|
||||
public constructor(
|
||||
private readonly connection: SendableConnection,
|
||||
private readonly id: number,
|
||||
private readonly hasTty: boolean = false,
|
||||
) {
|
||||
super();
|
||||
|
||||
if (!this.hasTty) {
|
||||
delete this.resize;
|
||||
}
|
||||
}
|
||||
|
||||
public get killed(): boolean {
|
||||
return this._killed;
|
||||
}
|
||||
|
||||
public kill(signal?: string): void {
|
||||
const kill = new ShutdownSessionMessage();
|
||||
kill.setId(this.id);
|
||||
if (signal) {
|
||||
kill.setSignal(signal);
|
||||
}
|
||||
const client = new ClientMessage();
|
||||
client.setShutdownSession(kill);
|
||||
this.connection.send(client.serializeBinary());
|
||||
|
||||
this._killed = true;
|
||||
}
|
||||
|
||||
public send(message: string | Uint8Array): void {
|
||||
const send = new WriteToSessionMessage();
|
||||
send.setId(this.id);
|
||||
send.setData(typeof message === "string" ? new TextEncoder().encode(message) : message);
|
||||
const client = new ClientMessage();
|
||||
client.setWriteToSession(send);
|
||||
this.connection.send(client.serializeBinary());
|
||||
}
|
||||
|
||||
public resize(dimensions: TTYDimensions) {
|
||||
const resize = new ResizeSessionTTYMessage();
|
||||
resize.setId(this.id);
|
||||
const tty = new ProtoTTYDimensions();
|
||||
tty.setHeight(dimensions.rows);
|
||||
tty.setWidth(dimensions.columns);
|
||||
resize.setTtyDimensions(tty);
|
||||
const client = new ClientMessage();
|
||||
client.setResizeSessionTty(resize);
|
||||
this.connection.send(client.serializeBinary());
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
export interface SendableConnection {
|
||||
send(data: Buffer | Uint8Array): void;
|
||||
}
|
||||
|
||||
export interface ReadWriteConnection extends SendableConnection {
|
||||
onMessage(cb: (data: Uint8Array | Buffer) => void): void;
|
||||
onClose(cb: () => void): void;
|
||||
close(): void;
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
import * as cp from "child_process";
|
||||
import * as nodePty from "node-pty";
|
||||
import * as stream from "stream";
|
||||
import { TextEncoder } from "text-encoding";
|
||||
import { NewSessionMessage, ServerMessage, SessionDoneMessage, SessionOutputMessage, ShutdownSessionMessage, IdentifySessionMessage, ClientMessage } from "../proto";
|
||||
import { SendableConnection } from "../common/connection";
|
||||
|
||||
export interface Process {
|
||||
stdin?: stream.Writable;
|
||||
stdout?: stream.Readable;
|
||||
stderr?: stream.Readable;
|
||||
|
||||
pid: number;
|
||||
killed?: boolean;
|
||||
|
||||
on(event: "data", cb: (data: string) => void): void;
|
||||
on(event: 'exit', listener: (exitCode: number, signal?: number) => void): void;
|
||||
write(data: string | Uint8Array): void;
|
||||
resize?(cols: number, rows: number): void;
|
||||
kill(signal?: string): void;
|
||||
title?: number;
|
||||
}
|
||||
|
||||
export const handleNewSession = (connection: SendableConnection, newSession: NewSessionMessage, onExit: () => void): Process => {
|
||||
let process: Process;
|
||||
|
||||
const env = {} as any;
|
||||
newSession.getEnvMap().forEach((value: any, key: any) => {
|
||||
env[key] = value;
|
||||
});
|
||||
if (newSession.getTtyDimensions()) {
|
||||
// Spawn with node-pty
|
||||
process = nodePty.spawn(newSession.getCommand(), newSession.getArgsList(), {
|
||||
cols: newSession.getTtyDimensions()!.getWidth(),
|
||||
rows: newSession.getTtyDimensions()!.getHeight(),
|
||||
cwd: newSession.getCwd(),
|
||||
env,
|
||||
});
|
||||
} else {
|
||||
const options = {
|
||||
cwd: newSession.getCwd(),
|
||||
env,
|
||||
};
|
||||
let proc: cp.ChildProcess;
|
||||
if (newSession.getIsFork()) {
|
||||
proc = cp.fork(newSession.getCommand(), newSession.getArgsList());
|
||||
} else {
|
||||
proc = cp.spawn(newSession.getCommand(), newSession.getArgsList(), options);
|
||||
}
|
||||
|
||||
process = {
|
||||
stdin: proc.stdin,
|
||||
stderr: proc.stderr,
|
||||
stdout: proc.stdout,
|
||||
on: (...args: any[]) => (<any>proc.on)(...args),
|
||||
write: (d) => proc.stdin.write(d),
|
||||
kill: (s) => proc.kill(s || "SIGTERM"),
|
||||
pid: proc.pid,
|
||||
};
|
||||
}
|
||||
|
||||
const sendOutput = (fd: SessionOutputMessage.FD, msg: string | Uint8Array): void => {
|
||||
const serverMsg = new ServerMessage();
|
||||
const d = new SessionOutputMessage();
|
||||
d.setId(newSession.getId());
|
||||
d.setData(typeof msg === "string" ? new TextEncoder().encode(msg) : msg);
|
||||
d.setFd(SessionOutputMessage.FD.STDOUT);
|
||||
serverMsg.setSessionOutput(d);
|
||||
connection.send(serverMsg.serializeBinary());
|
||||
};
|
||||
|
||||
if (process.stdout && process.stderr) {
|
||||
process.stdout.on("data", (data) => {
|
||||
sendOutput(SessionOutputMessage.FD.STDOUT, data);
|
||||
});
|
||||
|
||||
process.stderr.on("data", (data) => {
|
||||
sendOutput(SessionOutputMessage.FD.STDERR, data);
|
||||
});
|
||||
} else {
|
||||
process.on("data", (data) => {
|
||||
sendOutput(SessionOutputMessage.FD.STDOUT, Buffer.from(data));
|
||||
});
|
||||
}
|
||||
|
||||
const id = new IdentifySessionMessage();
|
||||
id.setId(newSession.getId());
|
||||
id.setPid(process.pid);
|
||||
const sm = new ServerMessage();
|
||||
sm.setIdentifySession(id);
|
||||
connection.send(sm.serializeBinary());
|
||||
|
||||
process.on("exit", (code, signal) => {
|
||||
const serverMsg = new ServerMessage();
|
||||
const exit = new SessionDoneMessage();
|
||||
exit.setId(newSession.getId());
|
||||
exit.setExitStatus(code);
|
||||
serverMsg.setSessionDone(exit);
|
||||
connection.send(serverMsg.serializeBinary());
|
||||
|
||||
onExit();
|
||||
});
|
||||
|
||||
return process;
|
||||
};
|
@ -1,61 +0,0 @@
|
||||
import * as vm from "vm";
|
||||
import { NewEvalMessage, TypedValue, EvalFailedMessage, EvalDoneMessage, ServerMessage } from "../proto";
|
||||
import { SendableConnection } from "../common/connection";
|
||||
|
||||
export const evaluate = async (connection: SendableConnection, message: NewEvalMessage): Promise<void> => {
|
||||
const argStr: string[] = [];
|
||||
message.getArgsList().forEach((value) => {
|
||||
argStr.push(value);
|
||||
});
|
||||
const sendResp = (resp: any): void => {
|
||||
const evalDone = new EvalDoneMessage();
|
||||
evalDone.setId(message.getId());
|
||||
const tof = typeof resp;
|
||||
if (tof !== "undefined") {
|
||||
const tv = new TypedValue();
|
||||
let t: TypedValue.Type;
|
||||
switch (tof) {
|
||||
case "string":
|
||||
t = TypedValue.Type.STRING;
|
||||
break;
|
||||
case "boolean":
|
||||
t = TypedValue.Type.BOOLEAN;
|
||||
break;
|
||||
case "object":
|
||||
t = TypedValue.Type.OBJECT;
|
||||
break;
|
||||
case "number":
|
||||
t = TypedValue.Type.NUMBER;
|
||||
break;
|
||||
default:
|
||||
sendErr(EvalFailedMessage.Reason.EXCEPTION, `unsupported response type ${tof}`);
|
||||
return;
|
||||
}
|
||||
tv.setValue(tof === "string" ? resp : JSON.stringify(resp));
|
||||
tv.setType(t);
|
||||
evalDone.setResponse(tv);
|
||||
}
|
||||
|
||||
const serverMsg = new ServerMessage();
|
||||
serverMsg.setEvalDone(evalDone);
|
||||
connection.send(serverMsg.serializeBinary());
|
||||
};
|
||||
const sendErr = (reason: EvalFailedMessage.Reason, msg: string): void => {
|
||||
const evalFailed = new EvalFailedMessage();
|
||||
evalFailed.setId(message.getId());
|
||||
evalFailed.setReason(reason);
|
||||
evalFailed.setMessage(msg);
|
||||
|
||||
const serverMsg = new ServerMessage();
|
||||
serverMsg.setEvalFailed(evalFailed);
|
||||
connection.send(serverMsg.serializeBinary());
|
||||
};
|
||||
try {
|
||||
const value = vm.runInNewContext(`(${message.getFunction()})(${argStr.join(",")})`, { require, setTimeout }, {
|
||||
timeout: message.getTimeout() || 30000,
|
||||
});
|
||||
sendResp(await value);
|
||||
} catch (ex) {
|
||||
sendErr(EvalFailedMessage.Reason.EXCEPTION, ex.toString());
|
||||
}
|
||||
};
|
@ -1,67 +0,0 @@
|
||||
import { logger, field } from "@coder/logger";
|
||||
import { TextDecoder } from "text-encoding";
|
||||
import { ClientMessage } from "../proto";
|
||||
import { evaluate } from "./evaluate";
|
||||
import { ReadWriteConnection } from "../common/connection";
|
||||
import { Process, handleNewSession } from "./command";
|
||||
|
||||
export class Server {
|
||||
|
||||
private readonly sessions: Map<number, Process>;
|
||||
|
||||
public constructor(
|
||||
private readonly connection: ReadWriteConnection,
|
||||
) {
|
||||
this.sessions = new Map();
|
||||
|
||||
connection.onMessage((data) => {
|
||||
try {
|
||||
this.handleMessage(ClientMessage.deserializeBinary(data));
|
||||
} catch (ex) {
|
||||
logger.error("Failed to handle client message", field("length", data.byteLength), field("exception", ex));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private handleMessage(message: ClientMessage): void {
|
||||
if (message.hasNewEval()) {
|
||||
evaluate(this.connection, message.getNewEval()!);
|
||||
} else if (message.hasNewSession()) {
|
||||
const session = handleNewSession(this.connection, message.getNewSession()!, () => {
|
||||
this.sessions.delete(message.getNewSession()!.getId());
|
||||
});
|
||||
|
||||
this.sessions.set(message.getNewSession()!.getId(), session);
|
||||
} else if (message.hasCloseSessionInput()) {
|
||||
const s = this.getSession(message.getCloseSessionInput()!.getId());
|
||||
if (!s || !s.stdin) {
|
||||
return;
|
||||
}
|
||||
s.stdin.end();
|
||||
} else if (message.hasResizeSessionTty()) {
|
||||
const s = this.getSession(message.getResizeSessionTty()!.getId());
|
||||
if (!s || !s.resize) {
|
||||
return;
|
||||
}
|
||||
const tty = message.getResizeSessionTty()!.getTtyDimensions()!;
|
||||
s.resize(tty.getWidth(), tty.getHeight());
|
||||
} else if (message.hasShutdownSession()) {
|
||||
const s = this.getSession(message.getShutdownSession()!.getId());
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
s.kill(message.getShutdownSession()!.getSignal());
|
||||
} else if (message.hasWriteToSession()) {
|
||||
const s = this.getSession(message.getWriteToSession()!.getId());
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
s.write(new TextDecoder().decode(message.getWriteToSession()!.getData_asU8()));
|
||||
}
|
||||
}
|
||||
|
||||
private getSession(id: number): Process | undefined {
|
||||
return this.sessions.get(id);
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
syntax = "proto3";
|
||||
import "command.proto";
|
||||
import "node.proto";
|
||||
|
||||
message ClientMessage {
|
||||
oneof msg {
|
||||
// command.proto
|
||||
NewSessionMessage new_session = 1;
|
||||
ShutdownSessionMessage shutdown_session = 2;
|
||||
WriteToSessionMessage write_to_session = 3;
|
||||
CloseSessionInputMessage close_session_input = 4;
|
||||
ResizeSessionTTYMessage resize_session_tty = 5;
|
||||
|
||||
// node.proto
|
||||
NewEvalMessage new_eval = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ServerMessage {
|
||||
oneof msg {
|
||||
// command.proto
|
||||
NewSessionFailureMessage new_session_failure = 1;
|
||||
SessionDoneMessage session_done = 2;
|
||||
SessionOutputMessage session_output = 3;
|
||||
IdentifySessionMessage identify_session = 4;
|
||||
|
||||
// node.proto
|
||||
EvalFailedMessage eval_failed = 5;
|
||||
EvalDoneMessage eval_done = 6;
|
||||
}
|
||||
}
|
133
packages/server/src/proto/client_pb.d.ts
vendored
133
packages/server/src/proto/client_pb.d.ts
vendored
@ -1,133 +0,0 @@
|
||||
// package:
|
||||
// file: client.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
import * as command_pb from "./command_pb";
|
||||
import * as node_pb from "./node_pb";
|
||||
|
||||
export class ClientMessage extends jspb.Message {
|
||||
hasNewSession(): boolean;
|
||||
clearNewSession(): void;
|
||||
getNewSession(): command_pb.NewSessionMessage | undefined;
|
||||
setNewSession(value?: command_pb.NewSessionMessage): void;
|
||||
|
||||
hasShutdownSession(): boolean;
|
||||
clearShutdownSession(): void;
|
||||
getShutdownSession(): command_pb.ShutdownSessionMessage | undefined;
|
||||
setShutdownSession(value?: command_pb.ShutdownSessionMessage): void;
|
||||
|
||||
hasWriteToSession(): boolean;
|
||||
clearWriteToSession(): void;
|
||||
getWriteToSession(): command_pb.WriteToSessionMessage | undefined;
|
||||
setWriteToSession(value?: command_pb.WriteToSessionMessage): void;
|
||||
|
||||
hasCloseSessionInput(): boolean;
|
||||
clearCloseSessionInput(): void;
|
||||
getCloseSessionInput(): command_pb.CloseSessionInputMessage | undefined;
|
||||
setCloseSessionInput(value?: command_pb.CloseSessionInputMessage): void;
|
||||
|
||||
hasResizeSessionTty(): boolean;
|
||||
clearResizeSessionTty(): void;
|
||||
getResizeSessionTty(): command_pb.ResizeSessionTTYMessage | undefined;
|
||||
setResizeSessionTty(value?: command_pb.ResizeSessionTTYMessage): void;
|
||||
|
||||
hasNewEval(): boolean;
|
||||
clearNewEval(): void;
|
||||
getNewEval(): node_pb.NewEvalMessage | undefined;
|
||||
setNewEval(value?: node_pb.NewEvalMessage): void;
|
||||
|
||||
getMsgCase(): ClientMessage.MsgCase;
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ClientMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ClientMessage): ClientMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ClientMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ClientMessage;
|
||||
static deserializeBinaryFromReader(message: ClientMessage, reader: jspb.BinaryReader): ClientMessage;
|
||||
}
|
||||
|
||||
export namespace ClientMessage {
|
||||
export type AsObject = {
|
||||
newSession?: command_pb.NewSessionMessage.AsObject,
|
||||
shutdownSession?: command_pb.ShutdownSessionMessage.AsObject,
|
||||
writeToSession?: command_pb.WriteToSessionMessage.AsObject,
|
||||
closeSessionInput?: command_pb.CloseSessionInputMessage.AsObject,
|
||||
resizeSessionTty?: command_pb.ResizeSessionTTYMessage.AsObject,
|
||||
newEval?: node_pb.NewEvalMessage.AsObject,
|
||||
}
|
||||
|
||||
export enum MsgCase {
|
||||
MSG_NOT_SET = 0,
|
||||
NEW_SESSION = 1,
|
||||
SHUTDOWN_SESSION = 2,
|
||||
WRITE_TO_SESSION = 3,
|
||||
CLOSE_SESSION_INPUT = 4,
|
||||
RESIZE_SESSION_TTY = 5,
|
||||
NEW_EVAL = 6,
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerMessage extends jspb.Message {
|
||||
hasNewSessionFailure(): boolean;
|
||||
clearNewSessionFailure(): void;
|
||||
getNewSessionFailure(): command_pb.NewSessionFailureMessage | undefined;
|
||||
setNewSessionFailure(value?: command_pb.NewSessionFailureMessage): void;
|
||||
|
||||
hasSessionDone(): boolean;
|
||||
clearSessionDone(): void;
|
||||
getSessionDone(): command_pb.SessionDoneMessage | undefined;
|
||||
setSessionDone(value?: command_pb.SessionDoneMessage): void;
|
||||
|
||||
hasSessionOutput(): boolean;
|
||||
clearSessionOutput(): void;
|
||||
getSessionOutput(): command_pb.SessionOutputMessage | undefined;
|
||||
setSessionOutput(value?: command_pb.SessionOutputMessage): void;
|
||||
|
||||
hasIdentifySession(): boolean;
|
||||
clearIdentifySession(): void;
|
||||
getIdentifySession(): command_pb.IdentifySessionMessage | undefined;
|
||||
setIdentifySession(value?: command_pb.IdentifySessionMessage): void;
|
||||
|
||||
hasEvalFailed(): boolean;
|
||||
clearEvalFailed(): void;
|
||||
getEvalFailed(): node_pb.EvalFailedMessage | undefined;
|
||||
setEvalFailed(value?: node_pb.EvalFailedMessage): void;
|
||||
|
||||
hasEvalDone(): boolean;
|
||||
clearEvalDone(): void;
|
||||
getEvalDone(): node_pb.EvalDoneMessage | undefined;
|
||||
setEvalDone(value?: node_pb.EvalDoneMessage): void;
|
||||
|
||||
getMsgCase(): ServerMessage.MsgCase;
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ServerMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ServerMessage): ServerMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ServerMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ServerMessage;
|
||||
static deserializeBinaryFromReader(message: ServerMessage, reader: jspb.BinaryReader): ServerMessage;
|
||||
}
|
||||
|
||||
export namespace ServerMessage {
|
||||
export type AsObject = {
|
||||
newSessionFailure?: command_pb.NewSessionFailureMessage.AsObject,
|
||||
sessionDone?: command_pb.SessionDoneMessage.AsObject,
|
||||
sessionOutput?: command_pb.SessionOutputMessage.AsObject,
|
||||
identifySession?: command_pb.IdentifySessionMessage.AsObject,
|
||||
evalFailed?: node_pb.EvalFailedMessage.AsObject,
|
||||
evalDone?: node_pb.EvalDoneMessage.AsObject,
|
||||
}
|
||||
|
||||
export enum MsgCase {
|
||||
MSG_NOT_SET = 0,
|
||||
NEW_SESSION_FAILURE = 1,
|
||||
SESSION_DONE = 2,
|
||||
SESSION_OUTPUT = 3,
|
||||
IDENTIFY_SESSION = 4,
|
||||
EVAL_FAILED = 5,
|
||||
EVAL_DONE = 6,
|
||||
}
|
||||
}
|
||||
|
@ -1,868 +0,0 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* @enhanceable
|
||||
* @public
|
||||
*/
|
||||
// GENERATED CODE -- DO NOT EDIT!
|
||||
|
||||
var jspb = require('google-protobuf');
|
||||
var goog = jspb;
|
||||
var global = Function('return this')();
|
||||
|
||||
var command_pb = require('./command_pb.js');
|
||||
var node_pb = require('./node_pb.js');
|
||||
goog.exportSymbol('proto.ClientMessage', null, global);
|
||||
goog.exportSymbol('proto.ServerMessage', null, global);
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.ClientMessage = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, proto.ClientMessage.oneofGroups_);
|
||||
};
|
||||
goog.inherits(proto.ClientMessage, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
proto.ClientMessage.displayName = 'proto.ClientMessage';
|
||||
}
|
||||
/**
|
||||
* Oneof group definitions for this message. Each group defines the field
|
||||
* numbers belonging to that group. When of these fields' value is set, all
|
||||
* other fields in the group are cleared. During deserialization, if multiple
|
||||
* fields are encountered for a group, only the last value seen will be kept.
|
||||
* @private {!Array<!Array<number>>}
|
||||
* @const
|
||||
*/
|
||||
proto.ClientMessage.oneofGroups_ = [[1,2,3,4,5,6]];
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
proto.ClientMessage.MsgCase = {
|
||||
MSG_NOT_SET: 0,
|
||||
NEW_SESSION: 1,
|
||||
SHUTDOWN_SESSION: 2,
|
||||
WRITE_TO_SESSION: 3,
|
||||
CLOSE_SESSION_INPUT: 4,
|
||||
RESIZE_SESSION_TTY: 5,
|
||||
NEW_EVAL: 6
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {proto.ClientMessage.MsgCase}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getMsgCase = function() {
|
||||
return /** @type {proto.ClientMessage.MsgCase} */(jspb.Message.computeOneofCase(this, proto.ClientMessage.oneofGroups_[0]));
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto suitable for use in Soy templates.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.ClientMessage.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.ClientMessage.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB
|
||||
* instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.ClientMessage} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.ClientMessage.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
newSession: (f = msg.getNewSession()) && command_pb.NewSessionMessage.toObject(includeInstance, f),
|
||||
shutdownSession: (f = msg.getShutdownSession()) && command_pb.ShutdownSessionMessage.toObject(includeInstance, f),
|
||||
writeToSession: (f = msg.getWriteToSession()) && command_pb.WriteToSessionMessage.toObject(includeInstance, f),
|
||||
closeSessionInput: (f = msg.getCloseSessionInput()) && command_pb.CloseSessionInputMessage.toObject(includeInstance, f),
|
||||
resizeSessionTty: (f = msg.getResizeSessionTty()) && command_pb.ResizeSessionTTYMessage.toObject(includeInstance, f),
|
||||
newEval: (f = msg.getNewEval()) && node_pb.NewEvalMessage.toObject(includeInstance, f)
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.ClientMessage}
|
||||
*/
|
||||
proto.ClientMessage.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.ClientMessage;
|
||||
return proto.ClientMessage.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.ClientMessage} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.ClientMessage}
|
||||
*/
|
||||
proto.ClientMessage.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = new command_pb.NewSessionMessage;
|
||||
reader.readMessage(value,command_pb.NewSessionMessage.deserializeBinaryFromReader);
|
||||
msg.setNewSession(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = new command_pb.ShutdownSessionMessage;
|
||||
reader.readMessage(value,command_pb.ShutdownSessionMessage.deserializeBinaryFromReader);
|
||||
msg.setShutdownSession(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = new command_pb.WriteToSessionMessage;
|
||||
reader.readMessage(value,command_pb.WriteToSessionMessage.deserializeBinaryFromReader);
|
||||
msg.setWriteToSession(value);
|
||||
break;
|
||||
case 4:
|
||||
var value = new command_pb.CloseSessionInputMessage;
|
||||
reader.readMessage(value,command_pb.CloseSessionInputMessage.deserializeBinaryFromReader);
|
||||
msg.setCloseSessionInput(value);
|
||||
break;
|
||||
case 5:
|
||||
var value = new command_pb.ResizeSessionTTYMessage;
|
||||
reader.readMessage(value,command_pb.ResizeSessionTTYMessage.deserializeBinaryFromReader);
|
||||
msg.setResizeSessionTty(value);
|
||||
break;
|
||||
case 6:
|
||||
var value = new node_pb.NewEvalMessage;
|
||||
reader.readMessage(value,node_pb.NewEvalMessage.deserializeBinaryFromReader);
|
||||
msg.setNewEval(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class method variant: serializes the given message to binary data
|
||||
* (in protobuf wire format), writing to the given BinaryWriter.
|
||||
* @param {!proto.ClientMessage} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.ClientMessage.serializeBinaryToWriter = function(message, writer) {
|
||||
message.serializeBinaryToWriter(writer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.ClientMessage.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
this.serializeBinaryToWriter(writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format),
|
||||
* writing to the given BinaryWriter.
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.ClientMessage.prototype.serializeBinaryToWriter = function (writer) {
|
||||
var f = undefined;
|
||||
f = this.getNewSession();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
1,
|
||||
f,
|
||||
command_pb.NewSessionMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getShutdownSession();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
2,
|
||||
f,
|
||||
command_pb.ShutdownSessionMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getWriteToSession();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
3,
|
||||
f,
|
||||
command_pb.WriteToSessionMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getCloseSessionInput();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
4,
|
||||
f,
|
||||
command_pb.CloseSessionInputMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getResizeSessionTty();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
5,
|
||||
f,
|
||||
command_pb.ResizeSessionTTYMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getNewEval();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
6,
|
||||
f,
|
||||
node_pb.NewEvalMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a deep clone of this proto. No data is shared with the original.
|
||||
* @return {!proto.ClientMessage} The clone.
|
||||
*/
|
||||
proto.ClientMessage.prototype.cloneMessage = function() {
|
||||
return /** @type {!proto.ClientMessage} */ (jspb.Message.cloneMessage(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional NewSessionMessage new_session = 1;
|
||||
* @return {proto.NewSessionMessage}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getNewSession = function() {
|
||||
return /** @type{proto.NewSessionMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.NewSessionMessage, 1));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.NewSessionMessage|undefined} value */
|
||||
proto.ClientMessage.prototype.setNewSession = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 1, proto.ClientMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ClientMessage.prototype.clearNewSession = function() {
|
||||
this.setNewSession(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ClientMessage.prototype.hasNewSession = function() {
|
||||
return jspb.Message.getField(this, 1) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional ShutdownSessionMessage shutdown_session = 2;
|
||||
* @return {proto.ShutdownSessionMessage}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getShutdownSession = function() {
|
||||
return /** @type{proto.ShutdownSessionMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.ShutdownSessionMessage, 2));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.ShutdownSessionMessage|undefined} value */
|
||||
proto.ClientMessage.prototype.setShutdownSession = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 2, proto.ClientMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ClientMessage.prototype.clearShutdownSession = function() {
|
||||
this.setShutdownSession(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ClientMessage.prototype.hasShutdownSession = function() {
|
||||
return jspb.Message.getField(this, 2) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional WriteToSessionMessage write_to_session = 3;
|
||||
* @return {proto.WriteToSessionMessage}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getWriteToSession = function() {
|
||||
return /** @type{proto.WriteToSessionMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.WriteToSessionMessage, 3));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.WriteToSessionMessage|undefined} value */
|
||||
proto.ClientMessage.prototype.setWriteToSession = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 3, proto.ClientMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ClientMessage.prototype.clearWriteToSession = function() {
|
||||
this.setWriteToSession(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ClientMessage.prototype.hasWriteToSession = function() {
|
||||
return jspb.Message.getField(this, 3) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional CloseSessionInputMessage close_session_input = 4;
|
||||
* @return {proto.CloseSessionInputMessage}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getCloseSessionInput = function() {
|
||||
return /** @type{proto.CloseSessionInputMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.CloseSessionInputMessage, 4));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.CloseSessionInputMessage|undefined} value */
|
||||
proto.ClientMessage.prototype.setCloseSessionInput = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 4, proto.ClientMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ClientMessage.prototype.clearCloseSessionInput = function() {
|
||||
this.setCloseSessionInput(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ClientMessage.prototype.hasCloseSessionInput = function() {
|
||||
return jspb.Message.getField(this, 4) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional ResizeSessionTTYMessage resize_session_tty = 5;
|
||||
* @return {proto.ResizeSessionTTYMessage}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getResizeSessionTty = function() {
|
||||
return /** @type{proto.ResizeSessionTTYMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.ResizeSessionTTYMessage, 5));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.ResizeSessionTTYMessage|undefined} value */
|
||||
proto.ClientMessage.prototype.setResizeSessionTty = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 5, proto.ClientMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ClientMessage.prototype.clearResizeSessionTty = function() {
|
||||
this.setResizeSessionTty(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ClientMessage.prototype.hasResizeSessionTty = function() {
|
||||
return jspb.Message.getField(this, 5) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional NewEvalMessage new_eval = 6;
|
||||
* @return {proto.NewEvalMessage}
|
||||
*/
|
||||
proto.ClientMessage.prototype.getNewEval = function() {
|
||||
return /** @type{proto.NewEvalMessage} */ (
|
||||
jspb.Message.getWrapperField(this, node_pb.NewEvalMessage, 6));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.NewEvalMessage|undefined} value */
|
||||
proto.ClientMessage.prototype.setNewEval = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 6, proto.ClientMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ClientMessage.prototype.clearNewEval = function() {
|
||||
this.setNewEval(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ClientMessage.prototype.hasNewEval = function() {
|
||||
return jspb.Message.getField(this, 6) != null;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.ServerMessage = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, proto.ServerMessage.oneofGroups_);
|
||||
};
|
||||
goog.inherits(proto.ServerMessage, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
proto.ServerMessage.displayName = 'proto.ServerMessage';
|
||||
}
|
||||
/**
|
||||
* Oneof group definitions for this message. Each group defines the field
|
||||
* numbers belonging to that group. When of these fields' value is set, all
|
||||
* other fields in the group are cleared. During deserialization, if multiple
|
||||
* fields are encountered for a group, only the last value seen will be kept.
|
||||
* @private {!Array<!Array<number>>}
|
||||
* @const
|
||||
*/
|
||||
proto.ServerMessage.oneofGroups_ = [[1,2,3,4,5,6]];
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
proto.ServerMessage.MsgCase = {
|
||||
MSG_NOT_SET: 0,
|
||||
NEW_SESSION_FAILURE: 1,
|
||||
SESSION_DONE: 2,
|
||||
SESSION_OUTPUT: 3,
|
||||
IDENTIFY_SESSION: 4,
|
||||
EVAL_FAILED: 5,
|
||||
EVAL_DONE: 6
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {proto.ServerMessage.MsgCase}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getMsgCase = function() {
|
||||
return /** @type {proto.ServerMessage.MsgCase} */(jspb.Message.computeOneofCase(this, proto.ServerMessage.oneofGroups_[0]));
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto suitable for use in Soy templates.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.ServerMessage.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.ServerMessage.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB
|
||||
* instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.ServerMessage} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.ServerMessage.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
newSessionFailure: (f = msg.getNewSessionFailure()) && command_pb.NewSessionFailureMessage.toObject(includeInstance, f),
|
||||
sessionDone: (f = msg.getSessionDone()) && command_pb.SessionDoneMessage.toObject(includeInstance, f),
|
||||
sessionOutput: (f = msg.getSessionOutput()) && command_pb.SessionOutputMessage.toObject(includeInstance, f),
|
||||
identifySession: (f = msg.getIdentifySession()) && command_pb.IdentifySessionMessage.toObject(includeInstance, f),
|
||||
evalFailed: (f = msg.getEvalFailed()) && node_pb.EvalFailedMessage.toObject(includeInstance, f),
|
||||
evalDone: (f = msg.getEvalDone()) && node_pb.EvalDoneMessage.toObject(includeInstance, f)
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.ServerMessage}
|
||||
*/
|
||||
proto.ServerMessage.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.ServerMessage;
|
||||
return proto.ServerMessage.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.ServerMessage} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.ServerMessage}
|
||||
*/
|
||||
proto.ServerMessage.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = new command_pb.NewSessionFailureMessage;
|
||||
reader.readMessage(value,command_pb.NewSessionFailureMessage.deserializeBinaryFromReader);
|
||||
msg.setNewSessionFailure(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = new command_pb.SessionDoneMessage;
|
||||
reader.readMessage(value,command_pb.SessionDoneMessage.deserializeBinaryFromReader);
|
||||
msg.setSessionDone(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = new command_pb.SessionOutputMessage;
|
||||
reader.readMessage(value,command_pb.SessionOutputMessage.deserializeBinaryFromReader);
|
||||
msg.setSessionOutput(value);
|
||||
break;
|
||||
case 4:
|
||||
var value = new command_pb.IdentifySessionMessage;
|
||||
reader.readMessage(value,command_pb.IdentifySessionMessage.deserializeBinaryFromReader);
|
||||
msg.setIdentifySession(value);
|
||||
break;
|
||||
case 5:
|
||||
var value = new node_pb.EvalFailedMessage;
|
||||
reader.readMessage(value,node_pb.EvalFailedMessage.deserializeBinaryFromReader);
|
||||
msg.setEvalFailed(value);
|
||||
break;
|
||||
case 6:
|
||||
var value = new node_pb.EvalDoneMessage;
|
||||
reader.readMessage(value,node_pb.EvalDoneMessage.deserializeBinaryFromReader);
|
||||
msg.setEvalDone(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class method variant: serializes the given message to binary data
|
||||
* (in protobuf wire format), writing to the given BinaryWriter.
|
||||
* @param {!proto.ServerMessage} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.ServerMessage.serializeBinaryToWriter = function(message, writer) {
|
||||
message.serializeBinaryToWriter(writer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.ServerMessage.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
this.serializeBinaryToWriter(writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format),
|
||||
* writing to the given BinaryWriter.
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.ServerMessage.prototype.serializeBinaryToWriter = function (writer) {
|
||||
var f = undefined;
|
||||
f = this.getNewSessionFailure();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
1,
|
||||
f,
|
||||
command_pb.NewSessionFailureMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getSessionDone();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
2,
|
||||
f,
|
||||
command_pb.SessionDoneMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getSessionOutput();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
3,
|
||||
f,
|
||||
command_pb.SessionOutputMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getIdentifySession();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
4,
|
||||
f,
|
||||
command_pb.IdentifySessionMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getEvalFailed();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
5,
|
||||
f,
|
||||
node_pb.EvalFailedMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
f = this.getEvalDone();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
6,
|
||||
f,
|
||||
node_pb.EvalDoneMessage.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a deep clone of this proto. No data is shared with the original.
|
||||
* @return {!proto.ServerMessage} The clone.
|
||||
*/
|
||||
proto.ServerMessage.prototype.cloneMessage = function() {
|
||||
return /** @type {!proto.ServerMessage} */ (jspb.Message.cloneMessage(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional NewSessionFailureMessage new_session_failure = 1;
|
||||
* @return {proto.NewSessionFailureMessage}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getNewSessionFailure = function() {
|
||||
return /** @type{proto.NewSessionFailureMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.NewSessionFailureMessage, 1));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.NewSessionFailureMessage|undefined} value */
|
||||
proto.ServerMessage.prototype.setNewSessionFailure = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 1, proto.ServerMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ServerMessage.prototype.clearNewSessionFailure = function() {
|
||||
this.setNewSessionFailure(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ServerMessage.prototype.hasNewSessionFailure = function() {
|
||||
return jspb.Message.getField(this, 1) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional SessionDoneMessage session_done = 2;
|
||||
* @return {proto.SessionDoneMessage}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getSessionDone = function() {
|
||||
return /** @type{proto.SessionDoneMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.SessionDoneMessage, 2));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.SessionDoneMessage|undefined} value */
|
||||
proto.ServerMessage.prototype.setSessionDone = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 2, proto.ServerMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ServerMessage.prototype.clearSessionDone = function() {
|
||||
this.setSessionDone(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ServerMessage.prototype.hasSessionDone = function() {
|
||||
return jspb.Message.getField(this, 2) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional SessionOutputMessage session_output = 3;
|
||||
* @return {proto.SessionOutputMessage}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getSessionOutput = function() {
|
||||
return /** @type{proto.SessionOutputMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.SessionOutputMessage, 3));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.SessionOutputMessage|undefined} value */
|
||||
proto.ServerMessage.prototype.setSessionOutput = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 3, proto.ServerMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ServerMessage.prototype.clearSessionOutput = function() {
|
||||
this.setSessionOutput(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ServerMessage.prototype.hasSessionOutput = function() {
|
||||
return jspb.Message.getField(this, 3) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional IdentifySessionMessage identify_session = 4;
|
||||
* @return {proto.IdentifySessionMessage}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getIdentifySession = function() {
|
||||
return /** @type{proto.IdentifySessionMessage} */ (
|
||||
jspb.Message.getWrapperField(this, command_pb.IdentifySessionMessage, 4));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.IdentifySessionMessage|undefined} value */
|
||||
proto.ServerMessage.prototype.setIdentifySession = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 4, proto.ServerMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ServerMessage.prototype.clearIdentifySession = function() {
|
||||
this.setIdentifySession(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ServerMessage.prototype.hasIdentifySession = function() {
|
||||
return jspb.Message.getField(this, 4) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional EvalFailedMessage eval_failed = 5;
|
||||
* @return {proto.EvalFailedMessage}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getEvalFailed = function() {
|
||||
return /** @type{proto.EvalFailedMessage} */ (
|
||||
jspb.Message.getWrapperField(this, node_pb.EvalFailedMessage, 5));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.EvalFailedMessage|undefined} value */
|
||||
proto.ServerMessage.prototype.setEvalFailed = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 5, proto.ServerMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ServerMessage.prototype.clearEvalFailed = function() {
|
||||
this.setEvalFailed(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ServerMessage.prototype.hasEvalFailed = function() {
|
||||
return jspb.Message.getField(this, 5) != null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional EvalDoneMessage eval_done = 6;
|
||||
* @return {proto.EvalDoneMessage}
|
||||
*/
|
||||
proto.ServerMessage.prototype.getEvalDone = function() {
|
||||
return /** @type{proto.EvalDoneMessage} */ (
|
||||
jspb.Message.getWrapperField(this, node_pb.EvalDoneMessage, 6));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.EvalDoneMessage|undefined} value */
|
||||
proto.ServerMessage.prototype.setEvalDone = function(value) {
|
||||
jspb.Message.setOneofWrapperField(this, 6, proto.ServerMessage.oneofGroups_[0], value);
|
||||
};
|
||||
|
||||
|
||||
proto.ServerMessage.prototype.clearEvalDone = function() {
|
||||
this.setEvalDone(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.ServerMessage.prototype.hasEvalDone = function() {
|
||||
return jspb.Message.getField(this, 6) != null;
|
||||
};
|
||||
|
||||
|
||||
goog.object.extend(exports, proto);
|
@ -1,78 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// Executes a command.
|
||||
// Ensure the id field is unique for each new session. If a client reuses the id of an existing
|
||||
// session, the connection will be closed.
|
||||
// If env is provided, the environment variables will be set.
|
||||
// If tty_dimensions is included, we will spawn a tty for the command using the given dimensions.
|
||||
message NewSessionMessage {
|
||||
uint64 id = 1;
|
||||
string command = 2;
|
||||
repeated string args = 3;
|
||||
map<string, string> env = 4;
|
||||
string cwd = 5;
|
||||
TTYDimensions tty_dimensions = 6;
|
||||
bool is_fork = 7;
|
||||
}
|
||||
|
||||
// Sent when starting a session failed.
|
||||
message NewSessionFailureMessage {
|
||||
uint64 id = 1;
|
||||
enum Reason {
|
||||
Prohibited = 0;
|
||||
ResourceShortage = 1;
|
||||
}
|
||||
Reason reason = 2;
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
// Sent when a session has completed
|
||||
message SessionDoneMessage {
|
||||
uint64 id = 1;
|
||||
int64 exit_status = 2;
|
||||
}
|
||||
|
||||
// Identifies a session with a PID.
|
||||
message IdentifySessionMessage {
|
||||
uint64 id = 1;
|
||||
uint64 pid = 2;
|
||||
}
|
||||
|
||||
// Writes data to a session.
|
||||
message WriteToSessionMessage {
|
||||
uint64 id = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
// Resizes the TTY of the session identified by the id.
|
||||
// The connection will be closed if a TTY was not requested when the session was created.
|
||||
message ResizeSessionTTYMessage {
|
||||
uint64 id = 1;
|
||||
TTYDimensions tty_dimensions = 2;
|
||||
}
|
||||
|
||||
// CloseSessionInputMessage closes the stdin of the session by the ID.
|
||||
message CloseSessionInputMessage {
|
||||
uint64 id = 1;
|
||||
}
|
||||
|
||||
message ShutdownSessionMessage {
|
||||
uint64 id = 1;
|
||||
string signal = 2;
|
||||
}
|
||||
|
||||
// SessionOutputMessage carries data read from the stdout or stderr of the session identified by the id.
|
||||
message SessionOutputMessage {
|
||||
uint64 id = 1;
|
||||
enum FD {
|
||||
Stdout = 0;
|
||||
Stderr = 1;
|
||||
}
|
||||
FD fd = 2;
|
||||
bytes data = 3;
|
||||
}
|
||||
|
||||
message TTYDimensions {
|
||||
uint32 height = 1;
|
||||
uint32 width = 2;
|
||||
}
|
288
packages/server/src/proto/command_pb.d.ts
vendored
288
packages/server/src/proto/command_pb.d.ts
vendored
@ -1,288 +0,0 @@
|
||||
// package:
|
||||
// file: command.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
|
||||
export class NewSessionMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getCommand(): string;
|
||||
setCommand(value: string): void;
|
||||
|
||||
clearArgsList(): void;
|
||||
getArgsList(): Array<string>;
|
||||
setArgsList(value: Array<string>): void;
|
||||
addArgs(value: string, index?: number): string;
|
||||
|
||||
getEnvMap(): jspb.Map<string, string>;
|
||||
clearEnvMap(): void;
|
||||
getCwd(): string;
|
||||
setCwd(value: string): void;
|
||||
|
||||
hasTtyDimensions(): boolean;
|
||||
clearTtyDimensions(): void;
|
||||
getTtyDimensions(): TTYDimensions | undefined;
|
||||
setTtyDimensions(value?: TTYDimensions): void;
|
||||
|
||||
getIsFork(): boolean;
|
||||
setIsFork(value: boolean): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): NewSessionMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: NewSessionMessage): NewSessionMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: NewSessionMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): NewSessionMessage;
|
||||
static deserializeBinaryFromReader(message: NewSessionMessage, reader: jspb.BinaryReader): NewSessionMessage;
|
||||
}
|
||||
|
||||
export namespace NewSessionMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
command: string,
|
||||
argsList: Array<string>,
|
||||
envMap: Array<[string, string]>,
|
||||
cwd: string,
|
||||
ttyDimensions?: TTYDimensions.AsObject,
|
||||
isFork: boolean,
|
||||
}
|
||||
}
|
||||
|
||||
export class NewSessionFailureMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getReason(): NewSessionFailureMessage.Reason;
|
||||
setReason(value: NewSessionFailureMessage.Reason): void;
|
||||
|
||||
getMessage(): string;
|
||||
setMessage(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): NewSessionFailureMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: NewSessionFailureMessage): NewSessionFailureMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: NewSessionFailureMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): NewSessionFailureMessage;
|
||||
static deserializeBinaryFromReader(message: NewSessionFailureMessage, reader: jspb.BinaryReader): NewSessionFailureMessage;
|
||||
}
|
||||
|
||||
export namespace NewSessionFailureMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
reason: NewSessionFailureMessage.Reason,
|
||||
message: string,
|
||||
}
|
||||
|
||||
export enum Reason {
|
||||
PROHIBITED = 0,
|
||||
RESOURCESHORTAGE = 1,
|
||||
}
|
||||
}
|
||||
|
||||
export class SessionDoneMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getExitStatus(): number;
|
||||
setExitStatus(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): SessionDoneMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: SessionDoneMessage): SessionDoneMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: SessionDoneMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): SessionDoneMessage;
|
||||
static deserializeBinaryFromReader(message: SessionDoneMessage, reader: jspb.BinaryReader): SessionDoneMessage;
|
||||
}
|
||||
|
||||
export namespace SessionDoneMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
exitStatus: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class IdentifySessionMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getPid(): number;
|
||||
setPid(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): IdentifySessionMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: IdentifySessionMessage): IdentifySessionMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: IdentifySessionMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): IdentifySessionMessage;
|
||||
static deserializeBinaryFromReader(message: IdentifySessionMessage, reader: jspb.BinaryReader): IdentifySessionMessage;
|
||||
}
|
||||
|
||||
export namespace IdentifySessionMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
pid: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class WriteToSessionMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getData(): Uint8Array | string;
|
||||
getData_asU8(): Uint8Array;
|
||||
getData_asB64(): string;
|
||||
setData(value: Uint8Array | string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): WriteToSessionMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: WriteToSessionMessage): WriteToSessionMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: WriteToSessionMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): WriteToSessionMessage;
|
||||
static deserializeBinaryFromReader(message: WriteToSessionMessage, reader: jspb.BinaryReader): WriteToSessionMessage;
|
||||
}
|
||||
|
||||
export namespace WriteToSessionMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
data: Uint8Array | string,
|
||||
}
|
||||
}
|
||||
|
||||
export class ResizeSessionTTYMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
hasTtyDimensions(): boolean;
|
||||
clearTtyDimensions(): void;
|
||||
getTtyDimensions(): TTYDimensions | undefined;
|
||||
setTtyDimensions(value?: TTYDimensions): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ResizeSessionTTYMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ResizeSessionTTYMessage): ResizeSessionTTYMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ResizeSessionTTYMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ResizeSessionTTYMessage;
|
||||
static deserializeBinaryFromReader(message: ResizeSessionTTYMessage, reader: jspb.BinaryReader): ResizeSessionTTYMessage;
|
||||
}
|
||||
|
||||
export namespace ResizeSessionTTYMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
ttyDimensions?: TTYDimensions.AsObject,
|
||||
}
|
||||
}
|
||||
|
||||
export class CloseSessionInputMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): CloseSessionInputMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: CloseSessionInputMessage): CloseSessionInputMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: CloseSessionInputMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): CloseSessionInputMessage;
|
||||
static deserializeBinaryFromReader(message: CloseSessionInputMessage, reader: jspb.BinaryReader): CloseSessionInputMessage;
|
||||
}
|
||||
|
||||
export namespace CloseSessionInputMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class ShutdownSessionMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getSignal(): string;
|
||||
setSignal(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): ShutdownSessionMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: ShutdownSessionMessage): ShutdownSessionMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: ShutdownSessionMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): ShutdownSessionMessage;
|
||||
static deserializeBinaryFromReader(message: ShutdownSessionMessage, reader: jspb.BinaryReader): ShutdownSessionMessage;
|
||||
}
|
||||
|
||||
export namespace ShutdownSessionMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
signal: string,
|
||||
}
|
||||
}
|
||||
|
||||
export class SessionOutputMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getFd(): SessionOutputMessage.FD;
|
||||
setFd(value: SessionOutputMessage.FD): void;
|
||||
|
||||
getData(): Uint8Array | string;
|
||||
getData_asU8(): Uint8Array;
|
||||
getData_asB64(): string;
|
||||
setData(value: Uint8Array | string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): SessionOutputMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: SessionOutputMessage): SessionOutputMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: SessionOutputMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): SessionOutputMessage;
|
||||
static deserializeBinaryFromReader(message: SessionOutputMessage, reader: jspb.BinaryReader): SessionOutputMessage;
|
||||
}
|
||||
|
||||
export namespace SessionOutputMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
fd: SessionOutputMessage.FD,
|
||||
data: Uint8Array | string,
|
||||
}
|
||||
|
||||
export enum FD {
|
||||
STDOUT = 0,
|
||||
STDERR = 1,
|
||||
}
|
||||
}
|
||||
|
||||
export class TTYDimensions extends jspb.Message {
|
||||
getHeight(): number;
|
||||
setHeight(value: number): void;
|
||||
|
||||
getWidth(): number;
|
||||
setWidth(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): TTYDimensions.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: TTYDimensions): TTYDimensions.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: TTYDimensions, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): TTYDimensions;
|
||||
static deserializeBinaryFromReader(message: TTYDimensions, reader: jspb.BinaryReader): TTYDimensions;
|
||||
}
|
||||
|
||||
export namespace TTYDimensions {
|
||||
export type AsObject = {
|
||||
height: number,
|
||||
width: number,
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
export * from "./client_pb";
|
||||
export * from "./command_pb";
|
||||
export * from "./node_pb";
|
@ -1,36 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message TypedValue {
|
||||
enum Type {
|
||||
String = 0;
|
||||
Number = 1;
|
||||
Object = 2;
|
||||
Boolean = 3;
|
||||
}
|
||||
Type type = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message NewEvalMessage {
|
||||
uint64 id = 1;
|
||||
string function = 2;
|
||||
repeated string args = 3;
|
||||
// Timeout in ms
|
||||
uint32 timeout = 4;
|
||||
}
|
||||
|
||||
message EvalFailedMessage {
|
||||
uint64 id = 1;
|
||||
enum Reason {
|
||||
Timeout = 0;
|
||||
Exception = 1;
|
||||
Conflict = 2;
|
||||
}
|
||||
Reason reason = 2;
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
message EvalDoneMessage {
|
||||
uint64 id = 1;
|
||||
TypedValue response = 2;
|
||||
}
|
130
packages/server/src/proto/node_pb.d.ts
vendored
130
packages/server/src/proto/node_pb.d.ts
vendored
@ -1,130 +0,0 @@
|
||||
// package:
|
||||
// file: node.proto
|
||||
|
||||
import * as jspb from "google-protobuf";
|
||||
|
||||
export class TypedValue extends jspb.Message {
|
||||
getType(): TypedValue.Type;
|
||||
setType(value: TypedValue.Type): void;
|
||||
|
||||
getValue(): string;
|
||||
setValue(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): TypedValue.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: TypedValue): TypedValue.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: TypedValue, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): TypedValue;
|
||||
static deserializeBinaryFromReader(message: TypedValue, reader: jspb.BinaryReader): TypedValue;
|
||||
}
|
||||
|
||||
export namespace TypedValue {
|
||||
export type AsObject = {
|
||||
type: TypedValue.Type,
|
||||
value: string,
|
||||
}
|
||||
|
||||
export enum Type {
|
||||
STRING = 0,
|
||||
NUMBER = 1,
|
||||
OBJECT = 2,
|
||||
BOOLEAN = 3,
|
||||
}
|
||||
}
|
||||
|
||||
export class NewEvalMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getFunction(): string;
|
||||
setFunction(value: string): void;
|
||||
|
||||
clearArgsList(): void;
|
||||
getArgsList(): Array<string>;
|
||||
setArgsList(value: Array<string>): void;
|
||||
addArgs(value: string, index?: number): string;
|
||||
|
||||
getTimeout(): number;
|
||||
setTimeout(value: number): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): NewEvalMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: NewEvalMessage): NewEvalMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: NewEvalMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): NewEvalMessage;
|
||||
static deserializeBinaryFromReader(message: NewEvalMessage, reader: jspb.BinaryReader): NewEvalMessage;
|
||||
}
|
||||
|
||||
export namespace NewEvalMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
pb_function: string,
|
||||
argsList: Array<string>,
|
||||
timeout: number,
|
||||
}
|
||||
}
|
||||
|
||||
export class EvalFailedMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
getReason(): EvalFailedMessage.Reason;
|
||||
setReason(value: EvalFailedMessage.Reason): void;
|
||||
|
||||
getMessage(): string;
|
||||
setMessage(value: string): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): EvalFailedMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: EvalFailedMessage): EvalFailedMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: EvalFailedMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): EvalFailedMessage;
|
||||
static deserializeBinaryFromReader(message: EvalFailedMessage, reader: jspb.BinaryReader): EvalFailedMessage;
|
||||
}
|
||||
|
||||
export namespace EvalFailedMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
reason: EvalFailedMessage.Reason,
|
||||
message: string,
|
||||
}
|
||||
|
||||
export enum Reason {
|
||||
TIMEOUT = 0,
|
||||
EXCEPTION = 1,
|
||||
CONFLICT = 2,
|
||||
}
|
||||
}
|
||||
|
||||
export class EvalDoneMessage extends jspb.Message {
|
||||
getId(): number;
|
||||
setId(value: number): void;
|
||||
|
||||
hasResponse(): boolean;
|
||||
clearResponse(): void;
|
||||
getResponse(): TypedValue | undefined;
|
||||
setResponse(value?: TypedValue): void;
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): EvalDoneMessage.AsObject;
|
||||
static toObject(includeInstance: boolean, msg: EvalDoneMessage): EvalDoneMessage.AsObject;
|
||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||
static serializeBinaryToWriter(message: EvalDoneMessage, writer: jspb.BinaryWriter): void;
|
||||
static deserializeBinary(bytes: Uint8Array): EvalDoneMessage;
|
||||
static deserializeBinaryFromReader(message: EvalDoneMessage, reader: jspb.BinaryReader): EvalDoneMessage;
|
||||
}
|
||||
|
||||
export namespace EvalDoneMessage {
|
||||
export type AsObject = {
|
||||
id: number,
|
||||
response?: TypedValue.AsObject,
|
||||
}
|
||||
}
|
||||
|
@ -1,894 +0,0 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* @enhanceable
|
||||
* @public
|
||||
*/
|
||||
// GENERATED CODE -- DO NOT EDIT!
|
||||
|
||||
var jspb = require('google-protobuf');
|
||||
var goog = jspb;
|
||||
var global = Function('return this')();
|
||||
|
||||
goog.exportSymbol('proto.EvalDoneMessage', null, global);
|
||||
goog.exportSymbol('proto.EvalFailedMessage', null, global);
|
||||
goog.exportSymbol('proto.EvalFailedMessage.Reason', null, global);
|
||||
goog.exportSymbol('proto.NewEvalMessage', null, global);
|
||||
goog.exportSymbol('proto.TypedValue', null, global);
|
||||
goog.exportSymbol('proto.TypedValue.Type', null, global);
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.TypedValue = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
||||
};
|
||||
goog.inherits(proto.TypedValue, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
proto.TypedValue.displayName = 'proto.TypedValue';
|
||||
}
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto suitable for use in Soy templates.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.TypedValue.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.TypedValue.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB
|
||||
* instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.TypedValue} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.TypedValue.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
type: msg.getType(),
|
||||
value: msg.getValue()
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.TypedValue}
|
||||
*/
|
||||
proto.TypedValue.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.TypedValue;
|
||||
return proto.TypedValue.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.TypedValue} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.TypedValue}
|
||||
*/
|
||||
proto.TypedValue.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {!proto.TypedValue.Type} */ (reader.readEnum());
|
||||
msg.setType(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setValue(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class method variant: serializes the given message to binary data
|
||||
* (in protobuf wire format), writing to the given BinaryWriter.
|
||||
* @param {!proto.TypedValue} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.TypedValue.serializeBinaryToWriter = function(message, writer) {
|
||||
message.serializeBinaryToWriter(writer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.TypedValue.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
this.serializeBinaryToWriter(writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format),
|
||||
* writing to the given BinaryWriter.
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.TypedValue.prototype.serializeBinaryToWriter = function (writer) {
|
||||
var f = undefined;
|
||||
f = this.getType();
|
||||
if (f !== 0.0) {
|
||||
writer.writeEnum(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getValue();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a deep clone of this proto. No data is shared with the original.
|
||||
* @return {!proto.TypedValue} The clone.
|
||||
*/
|
||||
proto.TypedValue.prototype.cloneMessage = function() {
|
||||
return /** @type {!proto.TypedValue} */ (jspb.Message.cloneMessage(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional Type type = 1;
|
||||
* @return {!proto.TypedValue.Type}
|
||||
*/
|
||||
proto.TypedValue.prototype.getType = function() {
|
||||
return /** @type {!proto.TypedValue.Type} */ (jspb.Message.getFieldProto3(this, 1, 0));
|
||||
};
|
||||
|
||||
|
||||
/** @param {!proto.TypedValue.Type} value */
|
||||
proto.TypedValue.prototype.setType = function(value) {
|
||||
jspb.Message.setField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string value = 2;
|
||||
* @return {string}
|
||||
*/
|
||||
proto.TypedValue.prototype.getValue = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, ""));
|
||||
};
|
||||
|
||||
|
||||
/** @param {string} value */
|
||||
proto.TypedValue.prototype.setValue = function(value) {
|
||||
jspb.Message.setField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
proto.TypedValue.Type = {
|
||||
STRING: 0,
|
||||
NUMBER: 1,
|
||||
OBJECT: 2,
|
||||
BOOLEAN: 3
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.NewEvalMessage = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, proto.NewEvalMessage.repeatedFields_, null);
|
||||
};
|
||||
goog.inherits(proto.NewEvalMessage, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
proto.NewEvalMessage.displayName = 'proto.NewEvalMessage';
|
||||
}
|
||||
/**
|
||||
* List of repeated fields within this message type.
|
||||
* @private {!Array<number>}
|
||||
* @const
|
||||
*/
|
||||
proto.NewEvalMessage.repeatedFields_ = [3];
|
||||
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto suitable for use in Soy templates.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.NewEvalMessage.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB
|
||||
* instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.NewEvalMessage} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.NewEvalMessage.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
id: msg.getId(),
|
||||
pb_function: msg.getFunction(),
|
||||
argsList: jspb.Message.getField(msg, 3),
|
||||
timeout: msg.getTimeout()
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.NewEvalMessage}
|
||||
*/
|
||||
proto.NewEvalMessage.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.NewEvalMessage;
|
||||
return proto.NewEvalMessage.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.NewEvalMessage} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.NewEvalMessage}
|
||||
*/
|
||||
proto.NewEvalMessage.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setId(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setFunction(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.getArgsList().push(value);
|
||||
msg.setArgsList(msg.getArgsList());
|
||||
break;
|
||||
case 4:
|
||||
var value = /** @type {number} */ (reader.readUint32());
|
||||
msg.setTimeout(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class method variant: serializes the given message to binary data
|
||||
* (in protobuf wire format), writing to the given BinaryWriter.
|
||||
* @param {!proto.NewEvalMessage} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.NewEvalMessage.serializeBinaryToWriter = function(message, writer) {
|
||||
message.serializeBinaryToWriter(writer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
this.serializeBinaryToWriter(writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format),
|
||||
* writing to the given BinaryWriter.
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.serializeBinaryToWriter = function (writer) {
|
||||
var f = undefined;
|
||||
f = this.getId();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getFunction();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getArgsList();
|
||||
if (f.length > 0) {
|
||||
writer.writeRepeatedString(
|
||||
3,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getTimeout();
|
||||
if (f !== 0) {
|
||||
writer.writeUint32(
|
||||
4,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a deep clone of this proto. No data is shared with the original.
|
||||
* @return {!proto.NewEvalMessage} The clone.
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.cloneMessage = function() {
|
||||
return /** @type {!proto.NewEvalMessage} */ (jspb.Message.cloneMessage(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 id = 1;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.getId = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
|
||||
};
|
||||
|
||||
|
||||
/** @param {number} value */
|
||||
proto.NewEvalMessage.prototype.setId = function(value) {
|
||||
jspb.Message.setField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string function = 2;
|
||||
* @return {string}
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.getFunction = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, ""));
|
||||
};
|
||||
|
||||
|
||||
/** @param {string} value */
|
||||
proto.NewEvalMessage.prototype.setFunction = function(value) {
|
||||
jspb.Message.setField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* repeated string args = 3;
|
||||
* If you change this array by adding, removing or replacing elements, or if you
|
||||
* replace the array itself, then you must call the setter to update it.
|
||||
* @return {!Array.<string>}
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.getArgsList = function() {
|
||||
return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 3));
|
||||
};
|
||||
|
||||
|
||||
/** @param {Array.<string>} value */
|
||||
proto.NewEvalMessage.prototype.setArgsList = function(value) {
|
||||
jspb.Message.setField(this, 3, value || []);
|
||||
};
|
||||
|
||||
|
||||
proto.NewEvalMessage.prototype.clearArgsList = function() {
|
||||
jspb.Message.setField(this, 3, []);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint32 timeout = 4;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.NewEvalMessage.prototype.getTimeout = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 4, 0));
|
||||
};
|
||||
|
||||
|
||||
/** @param {number} value */
|
||||
proto.NewEvalMessage.prototype.setTimeout = function(value) {
|
||||
jspb.Message.setField(this, 4, value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.EvalFailedMessage = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
||||
};
|
||||
goog.inherits(proto.EvalFailedMessage, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
proto.EvalFailedMessage.displayName = 'proto.EvalFailedMessage';
|
||||
}
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto suitable for use in Soy templates.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.EvalFailedMessage.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB
|
||||
* instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.EvalFailedMessage} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.EvalFailedMessage.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
id: msg.getId(),
|
||||
reason: msg.getReason(),
|
||||
message: msg.getMessage()
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.EvalFailedMessage}
|
||||
*/
|
||||
proto.EvalFailedMessage.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.EvalFailedMessage;
|
||||
return proto.EvalFailedMessage.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.EvalFailedMessage} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.EvalFailedMessage}
|
||||
*/
|
||||
proto.EvalFailedMessage.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setId(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {!proto.EvalFailedMessage.Reason} */ (reader.readEnum());
|
||||
msg.setReason(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.setMessage(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class method variant: serializes the given message to binary data
|
||||
* (in protobuf wire format), writing to the given BinaryWriter.
|
||||
* @param {!proto.EvalFailedMessage} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.EvalFailedMessage.serializeBinaryToWriter = function(message, writer) {
|
||||
message.serializeBinaryToWriter(writer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
this.serializeBinaryToWriter(writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format),
|
||||
* writing to the given BinaryWriter.
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.serializeBinaryToWriter = function (writer) {
|
||||
var f = undefined;
|
||||
f = this.getId();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getReason();
|
||||
if (f !== 0.0) {
|
||||
writer.writeEnum(
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getMessage();
|
||||
if (f.length > 0) {
|
||||
writer.writeString(
|
||||
3,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a deep clone of this proto. No data is shared with the original.
|
||||
* @return {!proto.EvalFailedMessage} The clone.
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.cloneMessage = function() {
|
||||
return /** @type {!proto.EvalFailedMessage} */ (jspb.Message.cloneMessage(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 id = 1;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.getId = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
|
||||
};
|
||||
|
||||
|
||||
/** @param {number} value */
|
||||
proto.EvalFailedMessage.prototype.setId = function(value) {
|
||||
jspb.Message.setField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional Reason reason = 2;
|
||||
* @return {!proto.EvalFailedMessage.Reason}
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.getReason = function() {
|
||||
return /** @type {!proto.EvalFailedMessage.Reason} */ (jspb.Message.getFieldProto3(this, 2, 0));
|
||||
};
|
||||
|
||||
|
||||
/** @param {!proto.EvalFailedMessage.Reason} value */
|
||||
proto.EvalFailedMessage.prototype.setReason = function(value) {
|
||||
jspb.Message.setField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional string message = 3;
|
||||
* @return {string}
|
||||
*/
|
||||
proto.EvalFailedMessage.prototype.getMessage = function() {
|
||||
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 3, ""));
|
||||
};
|
||||
|
||||
|
||||
/** @param {string} value */
|
||||
proto.EvalFailedMessage.prototype.setMessage = function(value) {
|
||||
jspb.Message.setField(this, 3, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
proto.EvalFailedMessage.Reason = {
|
||||
TIMEOUT: 0,
|
||||
EXCEPTION: 1,
|
||||
CONFLICT: 2
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generated by JsPbCodeGenerator.
|
||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
||||
* server response, or constructed directly in Javascript. The array is used
|
||||
* in place and becomes part of the constructed object. It is not cloned.
|
||||
* If no data is provided, the constructed object will be empty, but still
|
||||
* valid.
|
||||
* @extends {jspb.Message}
|
||||
* @constructor
|
||||
*/
|
||||
proto.EvalDoneMessage = function(opt_data) {
|
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
||||
};
|
||||
goog.inherits(proto.EvalDoneMessage, jspb.Message);
|
||||
if (goog.DEBUG && !COMPILED) {
|
||||
proto.EvalDoneMessage.displayName = 'proto.EvalDoneMessage';
|
||||
}
|
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
||||
/**
|
||||
* Creates an object representation of this proto suitable for use in Soy templates.
|
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
||||
* For the list of reserved names please see:
|
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
|
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
|
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.toObject = function(opt_includeInstance) {
|
||||
return proto.EvalDoneMessage.toObject(opt_includeInstance, this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static version of the {@see toObject} method.
|
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB
|
||||
* instance for transitional soy proto support:
|
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.EvalDoneMessage} msg The msg instance to transform.
|
||||
* @return {!Object}
|
||||
*/
|
||||
proto.EvalDoneMessage.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
id: msg.getId(),
|
||||
response: (f = msg.getResponse()) && proto.TypedValue.toObject(includeInstance, f)
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
obj.$jspbMessageInstance = msg;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format).
|
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
||||
* @return {!proto.EvalDoneMessage}
|
||||
*/
|
||||
proto.EvalDoneMessage.deserializeBinary = function(bytes) {
|
||||
var reader = new jspb.BinaryReader(bytes);
|
||||
var msg = new proto.EvalDoneMessage;
|
||||
return proto.EvalDoneMessage.deserializeBinaryFromReader(msg, reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes binary data (in protobuf wire format) from the
|
||||
* given reader into the given message object.
|
||||
* @param {!proto.EvalDoneMessage} msg The message object to deserialize into.
|
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
||||
* @return {!proto.EvalDoneMessage}
|
||||
*/
|
||||
proto.EvalDoneMessage.deserializeBinaryFromReader = function(msg, reader) {
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
break;
|
||||
}
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
msg.setId(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = new proto.TypedValue;
|
||||
reader.readMessage(value,proto.TypedValue.deserializeBinaryFromReader);
|
||||
msg.setResponse(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class method variant: serializes the given message to binary data
|
||||
* (in protobuf wire format), writing to the given BinaryWriter.
|
||||
* @param {!proto.EvalDoneMessage} message
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.EvalDoneMessage.serializeBinaryToWriter = function(message, writer) {
|
||||
message.serializeBinaryToWriter(writer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format).
|
||||
* @return {!Uint8Array}
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.serializeBinary = function() {
|
||||
var writer = new jspb.BinaryWriter();
|
||||
this.serializeBinaryToWriter(writer);
|
||||
return writer.getResultBuffer();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the message to binary data (in protobuf wire format),
|
||||
* writing to the given BinaryWriter.
|
||||
* @param {!jspb.BinaryWriter} writer
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.serializeBinaryToWriter = function (writer) {
|
||||
var f = undefined;
|
||||
f = this.getId();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = this.getResponse();
|
||||
if (f != null) {
|
||||
writer.writeMessage(
|
||||
2,
|
||||
f,
|
||||
proto.TypedValue.serializeBinaryToWriter
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a deep clone of this proto. No data is shared with the original.
|
||||
* @return {!proto.EvalDoneMessage} The clone.
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.cloneMessage = function() {
|
||||
return /** @type {!proto.EvalDoneMessage} */ (jspb.Message.cloneMessage(this));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 id = 1;
|
||||
* @return {number}
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.getId = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
|
||||
};
|
||||
|
||||
|
||||
/** @param {number} value */
|
||||
proto.EvalDoneMessage.prototype.setId = function(value) {
|
||||
jspb.Message.setField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional TypedValue response = 2;
|
||||
* @return {proto.TypedValue}
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.getResponse = function() {
|
||||
return /** @type{proto.TypedValue} */ (
|
||||
jspb.Message.getWrapperField(this, proto.TypedValue, 2));
|
||||
};
|
||||
|
||||
|
||||
/** @param {proto.TypedValue|undefined} value */
|
||||
proto.EvalDoneMessage.prototype.setResponse = function(value) {
|
||||
jspb.Message.setWrapperField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
proto.EvalDoneMessage.prototype.clearResponse = function() {
|
||||
this.setResponse(undefined);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this field is set.
|
||||
* @return{!boolean}
|
||||
*/
|
||||
proto.EvalDoneMessage.prototype.hasResponse = function() {
|
||||
return jspb.Message.getField(this, 2) != null;
|
||||
};
|
||||
|
||||
|
||||
goog.object.extend(exports, proto);
|
Reference in New Issue
Block a user