From cff746db32ba2e2cbc66bf7a9d4388f38a7cd755 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 11 Jan 2019 13:33:44 -0600 Subject: [PATCH] Add evaluate --- packages/disposable/src/index.ts | 1 + packages/events/src/events.ts | 60 + packages/events/src/index.ts | 1 + packages/package.json | 4 +- packages/server/package.json | 12 + packages/server/scripts/generate_proto.sh | 3 + packages/server/src/browser/client.ts | 105 ++ packages/server/src/common/connection.ts | 9 + packages/server/src/node/evaluate.ts | 65 + packages/server/src/node/server.ts | 26 + packages/server/src/proto/client.proto | 31 + packages/server/src/proto/client_pb.d.ts | 126 ++ packages/server/src/proto/client_pb.js | 823 ++++++++ packages/server/src/proto/command.proto | 75 + packages/server/src/proto/command_pb.d.ts | 276 +++ packages/server/src/proto/command_pb.js | 2075 +++++++++++++++++++++ packages/server/src/proto/index.ts | 3 + packages/server/src/proto/node.proto | 36 + packages/server/src/proto/node_pb.d.ts | 130 ++ packages/server/src/proto/node_pb.js | 894 +++++++++ packages/server/test/evaluate.test.ts | 39 + packages/server/test/helpers.ts | 28 + packages/server/yarn.lock | 437 +++++ 23 files changed, 5257 insertions(+), 2 deletions(-) create mode 100644 packages/disposable/src/index.ts create mode 100644 packages/events/src/events.ts create mode 100644 packages/events/src/index.ts create mode 100644 packages/server/package.json create mode 100644 packages/server/scripts/generate_proto.sh create mode 100644 packages/server/src/browser/client.ts create mode 100644 packages/server/src/common/connection.ts create mode 100644 packages/server/src/node/evaluate.ts create mode 100644 packages/server/src/node/server.ts create mode 100644 packages/server/src/proto/client.proto create mode 100644 packages/server/src/proto/client_pb.d.ts create mode 100644 packages/server/src/proto/client_pb.js create mode 100644 packages/server/src/proto/command.proto create mode 100644 packages/server/src/proto/command_pb.d.ts create mode 100644 packages/server/src/proto/command_pb.js create mode 100644 packages/server/src/proto/index.ts create mode 100644 packages/server/src/proto/node.proto create mode 100644 packages/server/src/proto/node_pb.d.ts create mode 100644 packages/server/src/proto/node_pb.js create mode 100644 packages/server/test/evaluate.test.ts create mode 100644 packages/server/test/helpers.ts create mode 100644 packages/server/yarn.lock diff --git a/packages/disposable/src/index.ts b/packages/disposable/src/index.ts new file mode 100644 index 000000000..8991adf47 --- /dev/null +++ b/packages/disposable/src/index.ts @@ -0,0 +1 @@ +export * from "./disposable"; diff --git a/packages/events/src/events.ts b/packages/events/src/events.ts new file mode 100644 index 000000000..51990272c --- /dev/null +++ b/packages/events/src/events.ts @@ -0,0 +1,60 @@ +import { IDisposable } from "@coder/disposable"; + +export interface Event { + (listener: (e: T) => void): IDisposable; +} + +/** + * Emitter typecasts for a single event type + */ +export class Emitter { + + private listeners: Array<(e: T) => void> | undefined; + + public constructor() { + this.listeners = []; + } + + public get event(): Event { + return (cb: (e: T) => void): IDisposable => { + if (this.listeners) { + this.listeners.push(cb); + } + + return { + dispose: (): void => { + if (this.listeners) { + const i = this.listeners.indexOf(cb); + if (i !== -1) { + this.listeners.splice(i, 1); + } + } + }, + }; + }; + } + + /** + * Emit a value + */ + public emit(value: T): void { + if (this.listeners) { + this.listeners.forEach((t) => t(value)); + } + } + + /** + * Disposes the event emitter + */ + public dispose(): void { + this.listeners = undefined; + } + + /** + * Whether the event has listeners. + */ + public get hasListeners(): boolean { + return !!this.listeners && this.listeners.length > 0; + } + +} \ No newline at end of file diff --git a/packages/events/src/index.ts b/packages/events/src/index.ts new file mode 100644 index 000000000..1784004f0 --- /dev/null +++ b/packages/events/src/index.ts @@ -0,0 +1 @@ +export * from "./events"; diff --git a/packages/package.json b/packages/package.json index 1f6395d62..c39593679 100644 --- a/packages/package.json +++ b/packages/package.json @@ -27,8 +27,8 @@ ], "moduleNameMapper": { "^.+\\.(s?css|png|svg)$": "/scripts/src/dummy.js", - "@coder/(.*)/testing": "/packages/$1/testing", - "@coder/(.*)": "/packages/$1/src" + "@coder/(.*)/testing": "/$1/testing", + "@coder/(.*)": "/$1/src" }, "transform": { "^.+\\.tsx?$": "ts-jest" diff --git a/packages/server/package.json b/packages/server/package.json new file mode 100644 index 000000000..1e732a1c3 --- /dev/null +++ b/packages/server/package.json @@ -0,0 +1,12 @@ +{ + "name": "server", + "dependencies": { + "express": "^4.16.4", + "ws": "^6.1.2" + }, + "devDependencies": { + "@types/express": "^4.16.0", + "@types/ws": "^6.0.1", + "ts-protoc-gen": "^0.8.0" + } +} diff --git a/packages/server/scripts/generate_proto.sh b/packages/server/scripts/generate_proto.sh new file mode 100644 index 000000000..fa014b0f6 --- /dev/null +++ b/packages/server/scripts/generate_proto.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +protoc --plugin="protoc-gen-ts=./node_modules/.bin/protoc-gen-ts" --js_out="import_style=commonjs,binary:./src/proto" --ts_out="./src/proto" ./src/proto/*.proto --proto_path="./src/proto" \ No newline at end of file diff --git a/packages/server/src/browser/client.ts b/packages/server/src/browser/client.ts new file mode 100644 index 000000000..99f5ec99e --- /dev/null +++ b/packages/server/src/browser/client.ts @@ -0,0 +1,105 @@ +import { ReadWriteConnection } from "../common/connection"; +import { NewEvalMessage, ServerMessage, EvalDoneMessage, EvalFailedMessage, TypedValue, ClientMessage } from "../proto"; +import { Emitter } from "@coder/events"; +import { logger, field } from "@coder/logger"; + + +export class Client { + + private evalId: number = 0; + private evalDoneEmitter: Emitter = new Emitter(); + private evalFailedEmitter: Emitter = new Emitter(); + + 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(func: () => R): Promise; + public evaluate(func: (a1: T1) => R, a1: T1): Promise; + public evaluate(func: (a1: T1, a2: T2) => R, a1: T1, a2: T2): Promise; + public evaluate(func: (a1: T1, a2: T2, a3: T3) => R, a1: T1, a2: T2, a3: T3): Promise; + public evaluate(func: (a1: T1, a2: T2, a3: T3, a4: T4) => R, a1: T1, a2: T2, a3: T3, a4: T4): Promise; + public evaluate(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => R, a1: T1, a2: T2, a3: T3, a4: T4, a5: T5): Promise; + public evaluate(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; + public evaluate(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 { + 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, 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; + } + + private handleMessage(message: ServerMessage): void { + if (message.hasEvalDone()) { + this.evalDoneEmitter.emit(message.getEvalDone()!); + } else if (message.hasEvalFailed()) { + this.evalFailedEmitter.emit(message.getEvalFailed()!); + } + } + +} diff --git a/packages/server/src/common/connection.ts b/packages/server/src/common/connection.ts new file mode 100644 index 000000000..7e84ed45a --- /dev/null +++ b/packages/server/src/common/connection.ts @@ -0,0 +1,9 @@ +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; +} diff --git a/packages/server/src/node/evaluate.ts b/packages/server/src/node/evaluate.ts new file mode 100644 index 000000000..73de9cb19 --- /dev/null +++ b/packages/server/src/node/evaluate.ts @@ -0,0 +1,65 @@ +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 => { + 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 }, { + timeout: message.getTimeout() || 30000, + }); + let responder: any = value; + if (value instanceof Promise) { + responder = await value; + } + sendResp(responder); + } catch (ex) { + sendErr(EvalFailedMessage.Reason.EXCEPTION, ex.toString()); + } +}; \ No newline at end of file diff --git a/packages/server/src/node/server.ts b/packages/server/src/node/server.ts new file mode 100644 index 000000000..6d6762617 --- /dev/null +++ b/packages/server/src/node/server.ts @@ -0,0 +1,26 @@ +import { logger, field } from "@coder/logger"; +import { ClientMessage } from "../proto"; +import { evaluate } from "./evaluate"; +import { ReadWriteConnection } from "../common/connection"; + +export class Server { + + public constructor( + private readonly connection: ReadWriteConnection, + ) { + 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()!); + } + } + +} \ No newline at end of file diff --git a/packages/server/src/proto/client.proto b/packages/server/src/proto/client.proto new file mode 100644 index 000000000..27f4671a4 --- /dev/null +++ b/packages/server/src/proto/client.proto @@ -0,0 +1,31 @@ +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; + + // node.proto + EvalFailedMessage eval_failed = 4; + EvalDoneMessage eval_done = 5; + } +} \ No newline at end of file diff --git a/packages/server/src/proto/client_pb.d.ts b/packages/server/src/proto/client_pb.d.ts new file mode 100644 index 000000000..206850259 --- /dev/null +++ b/packages/server/src/proto/client_pb.d.ts @@ -0,0 +1,126 @@ +// 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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; + + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + 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, + EVAL_FAILED = 4, + EVAL_DONE = 5, + } +} + diff --git a/packages/server/src/proto/client_pb.js b/packages/server/src/proto/client_pb.js new file mode 100644 index 000000000..4eb515f00 --- /dev/null +++ b/packages/server/src/proto/client_pb.js @@ -0,0 +1,823 @@ +/** + * @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>} + * @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_, 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>} + * @const + */ +proto.ServerMessage.oneofGroups_ = [[1,2,3,4,5]]; + +/** + * @enum {number} + */ +proto.ServerMessage.MsgCase = { + MSG_NOT_SET: 0, + NEW_SESSION_FAILURE: 1, + SESSION_DONE: 2, + SESSION_OUTPUT: 3, + EVAL_FAILED: 4, + EVAL_DONE: 5 +}; + +/** + * @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_, 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), + 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 node_pb.EvalFailedMessage; + reader.readMessage(value,node_pb.EvalFailedMessage.deserializeBinaryFromReader); + msg.setEvalFailed(value); + break; + case 5: + 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.getEvalFailed(); + if (f != null) { + writer.writeMessage( + 4, + f, + node_pb.EvalFailedMessage.serializeBinaryToWriter + ); + } + f = this.getEvalDone(); + if (f != null) { + writer.writeMessage( + 5, + 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 EvalFailedMessage eval_failed = 4; + * @return {proto.EvalFailedMessage} + */ +proto.ServerMessage.prototype.getEvalFailed = function() { + return /** @type{proto.EvalFailedMessage} */ ( + jspb.Message.getWrapperField(this, node_pb.EvalFailedMessage, 4)); +}; + + +/** @param {proto.EvalFailedMessage|undefined} value */ +proto.ServerMessage.prototype.setEvalFailed = function(value) { + jspb.Message.setOneofWrapperField(this, 4, 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, 4) != null; +}; + + +/** + * optional EvalDoneMessage eval_done = 5; + * @return {proto.EvalDoneMessage} + */ +proto.ServerMessage.prototype.getEvalDone = function() { + return /** @type{proto.EvalDoneMessage} */ ( + jspb.Message.getWrapperField(this, node_pb.EvalDoneMessage, 5)); +}; + + +/** @param {proto.EvalDoneMessage|undefined} value */ +proto.ServerMessage.prototype.setEvalDone = function(value) { + jspb.Message.setOneofWrapperField(this, 5, 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, 5) != null; +}; + + +goog.object.extend(exports, proto); diff --git a/packages/server/src/proto/command.proto b/packages/server/src/proto/command.proto new file mode 100644 index 000000000..f7f744aed --- /dev/null +++ b/packages/server/src/proto/command.proto @@ -0,0 +1,75 @@ +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 env = 4; + TTYDimensions tty_dimensions = 5; +} + +// 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; +} + +// 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; +} \ No newline at end of file diff --git a/packages/server/src/proto/command_pb.d.ts b/packages/server/src/proto/command_pb.d.ts new file mode 100644 index 000000000..0f459ac05 --- /dev/null +++ b/packages/server/src/proto/command_pb.d.ts @@ -0,0 +1,276 @@ +// 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; + setArgsList(value: Array): void; + addArgs(value: string, index?: number): string; + + getEnvMap(): jspb.Map; + clearEnvMap(): void; + hasTtyDimensions(): boolean; + clearTtyDimensions(): void; + getTtyDimensions(): TTYDimensions | undefined; + setTtyDimensions(value?: TTYDimensions): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NewSessionMessage.AsObject; + static toObject(includeInstance: boolean, msg: NewSessionMessage): NewSessionMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + envMap: Array<[string, string]>, + ttyDimensions?: TTYDimensions.AsObject, + } +} + +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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ShutdownSessionMessage.AsObject; + static toObject(includeInstance: boolean, msg: ShutdownSessionMessage): ShutdownSessionMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + } +} + +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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + } +} + diff --git a/packages/server/src/proto/command_pb.js b/packages/server/src/proto/command_pb.js new file mode 100644 index 000000000..95364861b --- /dev/null +++ b/packages/server/src/proto/command_pb.js @@ -0,0 +1,2075 @@ +/** + * @fileoverview + * @enhanceable + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.CloseSessionInputMessage', null, global); +goog.exportSymbol('proto.IdentifySessionMessage', null, global); +goog.exportSymbol('proto.NewSessionFailureMessage', null, global); +goog.exportSymbol('proto.NewSessionFailureMessage.Reason', null, global); +goog.exportSymbol('proto.NewSessionMessage', null, global); +goog.exportSymbol('proto.ResizeSessionTTYMessage', null, global); +goog.exportSymbol('proto.SessionDoneMessage', null, global); +goog.exportSymbol('proto.SessionOutputMessage', null, global); +goog.exportSymbol('proto.SessionOutputMessage.FD', null, global); +goog.exportSymbol('proto.ShutdownSessionMessage', null, global); +goog.exportSymbol('proto.TTYDimensions', null, global); +goog.exportSymbol('proto.WriteToSessionMessage', 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.NewSessionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.NewSessionMessage.repeatedFields_, null); +}; +goog.inherits(proto.NewSessionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.NewSessionMessage.displayName = 'proto.NewSessionMessage'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.NewSessionMessage.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_, 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.NewSessionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.NewSessionMessage.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.NewSessionMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.NewSessionMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + command: msg.getCommand(), + argsList: jspb.Message.getField(msg, 3), + envMap: (f = msg.getEnvMap(true)) ? f.toArray() : [], + ttyDimensions: (f = msg.getTtyDimensions()) && proto.TTYDimensions.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.NewSessionMessage} + */ +proto.NewSessionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.NewSessionMessage; + return proto.NewSessionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.NewSessionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.NewSessionMessage} + */ +proto.NewSessionMessage.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.setCommand(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.getArgsList().push(value); + msg.setArgsList(msg.getArgsList()); + break; + case 4: + var value = msg.getEnvMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString); + }); + break; + case 5: + var value = new proto.TTYDimensions; + reader.readMessage(value,proto.TTYDimensions.deserializeBinaryFromReader); + msg.setTtyDimensions(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.NewSessionMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.NewSessionMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.NewSessionMessage.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.NewSessionMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = this.getCommand(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = this.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 3, + f + ); + } + f = this.getEnvMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } + f = this.getTtyDimensions(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.TTYDimensions.serializeBinaryToWriter + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.NewSessionMessage} The clone. + */ +proto.NewSessionMessage.prototype.cloneMessage = function() { + return /** @type {!proto.NewSessionMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.NewSessionMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.NewSessionMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional string command = 2; + * @return {string} + */ +proto.NewSessionMessage.prototype.getCommand = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, "")); +}; + + +/** @param {string} value */ +proto.NewSessionMessage.prototype.setCommand = 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.} + */ +proto.NewSessionMessage.prototype.getArgsList = function() { + return /** @type {!Array.} */ (jspb.Message.getField(this, 3)); +}; + + +/** @param {Array.} value */ +proto.NewSessionMessage.prototype.setArgsList = function(value) { + jspb.Message.setField(this, 3, value || []); +}; + + +proto.NewSessionMessage.prototype.clearArgsList = function() { + jspb.Message.setField(this, 3, []); +}; + + +/** + * map env = 4; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.NewSessionMessage.prototype.getEnvMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 4, opt_noLazyCreate, + null)); +}; + + +/** + * optional TTYDimensions tty_dimensions = 5; + * @return {proto.TTYDimensions} + */ +proto.NewSessionMessage.prototype.getTtyDimensions = function() { + return /** @type{proto.TTYDimensions} */ ( + jspb.Message.getWrapperField(this, proto.TTYDimensions, 5)); +}; + + +/** @param {proto.TTYDimensions|undefined} value */ +proto.NewSessionMessage.prototype.setTtyDimensions = function(value) { + jspb.Message.setWrapperField(this, 5, value); +}; + + +proto.NewSessionMessage.prototype.clearTtyDimensions = function() { + this.setTtyDimensions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.NewSessionMessage.prototype.hasTtyDimensions = function() { + return jspb.Message.getField(this, 5) != 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.NewSessionFailureMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.NewSessionFailureMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.NewSessionFailureMessage.displayName = 'proto.NewSessionFailureMessage'; +} + + +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_, 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.NewSessionFailureMessage.prototype.toObject = function(opt_includeInstance) { + return proto.NewSessionFailureMessage.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.NewSessionFailureMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.NewSessionFailureMessage.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.NewSessionFailureMessage} + */ +proto.NewSessionFailureMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.NewSessionFailureMessage; + return proto.NewSessionFailureMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.NewSessionFailureMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.NewSessionFailureMessage} + */ +proto.NewSessionFailureMessage.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.NewSessionFailureMessage.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.NewSessionFailureMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.NewSessionFailureMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.NewSessionFailureMessage.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.NewSessionFailureMessage.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.NewSessionFailureMessage} The clone. + */ +proto.NewSessionFailureMessage.prototype.cloneMessage = function() { + return /** @type {!proto.NewSessionFailureMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.NewSessionFailureMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.NewSessionFailureMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional Reason reason = 2; + * @return {!proto.NewSessionFailureMessage.Reason} + */ +proto.NewSessionFailureMessage.prototype.getReason = function() { + return /** @type {!proto.NewSessionFailureMessage.Reason} */ (jspb.Message.getFieldProto3(this, 2, 0)); +}; + + +/** @param {!proto.NewSessionFailureMessage.Reason} value */ +proto.NewSessionFailureMessage.prototype.setReason = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +/** + * optional string message = 3; + * @return {string} + */ +proto.NewSessionFailureMessage.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 3, "")); +}; + + +/** @param {string} value */ +proto.NewSessionFailureMessage.prototype.setMessage = function(value) { + jspb.Message.setField(this, 3, value); +}; + + +/** + * @enum {number} + */ +proto.NewSessionFailureMessage.Reason = { + PROHIBITED: 0, + RESOURCESHORTAGE: 1 +}; + + +/** + * 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.SessionDoneMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.SessionDoneMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.SessionDoneMessage.displayName = 'proto.SessionDoneMessage'; +} + + +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_, 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.SessionDoneMessage.prototype.toObject = function(opt_includeInstance) { + return proto.SessionDoneMessage.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.SessionDoneMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.SessionDoneMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + exitStatus: msg.getExitStatus() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.SessionDoneMessage} + */ +proto.SessionDoneMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.SessionDoneMessage; + return proto.SessionDoneMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.SessionDoneMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.SessionDoneMessage} + */ +proto.SessionDoneMessage.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 {number} */ (reader.readInt64()); + msg.setExitStatus(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.SessionDoneMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.SessionDoneMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.SessionDoneMessage.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.SessionDoneMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = this.getExitStatus(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.SessionDoneMessage} The clone. + */ +proto.SessionDoneMessage.prototype.cloneMessage = function() { + return /** @type {!proto.SessionDoneMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.SessionDoneMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.SessionDoneMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional int64 exit_status = 2; + * @return {number} + */ +proto.SessionDoneMessage.prototype.getExitStatus = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.SessionDoneMessage.prototype.setExitStatus = function(value) { + jspb.Message.setField(this, 2, 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.IdentifySessionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.IdentifySessionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.IdentifySessionMessage.displayName = 'proto.IdentifySessionMessage'; +} + + +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_, 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.IdentifySessionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.IdentifySessionMessage.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.IdentifySessionMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.IdentifySessionMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + pid: msg.getPid() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.IdentifySessionMessage} + */ +proto.IdentifySessionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.IdentifySessionMessage; + return proto.IdentifySessionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.IdentifySessionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.IdentifySessionMessage} + */ +proto.IdentifySessionMessage.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 {number} */ (reader.readUint64()); + msg.setPid(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.IdentifySessionMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.IdentifySessionMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.IdentifySessionMessage.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.IdentifySessionMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = this.getPid(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.IdentifySessionMessage} The clone. + */ +proto.IdentifySessionMessage.prototype.cloneMessage = function() { + return /** @type {!proto.IdentifySessionMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.IdentifySessionMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.IdentifySessionMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional uint64 pid = 2; + * @return {number} + */ +proto.IdentifySessionMessage.prototype.getPid = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.IdentifySessionMessage.prototype.setPid = function(value) { + jspb.Message.setField(this, 2, 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.WriteToSessionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.WriteToSessionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.WriteToSessionMessage.displayName = 'proto.WriteToSessionMessage'; +} + + +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_, 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.WriteToSessionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.WriteToSessionMessage.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.WriteToSessionMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.WriteToSessionMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.WriteToSessionMessage} + */ +proto.WriteToSessionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.WriteToSessionMessage; + return proto.WriteToSessionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.WriteToSessionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.WriteToSessionMessage} + */ +proto.WriteToSessionMessage.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 {!Uint8Array} */ (reader.readBytes()); + msg.setData(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.WriteToSessionMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.WriteToSessionMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.WriteToSessionMessage.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.WriteToSessionMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = this.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.WriteToSessionMessage} The clone. + */ +proto.WriteToSessionMessage.prototype.cloneMessage = function() { + return /** @type {!proto.WriteToSessionMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.WriteToSessionMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.WriteToSessionMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.WriteToSessionMessage.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldProto3(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.WriteToSessionMessage.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.WriteToSessionMessage.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.WriteToSessionMessage.prototype.setData = function(value) { + jspb.Message.setField(this, 2, 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.ResizeSessionTTYMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.ResizeSessionTTYMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.ResizeSessionTTYMessage.displayName = 'proto.ResizeSessionTTYMessage'; +} + + +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_, 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.ResizeSessionTTYMessage.prototype.toObject = function(opt_includeInstance) { + return proto.ResizeSessionTTYMessage.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.ResizeSessionTTYMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.ResizeSessionTTYMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + ttyDimensions: (f = msg.getTtyDimensions()) && proto.TTYDimensions.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.ResizeSessionTTYMessage} + */ +proto.ResizeSessionTTYMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.ResizeSessionTTYMessage; + return proto.ResizeSessionTTYMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.ResizeSessionTTYMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.ResizeSessionTTYMessage} + */ +proto.ResizeSessionTTYMessage.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.TTYDimensions; + reader.readMessage(value,proto.TTYDimensions.deserializeBinaryFromReader); + msg.setTtyDimensions(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.ResizeSessionTTYMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.ResizeSessionTTYMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.ResizeSessionTTYMessage.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.ResizeSessionTTYMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = this.getTtyDimensions(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.TTYDimensions.serializeBinaryToWriter + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.ResizeSessionTTYMessage} The clone. + */ +proto.ResizeSessionTTYMessage.prototype.cloneMessage = function() { + return /** @type {!proto.ResizeSessionTTYMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.ResizeSessionTTYMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.ResizeSessionTTYMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional TTYDimensions tty_dimensions = 2; + * @return {proto.TTYDimensions} + */ +proto.ResizeSessionTTYMessage.prototype.getTtyDimensions = function() { + return /** @type{proto.TTYDimensions} */ ( + jspb.Message.getWrapperField(this, proto.TTYDimensions, 2)); +}; + + +/** @param {proto.TTYDimensions|undefined} value */ +proto.ResizeSessionTTYMessage.prototype.setTtyDimensions = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +proto.ResizeSessionTTYMessage.prototype.clearTtyDimensions = function() { + this.setTtyDimensions(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.ResizeSessionTTYMessage.prototype.hasTtyDimensions = function() { + return jspb.Message.getField(this, 2) != 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.CloseSessionInputMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.CloseSessionInputMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.CloseSessionInputMessage.displayName = 'proto.CloseSessionInputMessage'; +} + + +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_, 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.CloseSessionInputMessage.prototype.toObject = function(opt_includeInstance) { + return proto.CloseSessionInputMessage.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.CloseSessionInputMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.CloseSessionInputMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.CloseSessionInputMessage} + */ +proto.CloseSessionInputMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.CloseSessionInputMessage; + return proto.CloseSessionInputMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.CloseSessionInputMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.CloseSessionInputMessage} + */ +proto.CloseSessionInputMessage.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; + 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.CloseSessionInputMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.CloseSessionInputMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.CloseSessionInputMessage.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.CloseSessionInputMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.CloseSessionInputMessage} The clone. + */ +proto.CloseSessionInputMessage.prototype.cloneMessage = function() { + return /** @type {!proto.CloseSessionInputMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.CloseSessionInputMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.CloseSessionInputMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, 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.ShutdownSessionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.ShutdownSessionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.ShutdownSessionMessage.displayName = 'proto.ShutdownSessionMessage'; +} + + +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_, 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.ShutdownSessionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.ShutdownSessionMessage.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.ShutdownSessionMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.ShutdownSessionMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.ShutdownSessionMessage} + */ +proto.ShutdownSessionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.ShutdownSessionMessage; + return proto.ShutdownSessionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.ShutdownSessionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.ShutdownSessionMessage} + */ +proto.ShutdownSessionMessage.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; + 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.ShutdownSessionMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.ShutdownSessionMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.ShutdownSessionMessage.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.ShutdownSessionMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.ShutdownSessionMessage} The clone. + */ +proto.ShutdownSessionMessage.prototype.cloneMessage = function() { + return /** @type {!proto.ShutdownSessionMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.ShutdownSessionMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.ShutdownSessionMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, 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.SessionOutputMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.SessionOutputMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.SessionOutputMessage.displayName = 'proto.SessionOutputMessage'; +} + + +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_, 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.SessionOutputMessage.prototype.toObject = function(opt_includeInstance) { + return proto.SessionOutputMessage.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.SessionOutputMessage} msg The msg instance to transform. + * @return {!Object} + */ +proto.SessionOutputMessage.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + fd: msg.getFd(), + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.SessionOutputMessage} + */ +proto.SessionOutputMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.SessionOutputMessage; + return proto.SessionOutputMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.SessionOutputMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.SessionOutputMessage} + */ +proto.SessionOutputMessage.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.SessionOutputMessage.FD} */ (reader.readEnum()); + msg.setFd(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(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.SessionOutputMessage} message + * @param {!jspb.BinaryWriter} writer + */ +proto.SessionOutputMessage.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.SessionOutputMessage.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.SessionOutputMessage.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = this.getFd(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } + f = this.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.SessionOutputMessage} The clone. + */ +proto.SessionOutputMessage.prototype.cloneMessage = function() { + return /** @type {!proto.SessionOutputMessage} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.SessionOutputMessage.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.SessionOutputMessage.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional FD fd = 2; + * @return {!proto.SessionOutputMessage.FD} + */ +proto.SessionOutputMessage.prototype.getFd = function() { + return /** @type {!proto.SessionOutputMessage.FD} */ (jspb.Message.getFieldProto3(this, 2, 0)); +}; + + +/** @param {!proto.SessionOutputMessage.FD} value */ +proto.SessionOutputMessage.prototype.setFd = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +/** + * optional bytes data = 3; + * @return {!(string|Uint8Array)} + */ +proto.SessionOutputMessage.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldProto3(this, 3, "")); +}; + + +/** + * optional bytes data = 3; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.SessionOutputMessage.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.SessionOutputMessage.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.SessionOutputMessage.prototype.setData = function(value) { + jspb.Message.setField(this, 3, value); +}; + + +/** + * @enum {number} + */ +proto.SessionOutputMessage.FD = { + STDOUT: 0, + STDERR: 1 +}; + + +/** + * 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.TTYDimensions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.TTYDimensions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.TTYDimensions.displayName = 'proto.TTYDimensions'; +} + + +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_, 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.TTYDimensions.prototype.toObject = function(opt_includeInstance) { + return proto.TTYDimensions.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.TTYDimensions} msg The msg instance to transform. + * @return {!Object} + */ +proto.TTYDimensions.toObject = function(includeInstance, msg) { + var f, obj = { + height: msg.getHeight(), + width: msg.getWidth() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.TTYDimensions} + */ +proto.TTYDimensions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.TTYDimensions; + return proto.TTYDimensions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.TTYDimensions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.TTYDimensions} + */ +proto.TTYDimensions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setWidth(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.TTYDimensions} message + * @param {!jspb.BinaryWriter} writer + */ +proto.TTYDimensions.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.TTYDimensions.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.TTYDimensions.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getHeight(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = this.getWidth(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.TTYDimensions} The clone. + */ +proto.TTYDimensions.prototype.cloneMessage = function() { + return /** @type {!proto.TTYDimensions} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint32 height = 1; + * @return {number} + */ +proto.TTYDimensions.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.TTYDimensions.prototype.setHeight = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional uint32 width = 2; + * @return {number} + */ +proto.TTYDimensions.prototype.getWidth = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.TTYDimensions.prototype.setWidth = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +goog.object.extend(exports, proto); diff --git a/packages/server/src/proto/index.ts b/packages/server/src/proto/index.ts new file mode 100644 index 000000000..1fb5b507c --- /dev/null +++ b/packages/server/src/proto/index.ts @@ -0,0 +1,3 @@ +export * from "./client_pb"; +export * from "./command_pb"; +export * from "./node_pb"; diff --git a/packages/server/src/proto/node.proto b/packages/server/src/proto/node.proto new file mode 100644 index 000000000..7f7309a4e --- /dev/null +++ b/packages/server/src/proto/node.proto @@ -0,0 +1,36 @@ +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; +} diff --git a/packages/server/src/proto/node_pb.d.ts b/packages/server/src/proto/node_pb.d.ts new file mode 100644 index 000000000..6b68db938 --- /dev/null +++ b/packages/server/src/proto/node_pb.d.ts @@ -0,0 +1,130 @@ +// 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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; + setArgsList(value: Array): 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + } +} + diff --git a/packages/server/src/proto/node_pb.js b/packages/server/src/proto/node_pb.js new file mode 100644 index 000000000..d5907d580 --- /dev/null +++ b/packages/server/src/proto/node_pb.js @@ -0,0 +1,894 @@ +/** + * @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_, 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} + * @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_, 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.} + */ +proto.NewEvalMessage.prototype.getArgsList = function() { + return /** @type {!Array.} */ (jspb.Message.getField(this, 3)); +}; + + +/** @param {Array.} 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_, 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_, 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); diff --git a/packages/server/test/evaluate.test.ts b/packages/server/test/evaluate.test.ts new file mode 100644 index 000000000..b7755a31b --- /dev/null +++ b/packages/server/test/evaluate.test.ts @@ -0,0 +1,39 @@ +import { createClient } from "./helpers"; + +describe("Evaluate", () => { + const client = createClient(); + + it("should transfer string", async () => { + const value = await client.evaluate(function () { + return "hi"; + }); + + expect(value).toEqual("hi"); + }, 100); + + it("should compute from object", async () => { + const value = await client.evaluate((arg) => { + return arg.bananas * 2; + }, { bananas: 1 }); + + expect(value).toEqual(2); + }, 100); + + it("should transfer object", async () => { + const value = await client.evaluate(() => { + return { alpha: "beta" }; + }); + + expect(value.alpha).toEqual("beta"); + }, 100); + + it("should require", async () => { + const value = await client.evaluate(() => { + const fs = require("fs") as typeof import("fs"); + + return Object.keys(fs).filter((f) => f === "readFileSync"); + }); + + expect(value[0]).toEqual("readFileSync"); + }, 100); +}); \ No newline at end of file diff --git a/packages/server/test/helpers.ts b/packages/server/test/helpers.ts new file mode 100644 index 000000000..47027d2cb --- /dev/null +++ b/packages/server/test/helpers.ts @@ -0,0 +1,28 @@ +import { Emitter } from "@coder/events"; +import { Client } from "../src/browser/client"; +import { Server } from "../src/node/server"; + +export const createClient = (): Client => { + const s2c = new Emitter(); + const c2s = new Emitter(); + + new Server({ + close: () => undefined, + onClose: () => undefined, + onMessage: (cb) => { + c2s.event((d) => cb(d)); + }, + send: (data) => setTimeout(() => s2c.emit(data), 0), + }); + + const client = new Client({ + close: () => undefined, + onClose: () => undefined, + onMessage: (cb) => { + s2c.event((d) => cb(d)); + }, + send: (data) => setTimeout(() => c2s.emit(data), 0), + }); + + return client; +}; diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock new file mode 100644 index 000000000..eac47b40c --- /dev/null +++ b/packages/server/yarn.lock @@ -0,0 +1,437 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/body-parser@*": + version "1.17.0" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.0.tgz#9f5c9d9bd04bb54be32d5eb9fc0d8c974e6cf58c" + integrity sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.32" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.32.tgz#aa0e9616b9435ccad02bc52b5b454ffc2c70ba28" + integrity sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg== + dependencies: + "@types/node" "*" + +"@types/events@*": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" + integrity sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA== + +"@types/express-serve-static-core@*": + version "4.16.0" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.16.0.tgz#fdfe777594ddc1fe8eb8eccce52e261b496e43e7" + integrity sha512-lTeoCu5NxJU4OD9moCgm0ESZzweAx0YqsAcab6OB0EB3+As1OaHtKnaGJvcngQxYsi9UNv0abn4/DRavrRxt4w== + dependencies: + "@types/events" "*" + "@types/node" "*" + "@types/range-parser" "*" + +"@types/express@^4.16.0": + version "4.16.0" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.16.0.tgz#6d8bc42ccaa6f35cf29a2b7c3333cb47b5a32a19" + integrity sha512-TtPEYumsmSTtTetAPXlJVf3kEqb6wZK0bZojpJQrnD/djV4q1oB6QQ8aKvKqwNPACoe02GNiy5zDzcYivR5Z2w== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "*" + "@types/serve-static" "*" + +"@types/mime@*": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.0.tgz#5a7306e367c539b9f6543499de8dd519fac37a8b" + integrity sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA== + +"@types/node@*": + version "10.12.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" + integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== + +"@types/range-parser@*": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" + integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== + +"@types/serve-static@*": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.2.tgz#f5ac4d7a6420a99a6a45af4719f4dcd8cd907a48" + integrity sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q== + dependencies: + "@types/express-serve-static-core" "*" + "@types/mime" "*" + +"@types/ws@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-6.0.1.tgz#ca7a3f3756aa12f62a0a62145ed14c6db25d5a28" + integrity sha512-EzH8k1gyZ4xih/MaZTXwT2xOkPiIMSrhQ9b8wrlX88L0T02eYsddatQlwVFlEPyEqV0ChpdpNnE51QPH6NVT4Q== + dependencies: + "@types/events" "*" + "@types/node" "*" + +accepts@~1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" + integrity sha1-63d99gEXI6OxTopywIBcjoZ0a9I= + dependencies: + mime-types "~2.1.18" + negotiator "0.6.1" + +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= + +async-limiter@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== + +body-parser@1.18.3: + version "1.18.3" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4" + integrity sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ= + dependencies: + bytes "3.0.0" + content-type "~1.0.4" + debug "2.6.9" + depd "~1.1.2" + http-errors "~1.6.3" + iconv-lite "0.4.23" + on-finished "~2.3.0" + qs "6.5.2" + raw-body "2.3.3" + type-is "~1.6.16" + +bytes@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= + +content-disposition@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" + integrity sha1-DPaLud318r55YcOoUXjLhdunjLQ= + +content-type@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" + integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= + +cookie@0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" + integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s= + +debug@2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= + +destroy@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" + integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= + +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + +express@^4.16.4: + version "4.16.4" + resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e" + integrity sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg== + dependencies: + accepts "~1.3.5" + array-flatten "1.1.1" + body-parser "1.18.3" + content-disposition "0.5.2" + content-type "~1.0.4" + cookie "0.3.1" + cookie-signature "1.0.6" + debug "2.6.9" + depd "~1.1.2" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.1.1" + fresh "0.5.2" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "~2.3.0" + parseurl "~1.3.2" + path-to-regexp "0.1.7" + proxy-addr "~2.0.4" + qs "6.5.2" + range-parser "~1.2.0" + safe-buffer "5.1.2" + send "0.16.2" + serve-static "1.13.2" + setprototypeof "1.1.0" + statuses "~1.4.0" + type-is "~1.6.16" + utils-merge "1.0.1" + vary "~1.1.2" + +finalhandler@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105" + integrity sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.2" + statuses "~1.4.0" + unpipe "~1.0.0" + +forwarded@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" + integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= + +google-protobuf@^3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.6.1.tgz#7ef58e2bea137a93cdaf5cfd5afa5f6abdd92025" + integrity sha512-SJYemeX5GjDLPnadcmCNQePQHCS4Hl5fOcI/JawqDIYFhCmrtYAjcx/oTQx/Wi8UuCuZQhfvftbmPePPAYHFtA== + +http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" + integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + +iconv-lite@0.4.23: + version "0.4.23" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" + integrity sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + +ipaddr.js@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" + integrity sha1-6qM9bd16zo9/b+DJygRA5wZzix4= + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= + +merge-descriptors@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= + +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= + +mime-db@~1.37.0: + version "1.37.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8" + integrity sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg== + +mime-types@~2.1.18: + version "2.1.21" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96" + integrity sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg== + dependencies: + mime-db "~1.37.0" + +mime@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" + integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +negotiator@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" + integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk= + +on-finished@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= + dependencies: + ee-first "1.1.1" + +parseurl@~1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" + integrity sha1-/CidTtiZMRlGDBViUyYs3I3mW/M= + +path-to-regexp@0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= + +proxy-addr@~2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" + integrity sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA== + dependencies: + forwarded "~0.1.2" + ipaddr.js "1.8.0" + +qs@6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +range-parser@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" + integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= + +raw-body@2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.3.tgz#1b324ece6b5706e153855bc1148c65bb7f6ea0c3" + integrity sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw== + dependencies: + bytes "3.0.0" + http-errors "1.6.3" + iconv-lite "0.4.23" + unpipe "1.0.0" + +safe-buffer@5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +send@0.16.2: + version "0.16.2" + resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" + integrity sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw== + dependencies: + debug "2.6.9" + depd "~1.1.2" + destroy "~1.0.4" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "~1.6.2" + mime "1.4.1" + ms "2.0.0" + on-finished "~2.3.0" + range-parser "~1.2.0" + statuses "~1.4.0" + +serve-static@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1" + integrity sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.2" + send "0.16.2" + +setprototypeof@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" + integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== + +"statuses@>= 1.4.0 < 2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + +statuses@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" + integrity sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew== + +ts-protoc-gen@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/ts-protoc-gen/-/ts-protoc-gen-0.8.0.tgz#2a9a31ee8a4d4760c484f1d0c7199633afaa5e3e" + integrity sha512-LUFM4Jy3qMSVyRf5ql973cJjltS98MiCz8kPf1Rc9AC9BeLu0WJfoHLf0Tvx2cGH0jSK9BpA0o1tHQQfjeO47Q== + dependencies: + google-protobuf "^3.6.1" + +type-is@~1.6.16: + version "1.6.16" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" + integrity sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.18" + +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= + +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + +ws@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.1.2.tgz#3cc7462e98792f0ac679424148903ded3b9c3ad8" + integrity sha512-rfUqzvz0WxmSXtJpPMX2EeASXabOrSMk1ruMOV3JBTBjo4ac2lDjGGsbQSyxj8Odhw5fBib8ZKEjDNvgouNKYw== + dependencies: + async-limiter "~1.0.0"