From 3a672d725a0c1f838d54127646475cb305c851bb Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 2 Apr 2019 17:44:28 -0500 Subject: [PATCH] Convert fully to protobuf (was partially JSON) (#402) * Convert fully to protobuf (was partially JSON) * Handle all floating promises * Remove stringified proto from trace logging It wasn't proving to be very useful. --- packages/protocol/src/browser/client.ts | 133 +- .../src/browser/modules/child_process.ts | 17 +- packages/protocol/src/browser/modules/fs.ts | 5 +- packages/protocol/src/browser/modules/net.ts | 32 +- .../protocol/src/browser/modules/node-pty.ts | 14 +- .../protocol/src/browser/modules/spdlog.ts | 26 +- .../protocol/src/browser/modules/stream.ts | 18 +- .../protocol/src/browser/modules/trash.ts | 2 + packages/protocol/src/common/proxy.ts | 44 +- packages/protocol/src/common/util.ts | 289 +- .../src/node/modules/child_process.ts | 14 +- packages/protocol/src/node/modules/fs.ts | 10 +- packages/protocol/src/node/modules/net.ts | 4 +- .../protocol/src/node/modules/node-pty.ts | 8 +- packages/protocol/src/node/modules/spdlog.ts | 4 +- packages/protocol/src/node/modules/stream.ts | 4 +- packages/protocol/src/node/modules/trash.ts | 2 + packages/protocol/src/node/server.ts | 113 +- packages/protocol/src/proto/client.proto | 16 +- packages/protocol/src/proto/client_pb.d.ts | 62 +- packages/protocol/src/proto/client_pb.js | 333 +- packages/protocol/src/proto/node.proto | 170 +- packages/protocol/src/proto/node_pb.d.ts | 795 +- packages/protocol/src/proto/node_pb.js | 6755 +++++++++++------ packages/protocol/src/proto/vscode.proto | 4 +- packages/protocol/src/proto/vscode_pb.d.ts | 14 +- packages/protocol/src/proto/vscode_pb.js | 54 +- packages/protocol/test/child_process.test.ts | 6 +- packages/protocol/test/server.test.ts | 12 +- packages/protocol/test/util.test.ts | 101 + packages/server/src/cli.ts | 4 +- 31 files changed, 5788 insertions(+), 3277 deletions(-) create mode 100644 packages/protocol/test/util.test.ts diff --git a/packages/protocol/src/browser/client.ts b/packages/protocol/src/browser/client.ts index 30239739..b420a863 100644 --- a/packages/protocol/src/browser/client.ts +++ b/packages/protocol/src/browser/client.ts @@ -5,8 +5,8 @@ import { Emitter } from "@coder/events"; import { logger, field } from "@coder/logger"; import { ReadWriteConnection, InitData, SharedProcessData } from "../common/connection"; import { Module, ServerProxy } from "../common/proxy"; -import { stringify, parse, moduleToProto, protoToModule, protoToOperatingSystem } from "../common/util"; -import { Ping, ServerMessage, ClientMessage, MethodMessage, NamedProxyMessage, NumberedProxyMessage, SuccessMessage, FailMessage, EventMessage, CallbackMessage } from "../proto"; +import { argumentToProto, protoToArgument, moduleToProto, protoToModule, protoToOperatingSystem } from "../common/util"; +import { Argument, Ping, ServerMessage, ClientMessage, Method, Event, Callback } from "../proto"; import { FsModule, ChildProcessModule, NetModule, NodePtyModule, SpdlogModule, TrashModule } from "./modules"; // tslint:disable no-any @@ -24,8 +24,8 @@ export class Client { private messageId = 0; private callbackId = 0; private readonly proxies = new Map(); - private readonly successEmitter = new Emitter(); - private readonly failEmitter = new Emitter(); + private readonly successEmitter = new Emitter(); + private readonly failEmitter = new Emitter(); private readonly eventEmitter = new Emitter<{ event: string; args: any[]; }>(); private _initData: InitData | undefined; @@ -129,9 +129,9 @@ export class Client { field("event listeners", this.eventEmitter.counts), ]); - const message = new FailMessage(); + const message = new Method.Fail(); const error = new Error("disconnected"); - message.setResponse(stringify(error)); + message.setResponse(argumentToProto(error)); this.failEmitter.emit(message); this.eventEmitter.emit({ event: "disconnected", args: [error] }); @@ -182,20 +182,21 @@ export class Client { case "kill": return Promise.resolve(); } + return Promise.reject( new Error(`Unable to call "${method}" on proxy ${proxyId}: disconnected`), ); } - const message = new MethodMessage(); + const message = new Method(); const id = this.messageId++; - let proxyMessage: NamedProxyMessage | NumberedProxyMessage; + let proxyMessage: Method.Named | Method.Numbered; if (typeof proxyId === "string") { - proxyMessage = new NamedProxyMessage(); + proxyMessage = new Method.Named(); proxyMessage.setModule(moduleToProto(proxyId)); message.setNamedProxy(proxyMessage); } else { - proxyMessage = new NumberedProxyMessage(); + proxyMessage = new Method.Numbered(); proxyMessage.setProxyId(proxyId); message.setNumberedProxy(proxyMessage); } @@ -215,16 +216,14 @@ export class Client { return callbackId; }; - const stringifiedArgs = args.map((a) => stringify(a, storeCallback)); logger.trace(() => [ "sending", field("id", id), field("proxyId", proxyId), field("method", method), - field("args", stringifiedArgs), ]); - proxyMessage.setArgsList(stringifiedArgs); + proxyMessage.setArgsList(args.map((a) => argumentToProto(a, storeCallback))); const clientMessage = new ClientMessage(); clientMessage.setMethod(message); @@ -246,12 +245,12 @@ export class Client { const d1 = this.successEmitter.event(id, (message) => { dispose(); - resolve(this.parse(message.getResponse(), promise)); + resolve(this.protoToArgument(message.getResponse(), promise)); }); const d2 = this.failEmitter.event(id, (message) => { dispose(); - reject(parse(message.getResponse())); + reject(protoToArgument(message.getResponse())); }); }); @@ -262,42 +261,53 @@ export class Client { * Handle all messages from the server. */ private async handleMessage(message: ServerMessage): Promise { - if (message.hasInit()) { - const init = message.getInit()!; - this._initData = { - dataDirectory: init.getDataDirectory(), - homeDirectory: init.getHomeDirectory(), - tmpDirectory: init.getTmpDirectory(), - workingDirectory: init.getWorkingDirectory(), - os: protoToOperatingSystem(init.getOperatingSystem()), - shell: init.getShell(), - builtInExtensionsDirectory: init.getBuiltinExtensionsDir(), - }; - this.initDataEmitter.emit(this._initData); - } else if (message.hasSuccess()) { - this.emitSuccess(message.getSuccess()!); - } else if (message.hasFail()) { - this.emitFail(message.getFail()!); - } else if (message.hasEvent()) { - await this.emitEvent(message.getEvent()!); - } else if (message.hasCallback()) { - await this.runCallback(message.getCallback()!); - } else if (message.hasSharedProcessActive()) { - const sharedProcessActiveMessage = message.getSharedProcessActive()!; - this.sharedProcessActiveEmitter.emit({ - socketPath: sharedProcessActiveMessage.getSocketPath(), - logPath: sharedProcessActiveMessage.getLogPath(), - }); - } else if (message.hasPong()) { - // Nothing to do since pings are on a timer rather than waiting for the - // next pong in case a message from either the client or server is dropped - // which would break the ping cycle. - } else { - throw new Error("unknown message type"); + switch (message.getMsgCase()) { + case ServerMessage.MsgCase.INIT: + const init = message.getInit()!; + this._initData = { + dataDirectory: init.getDataDirectory(), + homeDirectory: init.getHomeDirectory(), + tmpDirectory: init.getTmpDirectory(), + workingDirectory: init.getWorkingDirectory(), + os: protoToOperatingSystem(init.getOperatingSystem()), + shell: init.getShell(), + builtInExtensionsDirectory: init.getBuiltinExtensionsDir(), + }; + this.initDataEmitter.emit(this._initData); + break; + case ServerMessage.MsgCase.SUCCESS: + this.emitSuccess(message.getSuccess()!); + break; + case ServerMessage.MsgCase.FAIL: + this.emitFail(message.getFail()!); + break; + case ServerMessage.MsgCase.EVENT: + await this.emitEvent(message.getEvent()!); + break; + case ServerMessage.MsgCase.CALLBACK: + await this.runCallback(message.getCallback()!); + break; + case ServerMessage.MsgCase.SHARED_PROCESS_ACTIVE: + const sharedProcessActiveMessage = message.getSharedProcessActive()!; + this.sharedProcessActiveEmitter.emit({ + socketPath: sharedProcessActiveMessage.getSocketPath(), + logPath: sharedProcessActiveMessage.getLogPath(), + }); + break; + case ServerMessage.MsgCase.PONG: + // Nothing to do since pings are on a timer rather than waiting for the + // next pong in case a message from either the client or server is dropped + // which would break the ping cycle. + break; + default: + throw new Error("unknown message type"); } } - private emitSuccess(message: SuccessMessage): void { + /** + * Convert message to a success event. + */ + private emitSuccess(message: Method.Success): void { logger.trace(() => [ "received resolve", field("id", message.getId()), @@ -306,7 +316,10 @@ export class Client { this.successEmitter.emit(message.getId(), message); } - private emitFail(message: FailMessage): void { + /** + * Convert message to a fail event. + */ + private emitFail(message: Method.Fail): void { logger.trace(() => [ "received reject", field("id", message.getId()), @@ -322,7 +335,7 @@ export class Client { * request before it emits. Instead, emit all events from the server so all * events are always caught on the client. */ - private async emitEvent(message: EventMessage): Promise { + private async emitEvent(message: Event): Promise { const eventMessage = message.getNamedEvent()! || message.getNumberedEvent()!; const proxyId = message.getNamedEvent() ? protoToModule(message.getNamedEvent()!.getModule()) @@ -333,10 +346,9 @@ export class Client { "received event", field("proxyId", proxyId), field("event", event), - field("args", eventMessage.getArgsList()), ]); - const args = eventMessage.getArgsList().map((a) => this.parse(a)); + const args = eventMessage.getArgsList().map((a) => this.protoToArgument(a)); this.eventEmitter.emit(proxyId, { event, args }); } @@ -348,7 +360,7 @@ export class Client { * also only be used when passed together with the method. If they are sent * afterward, they may never be called due to timing issues. */ - private async runCallback(message: CallbackMessage): Promise { + private async runCallback(message: Callback): Promise { const callbackMessage = message.getNamedCallback()! || message.getNumberedCallback()!; const proxyId = message.getNamedCallback() ? protoToModule(message.getNamedCallback()!.getModule()) @@ -359,16 +371,15 @@ export class Client { "running callback", field("proxyId", proxyId), field("callbackId", callbackId), - field("args", callbackMessage.getArgsList()), ]); - const args = callbackMessage.getArgsList().map((a) => this.parse(a)); + const args = callbackMessage.getArgsList().map((a) => this.protoToArgument(a)); this.getProxy(proxyId).callbacks.get(callbackId)!(...args); } /** * Start the ping loop. Does nothing if already pinging. */ - private startPinging = (): void => { + private readonly startPinging = (): void => { if (typeof this.pingTimeout !== "undefined") { return; } @@ -505,10 +516,16 @@ export class Client { await this.getProxy(proxyId).promise; } - private parse(value?: string, promise?: Promise): any { - return parse(value, undefined, (id) => this.createProxy(id, promise)); + /** + * Same as protoToArgument except provides createProxy. + */ + private protoToArgument(value?: Argument, promise?: Promise): any { + return protoToArgument(value, undefined, (id) => this.createProxy(id, promise)); } + /** + * Get a proxy. Error if it doesn't exist. + */ private getProxy(proxyId: number | Module): ProxyData { if (!this.proxies.has(proxyId)) { throw new Error(`proxy ${proxyId} disposed too early`); diff --git a/packages/protocol/src/browser/modules/child_process.ts b/packages/protocol/src/browser/modules/child_process.ts index d0f62007..b3e53f61 100644 --- a/packages/protocol/src/browser/modules/child_process.ts +++ b/packages/protocol/src/browser/modules/child_process.ts @@ -6,6 +6,8 @@ import { ClientProxy } from "../../common/proxy"; import { ChildProcessModuleProxy, ChildProcessProxy, ChildProcessProxies } from "../../node/modules/child_process"; import { Readable, Writable } from "./stream"; +// tslint:disable completed-docs + export class ChildProcess extends ClientProxy implements cp.ChildProcess { public readonly stdin: stream.Writable; public readonly stdout: stream.Readable; @@ -23,10 +25,10 @@ export class ChildProcess extends ClientProxy implements cp.C this.stderr = new Readable(proxyPromises.then((p) => p.stderr!)); this.stdio = [this.stdin, this.stdout, this.stderr]; - this.proxy.getPid().then((pid) => { + this.catch(this.proxy.getPid().then((pid) => { this._pid = pid; this._connected = true; - }); + })); this.on("disconnect", () => this._connected = false); this.on("exit", () => { this._connected = false; @@ -48,19 +50,19 @@ export class ChildProcess extends ClientProxy implements cp.C public kill(): void { this._killed = true; - this.proxy.kill(); + this.catch(this.proxy.kill()); } public disconnect(): void { - this.proxy.disconnect(); + this.catch(this.proxy.disconnect()); } public ref(): void { - this.proxy.ref(); + this.catch(this.proxy.ref()); } public unref(): void { - this.proxy.unref(); + this.catch(this.proxy.unref()); } public send( @@ -88,6 +90,9 @@ export class ChildProcess extends ClientProxy implements cp.C return true; // Always true since we can't get this synchronously. } + /** + * Exit and close the process when disconnected. + */ protected handleDisconnect(): void { this.emit("exit", 1); this.emit("close"); diff --git a/packages/protocol/src/browser/modules/fs.ts b/packages/protocol/src/browser/modules/fs.ts index c1a2b8e7..a42c8ef0 100644 --- a/packages/protocol/src/browser/modules/fs.ts +++ b/packages/protocol/src/browser/modules/fs.ts @@ -6,6 +6,7 @@ import { FsModuleProxy, Stats as IStats, WatcherProxy, WriteStreamProxy } from " import { Writable } from "./stream"; // tslint:disable no-any +// tslint:disable completed-docs class StatBatch extends Batch { public constructor(private readonly proxy: FsModuleProxy) { @@ -39,7 +40,7 @@ class ReaddirBatch extends Batch implements fs.FSWatcher { public close(): void { - this.proxy.close(); + this.catch(this.proxy.close()); } protected handleDisconnect(): void { @@ -57,7 +58,7 @@ class WriteStream extends Writable implements fs.WriteStream { } public close(): void { - this.proxy.close(); + this.catch(this.proxy.close()); } } diff --git a/packages/protocol/src/browser/modules/net.ts b/packages/protocol/src/browser/modules/net.ts index 0d8354c4..571d6d9f 100644 --- a/packages/protocol/src/browser/modules/net.ts +++ b/packages/protocol/src/browser/modules/net.ts @@ -4,6 +4,8 @@ import { ClientProxy } from "../../common/proxy"; import { NetModuleProxy, NetServerProxy, NetSocketProxy } from "../../node/modules/net"; import { Duplex } from "./stream"; +// tslint:disable completed-docs + export class Socket extends Duplex implements net.Socket { private _connecting: boolean = false; private _destroyed: boolean = false; @@ -29,9 +31,8 @@ export class Socket extends Duplex implements net.Socket { if (callback) { this.on("connect", callback as () => void); } - this.proxy.connect(options, host); - return this; + return this.catch(this.proxy.connect(options, host)); } // tslint:disable-next-line no-any @@ -117,11 +118,11 @@ export class Socket extends Duplex implements net.Socket { } public unref(): void { - this.proxy.unref(); + this.catch(this.proxy.unref()); } public ref(): void { - this.proxy.ref(); + this.catch(this.proxy.ref()); } } @@ -133,14 +134,14 @@ export class Server extends ClientProxy implements net.Server { public constructor(proxyPromise: Promise | NetServerProxy) { super(proxyPromise); - this.proxy.onConnection((socketProxy) => { + this.catch(this.proxy.onConnection((socketProxy) => { const socket = new Socket(socketProxy); const socketId = this.socketId++; this.sockets.set(socketId, socket); - socket.on("error", () => this.sockets.delete(socketId)) - socket.on("close", () => this.sockets.delete(socketId)) + socket.on("error", () => this.sockets.delete(socketId)); + socket.on("close", () => this.sockets.delete(socketId)); this.emit("connection", socket); - }); + })); this.on("listening", () => this._listening = true); this.on("error", () => this._listening = false); @@ -160,9 +161,7 @@ export class Server extends ClientProxy implements net.Server { this.on("listening", callback as () => void); } - this.proxy.listen(handle, hostname, backlog); - - return this; + return this.catch(this.proxy.listen(handle, hostname, backlog)); } public get connections(): number { @@ -186,21 +185,16 @@ export class Server extends ClientProxy implements net.Server { if (callback) { this.on("close", callback); } - this.proxy.close(); - return this; + return this.catch(this.proxy.close()); } public ref(): this { - this.proxy.ref(); - - return this; + return this.catch(this.proxy.ref()); } public unref(): this { - this.proxy.unref(); - - return this; + return this.catch(this.proxy.unref()); } public getConnections(cb: (error: Error | null, count: number) => void): void { diff --git a/packages/protocol/src/browser/modules/node-pty.ts b/packages/protocol/src/browser/modules/node-pty.ts index 997ba941..6dd98e32 100644 --- a/packages/protocol/src/browser/modules/node-pty.ts +++ b/packages/protocol/src/browser/modules/node-pty.ts @@ -2,6 +2,8 @@ import * as pty from "node-pty"; import { ClientProxy } from "../../common/proxy"; import { NodePtyModuleProxy, NodePtyProcessProxy } from "../../node/modules/node-pty"; +// tslint:disable completed-docs + export class NodePtyProcess extends ClientProxy implements pty.IPty { private _pid = -1; private _process = ""; @@ -16,10 +18,10 @@ export class NodePtyProcess extends ClientProxy implements this.on("process", (process) => this._process = process); } - protected initialize(proxyPromise: Promise) { + protected initialize(proxyPromise: Promise): void { super.initialize(proxyPromise); - this.proxy.getPid().then((pid) => this._pid = pid); - this.proxy.getProcess().then((process) => this._process = process); + this.catch(this.proxy.getPid().then((p) => this._pid = p)); + this.catch(this.proxy.getProcess().then((p) => this._process = p)); } public get pid(): number { @@ -31,15 +33,15 @@ export class NodePtyProcess extends ClientProxy implements } public resize(columns: number, rows: number): void { - this.proxy.resize(columns, rows); + this.catch(this.proxy.resize(columns, rows)); } public write(data: string): void { - this.proxy.write(data); + this.catch(this.proxy.write(data)); } public kill(signal?: string): void { - this.proxy.kill(signal); + this.catch(this.proxy.kill(signal)); } protected handleDisconnect(): void { diff --git a/packages/protocol/src/browser/modules/spdlog.ts b/packages/protocol/src/browser/modules/spdlog.ts index 80fc5dde..7416302a 100644 --- a/packages/protocol/src/browser/modules/spdlog.ts +++ b/packages/protocol/src/browser/modules/spdlog.ts @@ -2,6 +2,8 @@ import * as spdlog from "spdlog"; import { ClientProxy } from "../../common/proxy"; import { RotatingLoggerProxy, SpdlogModuleProxy } from "../../node/modules/spdlog"; +// tslint:disable completed-docs + class RotatingLogger extends ClientProxy implements spdlog.RotatingLogger { public constructor( private readonly moduleProxy: SpdlogModuleProxy, @@ -13,16 +15,16 @@ class RotatingLogger extends ClientProxy implements spdlog. super(moduleProxy.createLogger(name, filename, filesize, filecount)); } - public async trace (message: string): Promise { this.proxy.trace(message); } - public async debug (message: string): Promise { this.proxy.debug(message); } - public async info (message: string): Promise { this.proxy.info(message); } - public async warn (message: string): Promise { this.proxy.warn(message); } - public async error (message: string): Promise { this.proxy.error(message); } - public async critical (message: string): Promise { this.proxy.critical(message); } - public async setLevel (level: number): Promise { this.proxy.setLevel(level); } - public async clearFormatters (): Promise { this.proxy.clearFormatters(); } - public async flush (): Promise { this.proxy.flush(); } - public async drop (): Promise { this.proxy.drop(); } + public trace (message: string): void { this.catch(this.proxy.trace(message)); } + public debug (message: string): void { this.catch(this.proxy.debug(message)); } + public info (message: string): void { this.catch(this.proxy.info(message)); } + public warn (message: string): void { this.catch(this.proxy.warn(message)); } + public error (message: string): void { this.catch(this.proxy.error(message)); } + public critical (message: string): void { this.catch(this.proxy.critical(message)); } + public setLevel (level: number): void { this.catch(this.proxy.setLevel(level)); } + public clearFormatters (): void { this.catch(this.proxy.clearFormatters()); } + public flush (): void { this.catch(this.proxy.flush()); } + public drop (): void { this.catch(this.proxy.drop()); } protected handleDisconnect(): void { this.initialize(this.moduleProxy.createLogger(this.name, this.filename, this.filesize, this.filecount)); @@ -40,7 +42,7 @@ export class SpdlogModule { }; } - public setAsyncMode = (bufferSize: number, flushInterval: number): void => { - this.proxy.setAsyncMode(bufferSize, flushInterval); + public setAsyncMode = (bufferSize: number, flushInterval: number): Promise => { + return this.proxy.setAsyncMode(bufferSize, flushInterval); } } diff --git a/packages/protocol/src/browser/modules/stream.ts b/packages/protocol/src/browser/modules/stream.ts index c636cf32..22c20cab 100644 --- a/packages/protocol/src/browser/modules/stream.ts +++ b/packages/protocol/src/browser/modules/stream.ts @@ -3,6 +3,8 @@ import { callbackify } from "util"; import { ClientProxy } from "../../common/proxy"; import { DuplexProxy, IReadableProxy, WritableProxy } from "../../node/modules/stream"; +// tslint:disable completed-docs + export class Writable extends ClientProxy implements stream.Writable { public get writable(): boolean { throw new Error("not implemented"); @@ -41,13 +43,11 @@ export class Writable extends ClientPro } public destroy(): void { - this.proxy.destroy(); + this.catch(this.proxy.destroy()); } public setDefaultEncoding(encoding: string): this { - this.proxy.setDefaultEncoding(encoding); - - return this; + return this.catch(this.proxy.setDefaultEncoding(encoding)); } // tslint:disable-next-line no-any @@ -151,13 +151,11 @@ export class Readable extends ClientP } public destroy(): void { - this.proxy.destroy(); + this.catch(this.proxy.destroy()); } public setEncoding(encoding: string): this { - this.proxy.setEncoding(encoding); - - return this; + return this.catch(this.proxy.setEncoding(encoding)); } protected handleDisconnect(): void { @@ -236,9 +234,7 @@ export class Duplex extends Writable imp } public setEncoding(encoding: string): this { - this.proxy.setEncoding(encoding); - - return this; + return this.catch(this.proxy.setEncoding(encoding)); } protected handleDisconnect(): void { diff --git a/packages/protocol/src/browser/modules/trash.ts b/packages/protocol/src/browser/modules/trash.ts index d555126d..06546180 100644 --- a/packages/protocol/src/browser/modules/trash.ts +++ b/packages/protocol/src/browser/modules/trash.ts @@ -1,6 +1,8 @@ import * as trash from "trash"; import { TrashModuleProxy } from "../../node/modules/trash"; +// tslint:disable completed-docs + export class TrashModule { public constructor(private readonly proxy: TrashModuleProxy) {} diff --git a/packages/protocol/src/common/proxy.ts b/packages/protocol/src/common/proxy.ts index 4a9604e4..04001321 100644 --- a/packages/protocol/src/common/proxy.ts +++ b/packages/protocol/src/common/proxy.ts @@ -61,16 +61,34 @@ export abstract class ClientProxy extends EventEmitter { return this._proxy; } + /** + * Initialize the proxy by unpromisifying if necessary and binding to its + * events. + */ protected initialize(proxyPromise: Promise | T): void { this._proxy = isPromise(proxyPromise) ? unpromisify(proxyPromise) : proxyPromise; if (this.bindEvents) { - this.proxy.onEvent((event, ...args): void => { + this.catch(this.proxy.onEvent((event, ...args): void => { this.emit(event, ...args); - }); + })); } } + /** + * Perform necessary cleanup on disconnect (or reconnect). + */ protected abstract handleDisconnect(): void; + + /** + * Emit an error event if the promise errors. + */ + protected catch(promise?: Promise): this { + if (promise) { + promise.catch((e) => this.emit("error", e)); + } + + return this; + } } /** @@ -81,6 +99,9 @@ export abstract class ClientProxy extends EventEmitter { * from those child proxies and fail to dispose them properly. */ export interface ServerProxy { + /** + * Dispose the proxy. + */ dispose(): Promise; /** @@ -100,6 +121,9 @@ export interface ServerProxy { onEvent(cb: (event: string, ...args: any[]) => void): Promise; } +/** + * Supported top-level module proxies. + */ export enum Module { Fs = "fs", ChildProcess = "child_process", @@ -127,19 +151,19 @@ export abstract class Batch { /** * Flush after reaching this amount of time. */ - private readonly maxTime = 1000, + private readonly maxTime: number = 1000, /** * Flush after reaching this count. */ - private readonly maxCount = 100, + private readonly maxCount: number = 100, /** * Flush after not receiving more requests for this amount of time. */ - private readonly idleTime = 100, + private readonly idleTime: number = 100, ) {} public add = (args: A): Promise => { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject): void => { this.batch.push({ args, resolve, @@ -157,9 +181,15 @@ export abstract class Batch { }); } + /** + * Perform remote call for a batch. + */ protected abstract remoteCall(batch: A[]): Promise<(T | Error)[]>; - private flush = (): void => { + /** + * Flush out the current batch. + */ + private readonly flush = (): void => { clearTimeout(this.idleTimeout as any); clearTimeout(this.maxTimeout as any); this.maxTimeout = undefined; diff --git a/packages/protocol/src/common/util.ts b/packages/protocol/src/common/util.ts index f1ba5e5d..e49835a9 100644 --- a/packages/protocol/src/common/util.ts +++ b/packages/protocol/src/common/util.ts @@ -1,4 +1,4 @@ -import { Module as ProtoModule, WorkingInitMessage } from "../proto"; +import { Argument, Module as ProtoModule, WorkingInit } from "../proto"; import { OperatingSystem } from "../common/connection"; import { Module, ServerProxy } from "./proxy"; @@ -29,227 +29,144 @@ export type IEncodingOptions = { export type IEncodingOptionsCallback = IEncodingOptions | ((err: NodeJS.ErrnoException, ...args: any[]) => void); -interface StringifiedError { - type: "error"; - data: { - message: string; - stack?: string; - code?: string; - }; -} - -interface StringifiedBuffer { - type: "buffer"; - data: number[]; -} - -interface StringifiedObject { - type: "object"; - data: { [key: string]: StringifiedValue }; -} - -interface StringifiedArray { - type: "array"; - data: StringifiedValue[]; -} - -interface StringifiedProxy { - type: "proxy"; - data: { - id: number; - }; -} - -interface StringifiedFunction { - type: "function"; - data: { - id: number; - }; -} - -interface StringifiedUndefined { - type: "undefined"; -} - -type StringifiedValue = StringifiedFunction | StringifiedProxy - | StringifiedUndefined | StringifiedObject | StringifiedArray - | StringifiedBuffer | StringifiedError | number | string | boolean | null; - -const isPrimitive = (value: any): value is number | string | boolean | null => { - return typeof value === "number" - || typeof value === "string" - || typeof value === "boolean" - || value === null; -}; - /** - * Stringify an argument or a return value. + * Convert an argument to proto. * If sending a function is possible, provide `storeFunction`. * If sending a proxy is possible, provide `storeProxy`. */ -export const stringify = ( +export const argumentToProto = ( value: any, storeFunction?: (fn: () => void) => number, storeProxy?: (proxy: ServerProxy) => number, -): string => { - const convert = (currentValue: any): StringifiedValue => { - // Errors don't stringify at all. They just become "{}". - // For some reason when running in Jest errors aren't instances of Error, - // so also check against the values. +): Argument => { + const convert = (currentValue: any): Argument => { + const message = new Argument(); + if (currentValue instanceof Error || (currentValue && typeof currentValue.message !== "undefined" && typeof currentValue.stack !== "undefined")) { - return { - type: "error", - data: { - message: currentValue.message, - stack: currentValue.stack, - code: (currentValue as NodeJS.ErrnoException).code, - }, - }; - } - - // With stringify, Uint8Array gets turned into objects with each index - // becoming a key for some reason. Then trying to do something like write - // that data results in [object Object] being written. Stringify them like - // a Buffer instead. Also handle Buffer so it doesn't get caught by the - // object check and to get the same type. - if (currentValue instanceof Uint8Array || currentValue instanceof Buffer) { - return { - type: "buffer", - data: Array.from(currentValue), - }; - } - - if (Array.isArray(currentValue)) { - return { - type: "array", - data: currentValue.map((a) => convert(a)), - }; - } - - if (isProxy(currentValue)) { + const arg = new Argument.ErrorValue(); + arg.setMessage(currentValue.message); + arg.setStack(currentValue.stack); + arg.setCode(currentValue.code); + message.setError(arg); + } else if (currentValue instanceof Uint8Array || currentValue instanceof Buffer) { + const arg = new Argument.BufferValue(); + arg.setData(currentValue); + message.setBuffer(arg); + } else if (Array.isArray(currentValue)) { + const arg = new Argument.ArrayValue(); + arg.setDataList(currentValue.map(convert)); + message.setArray(arg); + } else if (isProxy(currentValue)) { if (!storeProxy) { throw new Error("no way to serialize proxy"); } - - return { - type: "proxy", - data: { - id: storeProxy(currentValue), - }, - }; - } - - if (currentValue !== null && typeof currentValue === "object") { - const converted: { [key: string]: StringifiedValue } = {}; + const arg = new Argument.ProxyValue(); + arg.setId(storeProxy(currentValue)); + message.setProxy(arg); + } else if (currentValue !== null && typeof currentValue === "object") { + const arg = new Argument.ObjectValue(); + const map = arg.getDataMap(); Object.keys(currentValue).forEach((key) => { - converted[key] = convert(currentValue[key]); + map.set(key, convert(currentValue[key])); }); - - return { - type: "object", - data: converted, - }; - } - - // `undefined` can't be stringified. - if (typeof currentValue === "undefined") { - return { - type: "undefined", - }; - } - - if (typeof currentValue === "function") { - if (!storeFunction) { - throw new Error("no way to serialize function"); + message.setObject(arg); + } else if (currentValue === null) { + message.setNull(new Argument.NullValue()); + } else { + switch (typeof currentValue) { + case "undefined": + message.setUndefined(new Argument.UndefinedValue()); + break; + case "function": + if (!storeFunction) { + throw new Error("no way to serialize function"); + } + const arg = new Argument.FunctionValue(); + arg.setId(storeFunction(currentValue)); + message.setFunction(arg); + break; + case "number": + message.setNumber(currentValue); + break; + case "string": + message.setString(currentValue); + break; + case "boolean": + message.setBoolean(currentValue); + break; + default: + throw new Error(`cannot convert ${typeof currentValue} to proto`); } - - return { - type: "function", - data: { - id: storeFunction(currentValue), - }, - }; } - if (!isPrimitive(currentValue)) { - throw new Error(`cannot stringify ${typeof currentValue}`); - } - - return currentValue; + return message; }; - return JSON.stringify(convert(value)); + return convert(value); }; /** - * Parse an argument. + * Convert proto to an argument. * If running a remote callback is supported, provide `runCallback`. * If using a remote proxy is supported, provide `createProxy`. */ -export const parse = ( - value?: string, +export const protoToArgument = ( + message?: Argument, runCallback?: (id: number, args: any[]) => void, createProxy?: (id: number) => ServerProxy, ): any => { - const convert = (currentValue: StringifiedValue): any => { - if (currentValue && !isPrimitive(currentValue)) { - // Would prefer a switch but the types don't seem to work. - if (currentValue.type === "buffer") { - return Buffer.from(currentValue.data); - } - - if (currentValue.type === "error") { - const error = new Error(currentValue.data.message); - if (typeof currentValue.data.code !== "undefined") { - (error as NodeJS.ErrnoException).code = currentValue.data.code; - } - (error as any).originalStack = currentValue.data.stack; + const convert = (currentMessage: Argument): any => { + switch (currentMessage.getMsgCase()) { + case Argument.MsgCase.ERROR: + const errorMessage = currentMessage.getError()!; + const error = new Error(errorMessage.getMessage()); + (error as NodeJS.ErrnoException).code = errorMessage.getCode(); + (error as any).originalStack = errorMessage.getStack(); return error; - } + case Argument.MsgCase.BUFFER: + return Buffer.from(currentMessage.getBuffer()!.getData() as Uint8Array); + case Argument.MsgCase.ARRAY: + return currentMessage.getArray()!.getDataList().map((a) => convert(a)); + case Argument.MsgCase.PROXY: + if (!createProxy) { + throw new Error("no way to create proxy"); + } - if (currentValue.type === "object") { - const converted: { [key: string]: any } = {}; - Object.keys(currentValue.data).forEach((key) => { - converted[key] = convert(currentValue.data[key]); + return createProxy(currentMessage.getProxy()!.getId()); + case Argument.MsgCase.OBJECT: + const obj: { [Key: string]: any } = {}; + currentMessage.getObject()!.getDataMap().forEach((argument, key) => { + obj[key] = convert(argument); }); - return converted; - } - - if (currentValue.type === "array") { - return currentValue.data.map(convert); - } - - if (currentValue.type === "undefined") { + return obj; + case Argument.MsgCase.UNDEFINED: return undefined; - } - - if (currentValue.type === "function") { + case Argument.MsgCase.NULL: + return null; + case Argument.MsgCase.FUNCTION: if (!runCallback) { throw new Error("no way to run remote callback"); } return (...args: any[]): void => { - return runCallback(currentValue.data.id, args); + return runCallback(currentMessage.getFunction()!.getId(), args); }; - } - - if (currentValue.type === "proxy") { - if (!createProxy) { - throw new Error("no way to create proxy"); - } - - return createProxy(currentValue.data.id); - } + case Argument.MsgCase.NUMBER: + return currentMessage.getNumber(); + case Argument.MsgCase.STRING: + return currentMessage.getString(); + case Argument.MsgCase.BOOLEAN: + return currentMessage.getBoolean(); + default: + throw new Error("cannot convert unexpected proto to argument"); } - - return currentValue; }; - return value && convert(JSON.parse(value)); + return message && convert(message); }; export const protoToModule = (protoModule: ProtoModule): Module => { @@ -276,20 +193,20 @@ export const moduleToProto = (moduleName: Module): ProtoModule => { } }; -export const protoToOperatingSystem = (protoOp: WorkingInitMessage.OperatingSystem): OperatingSystem => { +export const protoToOperatingSystem = (protoOp: WorkingInit.OperatingSystem): OperatingSystem => { switch (protoOp) { - case WorkingInitMessage.OperatingSystem.WINDOWS: return OperatingSystem.Windows; - case WorkingInitMessage.OperatingSystem.LINUX: return OperatingSystem.Linux; - case WorkingInitMessage.OperatingSystem.MAC: return OperatingSystem.Mac; + case WorkingInit.OperatingSystem.WINDOWS: return OperatingSystem.Windows; + case WorkingInit.OperatingSystem.LINUX: return OperatingSystem.Linux; + case WorkingInit.OperatingSystem.MAC: return OperatingSystem.Mac; default: throw new Error(`unsupported operating system ${protoOp}`); } }; -export const platformToProto = (platform: NodeJS.Platform): WorkingInitMessage.OperatingSystem => { +export const platformToProto = (platform: NodeJS.Platform): WorkingInit.OperatingSystem => { switch (platform) { - case "win32": return WorkingInitMessage.OperatingSystem.WINDOWS; - case "linux": return WorkingInitMessage.OperatingSystem.LINUX; - case "darwin": return WorkingInitMessage.OperatingSystem.MAC; + case "win32": return WorkingInit.OperatingSystem.WINDOWS; + case "linux": return WorkingInit.OperatingSystem.LINUX; + case "darwin": return WorkingInit.OperatingSystem.MAC; default: throw new Error(`unrecognized platform "${platform}"`); } }; diff --git a/packages/protocol/src/node/modules/child_process.ts b/packages/protocol/src/node/modules/child_process.ts index fbf45200..b6a31a36 100644 --- a/packages/protocol/src/node/modules/child_process.ts +++ b/packages/protocol/src/node/modules/child_process.ts @@ -3,6 +3,8 @@ import { ServerProxy } from "../../common/proxy"; import { preserveEnv } from "../../common/util"; import { WritableProxy, ReadableProxy } from "./stream"; +// tslint:disable completed-docs + export type ForkProvider = (modulePath: string, args?: string[], options?: cp.ForkOptions) => cp.ChildProcess; export class ChildProcessProxy implements ServerProxy { @@ -26,7 +28,7 @@ export class ChildProcessProxy implements ServerProxy { // tslint:disable-next-line no-any public async send(message: any): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject): void => { this.process.send(message, (error) => { if (error) { reject(error); @@ -46,8 +48,8 @@ export class ChildProcessProxy implements ServerProxy { } public async dispose(): Promise { - this.kill(); - setTimeout(() => this.kill("SIGKILL"), 5000); // Double tap. + this.process.kill(); + setTimeout(() => this.process.kill("SIGKILL"), 5000); // Double tap. } // tslint:disable-next-line no-any @@ -62,9 +64,9 @@ export class ChildProcessProxy implements ServerProxy { export interface ChildProcessProxies { childProcess: ChildProcessProxy; - stdin?: WritableProxy; - stdout?: ReadableProxy; - stderr?: ReadableProxy; + stdin?: WritableProxy | null; + stdout?: ReadableProxy | null; + stderr?: ReadableProxy | null; } export class ChildProcessModuleProxy { diff --git a/packages/protocol/src/node/modules/fs.ts b/packages/protocol/src/node/modules/fs.ts index cc6177b2..b18182e9 100644 --- a/packages/protocol/src/node/modules/fs.ts +++ b/packages/protocol/src/node/modules/fs.ts @@ -4,6 +4,8 @@ import { ServerProxy } from "../../common/proxy"; import { IEncodingOptions } from "../../common/util"; import { WritableProxy } from "./stream"; +// tslint:disable completed-docs + /** * A serializable version of fs.Stats. */ @@ -41,13 +43,13 @@ export class WriteStreamProxy extends WritableProxy { } public async dispose(): Promise { - super.dispose(); + await super.dispose(); this.stream.close(); } // tslint:disable-next-line no-any public async onEvent(cb: (event: string, ...args: any[]) => void): Promise { - super.onEvent(cb); + await super.onEvent(cb); this.stream.on("open", (fd) => cb("open", fd)); } } @@ -109,7 +111,7 @@ export class FsModuleProxy { } public exists(path: fs.PathLike): Promise { - return promisify(fs.exists)(path); + return promisify(fs.exists)(path); // tslint:disable-line deprecation } public fchmod(fd: number, mode: string | number): Promise { @@ -173,7 +175,7 @@ export class FsModuleProxy { } public read(fd: number, length: number, position: number | null): Promise<{ bytesRead: number, buffer: Buffer }> { - const buffer = new Buffer(length); + const buffer = Buffer.alloc(length); return promisify(fs.read)(fd, buffer, 0, length, position); } diff --git a/packages/protocol/src/node/modules/net.ts b/packages/protocol/src/node/modules/net.ts index 5e5133c4..3c2ef26f 100644 --- a/packages/protocol/src/node/modules/net.ts +++ b/packages/protocol/src/node/modules/net.ts @@ -2,6 +2,8 @@ import * as net from "net"; import { ServerProxy } from "../../common/proxy"; import { DuplexProxy } from "./stream"; +// tslint:disable completed-docs + export class NetSocketProxy extends DuplexProxy { public async connect(options: number | string | net.SocketConnectOpts, host?: string): Promise { this.stream.connect(options as any, host as any); // tslint:disable-line no-any this works fine @@ -28,7 +30,7 @@ export class NetSocketProxy extends DuplexProxy { // tslint:disable-next-line no-any public async onEvent(cb: (event: string, ...args: any[]) => void): Promise { - super.onEvent(cb); + await super.onEvent(cb); this.stream.on("connect", () => cb("connect")); this.stream.on("lookup", (error, address, family, host) => cb("lookup", error, address, family, host)); this.stream.on("timeout", () => cb("timeout")); diff --git a/packages/protocol/src/node/modules/node-pty.ts b/packages/protocol/src/node/modules/node-pty.ts index 191c64f1..6a455b24 100644 --- a/packages/protocol/src/node/modules/node-pty.ts +++ b/packages/protocol/src/node/modules/node-pty.ts @@ -4,6 +4,8 @@ import * as pty from "node-pty"; import { ServerProxy } from "../../common/proxy"; import { preserveEnv } from "../../common/util"; +// tslint:disable completed-docs + /** * Server-side IPty proxy. */ @@ -22,7 +24,7 @@ export class NodePtyProcessProxy implements ServerProxy { } }, 200); - this.onDone(() => clearInterval(timer)); + this.process.on("exit", () => clearInterval(timer)); } public async getPid(): Promise { @@ -50,8 +52,8 @@ export class NodePtyProcessProxy implements ServerProxy { } public async dispose(): Promise { - this.kill(); - setTimeout(() => this.kill("SIGKILL"), 5000); // Double tap. + this.process.kill(); + setTimeout(() => this.process.kill("SIGKILL"), 5000); // Double tap. this.emitter.removeAllListeners(); } diff --git a/packages/protocol/src/node/modules/spdlog.ts b/packages/protocol/src/node/modules/spdlog.ts index b84771cd..a18ec6a3 100644 --- a/packages/protocol/src/node/modules/spdlog.ts +++ b/packages/protocol/src/node/modules/spdlog.ts @@ -3,6 +3,8 @@ import { EventEmitter } from "events"; import * as spdlog from "spdlog"; import { ServerProxy } from "../../common/proxy"; +// tslint:disable completed-docs + export class RotatingLoggerProxy implements ServerProxy { private readonly emitter = new EventEmitter(); @@ -24,7 +26,7 @@ export class RotatingLoggerProxy implements ServerProxy { } public async dispose(): Promise { - this.flush(); + await this.flush(); this.emitter.emit("dispose"); this.emitter.removeAllListeners(); } diff --git a/packages/protocol/src/node/modules/stream.ts b/packages/protocol/src/node/modules/stream.ts index 0114547b..d3840928 100644 --- a/packages/protocol/src/node/modules/stream.ts +++ b/packages/protocol/src/node/modules/stream.ts @@ -1,6 +1,8 @@ import * as stream from "stream"; import { ServerProxy } from "../../common/proxy"; +// tslint:disable completed-docs + export class WritableProxy implements ServerProxy { public constructor(protected readonly stream: T) {} @@ -100,7 +102,7 @@ export class DuplexProxy extends Writab // tslint:disable-next-line no-any public async onEvent(cb: (event: string, ...args: any[]) => void): Promise { - super.onEvent(cb); + await super.onEvent(cb); this.stream.on("data", (chunk) => cb("data", chunk)); this.stream.on("end", () => cb("end")); } diff --git a/packages/protocol/src/node/modules/trash.ts b/packages/protocol/src/node/modules/trash.ts index 6f6bedc9..53a585b1 100644 --- a/packages/protocol/src/node/modules/trash.ts +++ b/packages/protocol/src/node/modules/trash.ts @@ -1,5 +1,7 @@ import * as trash from "trash"; +// tslint:disable completed-docs + export class TrashModuleProxy { public async trash(path: string, options?: trash.Options): Promise { return trash(path, options); diff --git a/packages/protocol/src/node/server.ts b/packages/protocol/src/node/server.ts index 489d5711..7c0de701 100644 --- a/packages/protocol/src/node/server.ts +++ b/packages/protocol/src/node/server.ts @@ -3,8 +3,8 @@ import * as os from "os"; import { field, logger} from "@coder/logger"; import { ReadWriteConnection } from "../common/connection"; import { Module, ServerProxy } from "../common/proxy"; -import { isPromise, isProxy, moduleToProto, parse, platformToProto, protoToModule, stringify } from "../common/util"; -import { CallbackMessage, ClientMessage, EventMessage, FailMessage, MethodMessage, NamedCallbackMessage, NamedEventMessage, NumberedCallbackMessage, NumberedEventMessage, Pong, ServerMessage, SuccessMessage, WorkingInitMessage } from "../proto"; +import { isPromise, isProxy, moduleToProto, protoToArgument, platformToProto, protoToModule, argumentToProto } from "../common/util"; +import { Argument, Callback, ClientMessage, Event, Method, Pong, ServerMessage, WorkingInit } from "../proto"; import { ChildProcessModuleProxy, ForkProvider, FsModuleProxy, NetModuleProxy, NodePtyModuleProxy, SpdlogModuleProxy, TrashModuleProxy } from "./modules"; // tslint:disable no-any @@ -22,11 +22,14 @@ interface ProxyData { instance: any; } +/** + * Handle messages from the client. + */ export class Server { private proxyId = 0; private readonly proxies = new Map(); private disconnected: boolean = false; - private responseTimeout = 10000; + private readonly responseTimeout = 10000; public constructor( private readonly connection: ReadWriteConnection, @@ -57,7 +60,9 @@ export class Server { this.proxies.forEach((proxy, proxyId) => { if (isProxy(proxy.instance)) { - proxy.instance.dispose(); + proxy.instance.dispose().catch((error) => { + logger.error(error.message); + }); } this.removeProxy(proxyId); }); @@ -84,14 +89,14 @@ export class Server { logger.error(error.message, field("error", error)); }); - const initMsg = new WorkingInitMessage(); + const initMsg = new WorkingInit(); initMsg.setDataDirectory(this.options.dataDirectory); initMsg.setWorkingDirectory(this.options.workingDirectory); initMsg.setBuiltinExtensionsDir(this.options.builtInExtensionsDirectory); initMsg.setHomeDirectory(os.homedir()); initMsg.setTmpDirectory(os.tmpdir()); initMsg.setOperatingSystem(platformToProto(os.platform())); - initMsg.setShell(os.userInfo().shell || global.process.env.SHELL); + initMsg.setShell(os.userInfo().shell || global.process.env.SHELL || ""); const srvMsg = new ServerMessage(); srvMsg.setInit(initMsg); connection.send(srvMsg.serializeBinary()); @@ -101,29 +106,32 @@ export class Server { * Handle all messages from the client. */ private async handleMessage(message: ClientMessage): Promise { - if (message.hasMethod()) { - await this.runMethod(message.getMethod()!); - } else if (message.hasPing()) { - logger.trace("ping"); - const srvMsg = new ServerMessage(); - srvMsg.setPong(new Pong()); - this.connection.send(srvMsg.serializeBinary()); - } else { - throw new Error("unknown message type"); + switch (message.getMsgCase()) { + case ClientMessage.MsgCase.METHOD: + await this.runMethod(message.getMethod()!); + break; + case ClientMessage.MsgCase.PING: + logger.trace("ping"); + const srvMsg = new ServerMessage(); + srvMsg.setPong(new Pong()); + this.connection.send(srvMsg.serializeBinary()); + break; + default: + throw new Error("unknown message type"); } } /** * Run a method on a proxy. */ - private async runMethod(message: MethodMessage): Promise { + private async runMethod(message: Method): Promise { const proxyMessage = message.getNamedProxy()! || message.getNumberedProxy()!; const id = proxyMessage.getId(); const proxyId = message.hasNamedProxy() ? protoToModule(message.getNamedProxy()!.getModule()) : message.getNumberedProxy()!.getProxyId(); const method = proxyMessage.getMethod(); - const args = proxyMessage.getArgsList().map((a) => parse( + const args = proxyMessage.getArgsList().map((a) => protoToArgument( a, (id, args) => this.sendCallback(proxyId, id, args), )); @@ -133,7 +141,6 @@ export class Server { field("id", id), field("proxyId", proxyId), field("method", method), - field("args", proxyMessage.getArgsList()), ]); let response: any; @@ -153,7 +160,7 @@ export class Server { // Proxies must always return promises. if (!isPromise(response)) { - throw new Error('"${method}" must return a promise'); + throw new Error(`"${method}" must return a promise`); } } catch (error) { logger.error( @@ -175,27 +182,25 @@ export class Server { * Send a callback to the client. */ private sendCallback(proxyId: number | Module, callbackId: number, args: any[]): void { - const stringifiedArgs = args.map((a) => this.stringify(a)); logger.trace(() => [ "sending callback", field("proxyId", proxyId), field("callbackId", callbackId), - field("args", stringifiedArgs), ]); - const message = new CallbackMessage(); - let callbackMessage: NamedCallbackMessage | NumberedCallbackMessage; + const message = new Callback(); + let callbackMessage: Callback.Named | Callback.Numbered; if (typeof proxyId === "string") { - callbackMessage = new NamedCallbackMessage(); + callbackMessage = new Callback.Named(); callbackMessage.setModule(moduleToProto(proxyId)); message.setNamedCallback(callbackMessage); } else { - callbackMessage = new NumberedCallbackMessage(); + callbackMessage = new Callback.Numbered(); callbackMessage.setProxyId(proxyId); message.setNumberedCallback(callbackMessage); } callbackMessage.setCallbackId(callbackId); - callbackMessage.setArgsList(stringifiedArgs); + callbackMessage.setArgsList(args.map((a) => this.argumentToProto(a))); const serverMessage = new ServerMessage(); serverMessage.setCallback(message); @@ -203,15 +208,23 @@ export class Server { } /** - * Store a proxy and bind events to send them back to the client. + * Store a numbered proxy and bind events to send them back to the client. */ private storeProxy(instance: ServerProxy): number; + /** + * Store a unique proxy and bind events to send them back to the client. + */ private storeProxy(instance: any, moduleProxyId: Module): Module; + /** + * Store a proxy and bind events to send them back to the client. + */ private storeProxy(instance: ServerProxy | any, moduleProxyId?: Module): number | Module { // In case we disposed while waiting for a function to return. if (this.disconnected) { if (isProxy(instance)) { - instance.dispose(); + instance.dispose().catch((error) => { + logger.error(error.message); + }); } throw new Error("disposed"); @@ -226,16 +239,22 @@ export class Server { this.proxies.set(proxyId, { instance }); if (isProxy(instance)) { - instance.onEvent((event, ...args) => this.sendEvent(proxyId, event, ...args)); + instance.onEvent((event, ...args) => this.sendEvent(proxyId, event, ...args)).catch((error) => { + logger.error(error.message); + }); instance.onDone(() => { // It might have finished because we disposed it due to a disconnect. if (!this.disconnected) { this.sendEvent(proxyId, "done"); this.getProxy(proxyId).disposeTimeout = setTimeout(() => { - instance.dispose(); + instance.dispose().catch((error) => { + logger.error(error.message); + }); this.removeProxy(proxyId); }, this.responseTimeout); } + }).catch((error) => { + logger.error(error.message); }); } @@ -246,27 +265,25 @@ export class Server { * Send an event to the client. */ private sendEvent(proxyId: number | Module, event: string, ...args: any[]): void { - const stringifiedArgs = args.map((a) => this.stringify(a)); logger.trace(() => [ "sending event", field("proxyId", proxyId), field("event", event), - field("args", stringifiedArgs), ]); - const message = new EventMessage(); - let eventMessage: NamedEventMessage | NumberedEventMessage; + const message = new Event(); + let eventMessage: Event.Named | Event.Numbered; if (typeof proxyId === "string") { - eventMessage = new NamedEventMessage(); + eventMessage = new Event.Named(); eventMessage.setModule(moduleToProto(proxyId)); message.setNamedEvent(eventMessage); } else { - eventMessage = new NumberedEventMessage(); + eventMessage = new Event.Numbered(); eventMessage.setProxyId(proxyId); message.setNumberedEvent(eventMessage); } eventMessage.setEvent(event); - eventMessage.setArgsList(stringifiedArgs); + eventMessage.setArgsList(args.map((a) => this.argumentToProto(a))); const serverMessage = new ServerMessage(); serverMessage.setEvent(message); @@ -277,16 +294,14 @@ export class Server { * Send a response back to the client. */ private sendResponse(id: number, response: any): void { - const stringifiedResponse = this.stringify(response); logger.trace(() => [ "sending resolve", field("id", id), - field("response", stringifiedResponse), ]); - const successMessage = new SuccessMessage(); + const successMessage = new Method.Success(); successMessage.setId(id); - successMessage.setResponse(stringifiedResponse); + successMessage.setResponse(this.argumentToProto(response)); const serverMessage = new ServerMessage(); serverMessage.setSuccess(successMessage); @@ -297,16 +312,14 @@ export class Server { * Send an exception back to the client. */ private sendException(id: number, error: Error): void { - const stringifiedError = stringify(error); logger.trace(() => [ "sending reject", field("id", id) , - field("response", stringifiedError), ]); - const failedMessage = new FailMessage(); + const failedMessage = new Method.Fail(); failedMessage.setId(id); - failedMessage.setResponse(stringifiedError); + failedMessage.setResponse(argumentToProto(error)); const serverMessage = new ServerMessage(); serverMessage.setFail(failedMessage); @@ -327,10 +340,16 @@ export class Server { ]); } - private stringify(value: any): string { - return stringify(value, undefined, (p) => this.storeProxy(p)); + /** + * Same as argumentToProto but provides storeProxy. + */ + private argumentToProto(value: any): Argument { + return argumentToProto(value, undefined, (p) => this.storeProxy(p)); } + /** + * Get a proxy. Error if it doesn't exist. + */ private getProxy(proxyId: number | Module): ProxyData { if (!this.proxies.has(proxyId)) { throw new Error(`proxy ${proxyId} disposed too early`); diff --git a/packages/protocol/src/proto/client.proto b/packages/protocol/src/proto/client.proto index 931dbdf6..b0b5d858 100644 --- a/packages/protocol/src/proto/client.proto +++ b/packages/protocol/src/proto/client.proto @@ -6,7 +6,7 @@ import "vscode.proto"; message ClientMessage { oneof msg { // node.proto - MethodMessage method = 20; + Method method = 20; Ping ping = 21; } } @@ -15,20 +15,20 @@ message ClientMessage { message ServerMessage { oneof msg { // node.proto - FailMessage fail = 13; - SuccessMessage success = 14; - EventMessage event = 19; - CallbackMessage callback = 22; + Method.Fail fail = 13; + Method.Success success = 14; + Event event = 19; + Callback callback = 22; Pong pong = 18; - WorkingInitMessage init = 16; + WorkingInit init = 16; // vscode.proto - SharedProcessActiveMessage shared_process_active = 17; + SharedProcessActive shared_process_active = 17; } } -message WorkingInitMessage { +message WorkingInit { string home_directory = 1; string tmp_directory = 2; string data_directory = 3; diff --git a/packages/protocol/src/proto/client_pb.d.ts b/packages/protocol/src/proto/client_pb.d.ts index 9cf8e46a..5306f7d9 100644 --- a/packages/protocol/src/proto/client_pb.d.ts +++ b/packages/protocol/src/proto/client_pb.d.ts @@ -8,8 +8,8 @@ import * as vscode_pb from "./vscode_pb"; export class ClientMessage extends jspb.Message { hasMethod(): boolean; clearMethod(): void; - getMethod(): node_pb.MethodMessage | undefined; - setMethod(value?: node_pb.MethodMessage): void; + getMethod(): node_pb.Method | undefined; + setMethod(value?: node_pb.Method): void; hasPing(): boolean; clearPing(): void; @@ -29,7 +29,7 @@ export class ClientMessage extends jspb.Message { export namespace ClientMessage { export type AsObject = { - method?: node_pb.MethodMessage.AsObject, + method?: node_pb.Method.AsObject, ping?: node_pb.Ping.AsObject, } @@ -43,23 +43,23 @@ export namespace ClientMessage { export class ServerMessage extends jspb.Message { hasFail(): boolean; clearFail(): void; - getFail(): node_pb.FailMessage | undefined; - setFail(value?: node_pb.FailMessage): void; + getFail(): node_pb.Method.Fail | undefined; + setFail(value?: node_pb.Method.Fail): void; hasSuccess(): boolean; clearSuccess(): void; - getSuccess(): node_pb.SuccessMessage | undefined; - setSuccess(value?: node_pb.SuccessMessage): void; + getSuccess(): node_pb.Method.Success | undefined; + setSuccess(value?: node_pb.Method.Success): void; hasEvent(): boolean; clearEvent(): void; - getEvent(): node_pb.EventMessage | undefined; - setEvent(value?: node_pb.EventMessage): void; + getEvent(): node_pb.Event | undefined; + setEvent(value?: node_pb.Event): void; hasCallback(): boolean; clearCallback(): void; - getCallback(): node_pb.CallbackMessage | undefined; - setCallback(value?: node_pb.CallbackMessage): void; + getCallback(): node_pb.Callback | undefined; + setCallback(value?: node_pb.Callback): void; hasPong(): boolean; clearPong(): void; @@ -68,13 +68,13 @@ export class ServerMessage extends jspb.Message { hasInit(): boolean; clearInit(): void; - getInit(): WorkingInitMessage | undefined; - setInit(value?: WorkingInitMessage): void; + getInit(): WorkingInit | undefined; + setInit(value?: WorkingInit): void; hasSharedProcessActive(): boolean; clearSharedProcessActive(): void; - getSharedProcessActive(): vscode_pb.SharedProcessActiveMessage | undefined; - setSharedProcessActive(value?: vscode_pb.SharedProcessActiveMessage): void; + getSharedProcessActive(): vscode_pb.SharedProcessActive | undefined; + setSharedProcessActive(value?: vscode_pb.SharedProcessActive): void; getMsgCase(): ServerMessage.MsgCase; serializeBinary(): Uint8Array; @@ -89,13 +89,13 @@ export class ServerMessage extends jspb.Message { export namespace ServerMessage { export type AsObject = { - fail?: node_pb.FailMessage.AsObject, - success?: node_pb.SuccessMessage.AsObject, - event?: node_pb.EventMessage.AsObject, - callback?: node_pb.CallbackMessage.AsObject, + fail?: node_pb.Method.Fail.AsObject, + success?: node_pb.Method.Success.AsObject, + event?: node_pb.Event.AsObject, + callback?: node_pb.Callback.AsObject, pong?: node_pb.Pong.AsObject, - init?: WorkingInitMessage.AsObject, - sharedProcessActive?: vscode_pb.SharedProcessActiveMessage.AsObject, + init?: WorkingInit.AsObject, + sharedProcessActive?: vscode_pb.SharedProcessActive.AsObject, } export enum MsgCase { @@ -110,7 +110,7 @@ export namespace ServerMessage { } } -export class WorkingInitMessage extends jspb.Message { +export class WorkingInit extends jspb.Message { getHomeDirectory(): string; setHomeDirectory(value: string): void; @@ -123,8 +123,8 @@ export class WorkingInitMessage extends jspb.Message { getWorkingDirectory(): string; setWorkingDirectory(value: string): void; - getOperatingSystem(): WorkingInitMessage.OperatingSystem; - setOperatingSystem(value: WorkingInitMessage.OperatingSystem): void; + getOperatingSystem(): WorkingInit.OperatingSystem; + setOperatingSystem(value: WorkingInit.OperatingSystem): void; getShell(): string; setShell(value: string): void; @@ -133,22 +133,22 @@ export class WorkingInitMessage extends jspb.Message { setBuiltinExtensionsDir(value: string): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WorkingInitMessage.AsObject; - static toObject(includeInstance: boolean, msg: WorkingInitMessage): WorkingInitMessage.AsObject; + toObject(includeInstance?: boolean): WorkingInit.AsObject; + static toObject(includeInstance: boolean, msg: WorkingInit): WorkingInit.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: WorkingInitMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WorkingInitMessage; - static deserializeBinaryFromReader(message: WorkingInitMessage, reader: jspb.BinaryReader): WorkingInitMessage; + static serializeBinaryToWriter(message: WorkingInit, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorkingInit; + static deserializeBinaryFromReader(message: WorkingInit, reader: jspb.BinaryReader): WorkingInit; } -export namespace WorkingInitMessage { +export namespace WorkingInit { export type AsObject = { homeDirectory: string, tmpDirectory: string, dataDirectory: string, workingDirectory: string, - operatingSystem: WorkingInitMessage.OperatingSystem, + operatingSystem: WorkingInit.OperatingSystem, shell: string, builtinExtensionsDir: string, } diff --git a/packages/protocol/src/proto/client_pb.js b/packages/protocol/src/proto/client_pb.js index 516dcc9f..d98a648d 100644 --- a/packages/protocol/src/proto/client_pb.js +++ b/packages/protocol/src/proto/client_pb.js @@ -12,12 +12,13 @@ var goog = jspb; var global = Function('return this')(); var node_pb = require('./node_pb.js'); +goog.object.extend(proto, node_pb); var vscode_pb = require('./vscode_pb.js'); +goog.object.extend(proto, vscode_pb); goog.exportSymbol('proto.ClientMessage', null, global); goog.exportSymbol('proto.ServerMessage', null, global); -goog.exportSymbol('proto.WorkingInitMessage', null, global); -goog.exportSymbol('proto.WorkingInitMessage.OperatingSystem', null, global); - +goog.exportSymbol('proto.WorkingInit', null, global); +goog.exportSymbol('proto.WorkingInit.OperatingSystem', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -33,8 +34,55 @@ proto.ClientMessage = function(opt_data) { }; goog.inherits(proto.ClientMessage, jspb.Message); if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ proto.ClientMessage.displayName = 'proto.ClientMessage'; } +/** + * 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) { + /** + * @public + * @override + */ + proto.ServerMessage.displayName = 'proto.ServerMessage'; +} +/** + * 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.WorkingInit = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.WorkingInit, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.WorkingInit.displayName = 'proto.WorkingInit'; +} + /** * Oneof group definitions for this message. Each group defines the field * numbers belonging to that group. When of these fields' value is set, all @@ -89,8 +137,8 @@ proto.ClientMessage.prototype.toObject = function(opt_includeInstance) { * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.ClientMessage.toObject = function(includeInstance, msg) { - var f, obj = { - method: (f = msg.getMethod()) && node_pb.MethodMessage.toObject(includeInstance, f), + var obj = { + method: (f = msg.getMethod()) && node_pb.Method.toObject(includeInstance, f), ping: (f = msg.getPing()) && node_pb.Ping.toObject(includeInstance, f) }; @@ -129,8 +177,8 @@ proto.ClientMessage.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 20: - var value = new node_pb.MethodMessage; - reader.readMessage(value,node_pb.MethodMessage.deserializeBinaryFromReader); + var value = new node_pb.Method; + reader.readMessage(value,node_pb.Method.deserializeBinaryFromReader); msg.setMethod(value); break; case 21: @@ -172,7 +220,7 @@ proto.ClientMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 20, f, - node_pb.MethodMessage.serializeBinaryToWriter + node_pb.Method.serializeBinaryToWriter ); } f = message.getPing(); @@ -187,21 +235,24 @@ proto.ClientMessage.serializeBinaryToWriter = function(message, writer) { /** - * optional MethodMessage method = 20; - * @return {?proto.MethodMessage} + * optional Method method = 20; + * @return {?proto.Method} */ proto.ClientMessage.prototype.getMethod = function() { - return /** @type{?proto.MethodMessage} */ ( - jspb.Message.getWrapperField(this, node_pb.MethodMessage, 20)); + return /** @type{?proto.Method} */ ( + jspb.Message.getWrapperField(this, node_pb.Method, 20)); }; -/** @param {?proto.MethodMessage|undefined} value */ +/** @param {?proto.Method|undefined} value */ proto.ClientMessage.prototype.setMethod = function(value) { jspb.Message.setOneofWrapperField(this, 20, proto.ClientMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ClientMessage.prototype.clearMethod = function() { this.setMethod(undefined); }; @@ -209,7 +260,7 @@ proto.ClientMessage.prototype.clearMethod = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ClientMessage.prototype.hasMethod = function() { return jspb.Message.getField(this, 20) != null; @@ -232,6 +283,9 @@ proto.ClientMessage.prototype.setPing = function(value) { }; +/** + * Clears the message field making it undefined. + */ proto.ClientMessage.prototype.clearPing = function() { this.setPing(undefined); }; @@ -239,7 +293,7 @@ proto.ClientMessage.prototype.clearPing = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ClientMessage.prototype.hasPing = function() { return jspb.Message.getField(this, 21) != null; @@ -247,23 +301,6 @@ proto.ClientMessage.prototype.hasPing = function() { -/** - * 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 @@ -323,14 +360,14 @@ proto.ServerMessage.prototype.toObject = function(opt_includeInstance) { * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.ServerMessage.toObject = function(includeInstance, msg) { - var f, obj = { - fail: (f = msg.getFail()) && node_pb.FailMessage.toObject(includeInstance, f), - success: (f = msg.getSuccess()) && node_pb.SuccessMessage.toObject(includeInstance, f), - event: (f = msg.getEvent()) && node_pb.EventMessage.toObject(includeInstance, f), - callback: (f = msg.getCallback()) && node_pb.CallbackMessage.toObject(includeInstance, f), + var obj = { + fail: (f = msg.getFail()) && node_pb.Method.Fail.toObject(includeInstance, f), + success: (f = msg.getSuccess()) && node_pb.Method.Success.toObject(includeInstance, f), + event: (f = msg.getEvent()) && node_pb.Event.toObject(includeInstance, f), + callback: (f = msg.getCallback()) && node_pb.Callback.toObject(includeInstance, f), pong: (f = msg.getPong()) && node_pb.Pong.toObject(includeInstance, f), - init: (f = msg.getInit()) && proto.WorkingInitMessage.toObject(includeInstance, f), - sharedProcessActive: (f = msg.getSharedProcessActive()) && vscode_pb.SharedProcessActiveMessage.toObject(includeInstance, f) + init: (f = msg.getInit()) && proto.WorkingInit.toObject(includeInstance, f), + sharedProcessActive: (f = msg.getSharedProcessActive()) && vscode_pb.SharedProcessActive.toObject(includeInstance, f) }; if (includeInstance) { @@ -368,23 +405,23 @@ proto.ServerMessage.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 13: - var value = new node_pb.FailMessage; - reader.readMessage(value,node_pb.FailMessage.deserializeBinaryFromReader); + var value = new node_pb.Method.Fail; + reader.readMessage(value,node_pb.Method.Fail.deserializeBinaryFromReader); msg.setFail(value); break; case 14: - var value = new node_pb.SuccessMessage; - reader.readMessage(value,node_pb.SuccessMessage.deserializeBinaryFromReader); + var value = new node_pb.Method.Success; + reader.readMessage(value,node_pb.Method.Success.deserializeBinaryFromReader); msg.setSuccess(value); break; case 19: - var value = new node_pb.EventMessage; - reader.readMessage(value,node_pb.EventMessage.deserializeBinaryFromReader); + var value = new node_pb.Event; + reader.readMessage(value,node_pb.Event.deserializeBinaryFromReader); msg.setEvent(value); break; case 22: - var value = new node_pb.CallbackMessage; - reader.readMessage(value,node_pb.CallbackMessage.deserializeBinaryFromReader); + var value = new node_pb.Callback; + reader.readMessage(value,node_pb.Callback.deserializeBinaryFromReader); msg.setCallback(value); break; case 18: @@ -393,13 +430,13 @@ proto.ServerMessage.deserializeBinaryFromReader = function(msg, reader) { msg.setPong(value); break; case 16: - var value = new proto.WorkingInitMessage; - reader.readMessage(value,proto.WorkingInitMessage.deserializeBinaryFromReader); + var value = new proto.WorkingInit; + reader.readMessage(value,proto.WorkingInit.deserializeBinaryFromReader); msg.setInit(value); break; case 17: - var value = new vscode_pb.SharedProcessActiveMessage; - reader.readMessage(value,vscode_pb.SharedProcessActiveMessage.deserializeBinaryFromReader); + var value = new vscode_pb.SharedProcessActive; + reader.readMessage(value,vscode_pb.SharedProcessActive.deserializeBinaryFromReader); msg.setSharedProcessActive(value); break; default: @@ -436,7 +473,7 @@ proto.ServerMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 13, f, - node_pb.FailMessage.serializeBinaryToWriter + node_pb.Method.Fail.serializeBinaryToWriter ); } f = message.getSuccess(); @@ -444,7 +481,7 @@ proto.ServerMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 14, f, - node_pb.SuccessMessage.serializeBinaryToWriter + node_pb.Method.Success.serializeBinaryToWriter ); } f = message.getEvent(); @@ -452,7 +489,7 @@ proto.ServerMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 19, f, - node_pb.EventMessage.serializeBinaryToWriter + node_pb.Event.serializeBinaryToWriter ); } f = message.getCallback(); @@ -460,7 +497,7 @@ proto.ServerMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 22, f, - node_pb.CallbackMessage.serializeBinaryToWriter + node_pb.Callback.serializeBinaryToWriter ); } f = message.getPong(); @@ -476,7 +513,7 @@ proto.ServerMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 16, f, - proto.WorkingInitMessage.serializeBinaryToWriter + proto.WorkingInit.serializeBinaryToWriter ); } f = message.getSharedProcessActive(); @@ -484,28 +521,31 @@ proto.ServerMessage.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 17, f, - vscode_pb.SharedProcessActiveMessage.serializeBinaryToWriter + vscode_pb.SharedProcessActive.serializeBinaryToWriter ); } }; /** - * optional FailMessage fail = 13; - * @return {?proto.FailMessage} + * optional Method.Fail fail = 13; + * @return {?proto.Method.Fail} */ proto.ServerMessage.prototype.getFail = function() { - return /** @type{?proto.FailMessage} */ ( - jspb.Message.getWrapperField(this, node_pb.FailMessage, 13)); + return /** @type{?proto.Method.Fail} */ ( + jspb.Message.getWrapperField(this, node_pb.Method.Fail, 13)); }; -/** @param {?proto.FailMessage|undefined} value */ +/** @param {?proto.Method.Fail|undefined} value */ proto.ServerMessage.prototype.setFail = function(value) { jspb.Message.setOneofWrapperField(this, 13, proto.ServerMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearFail = function() { this.setFail(undefined); }; @@ -513,7 +553,7 @@ proto.ServerMessage.prototype.clearFail = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasFail = function() { return jspb.Message.getField(this, 13) != null; @@ -521,21 +561,24 @@ proto.ServerMessage.prototype.hasFail = function() { /** - * optional SuccessMessage success = 14; - * @return {?proto.SuccessMessage} + * optional Method.Success success = 14; + * @return {?proto.Method.Success} */ proto.ServerMessage.prototype.getSuccess = function() { - return /** @type{?proto.SuccessMessage} */ ( - jspb.Message.getWrapperField(this, node_pb.SuccessMessage, 14)); + return /** @type{?proto.Method.Success} */ ( + jspb.Message.getWrapperField(this, node_pb.Method.Success, 14)); }; -/** @param {?proto.SuccessMessage|undefined} value */ +/** @param {?proto.Method.Success|undefined} value */ proto.ServerMessage.prototype.setSuccess = function(value) { jspb.Message.setOneofWrapperField(this, 14, proto.ServerMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearSuccess = function() { this.setSuccess(undefined); }; @@ -543,7 +586,7 @@ proto.ServerMessage.prototype.clearSuccess = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasSuccess = function() { return jspb.Message.getField(this, 14) != null; @@ -551,21 +594,24 @@ proto.ServerMessage.prototype.hasSuccess = function() { /** - * optional EventMessage event = 19; - * @return {?proto.EventMessage} + * optional Event event = 19; + * @return {?proto.Event} */ proto.ServerMessage.prototype.getEvent = function() { - return /** @type{?proto.EventMessage} */ ( - jspb.Message.getWrapperField(this, node_pb.EventMessage, 19)); + return /** @type{?proto.Event} */ ( + jspb.Message.getWrapperField(this, node_pb.Event, 19)); }; -/** @param {?proto.EventMessage|undefined} value */ +/** @param {?proto.Event|undefined} value */ proto.ServerMessage.prototype.setEvent = function(value) { jspb.Message.setOneofWrapperField(this, 19, proto.ServerMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearEvent = function() { this.setEvent(undefined); }; @@ -573,7 +619,7 @@ proto.ServerMessage.prototype.clearEvent = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasEvent = function() { return jspb.Message.getField(this, 19) != null; @@ -581,21 +627,24 @@ proto.ServerMessage.prototype.hasEvent = function() { /** - * optional CallbackMessage callback = 22; - * @return {?proto.CallbackMessage} + * optional Callback callback = 22; + * @return {?proto.Callback} */ proto.ServerMessage.prototype.getCallback = function() { - return /** @type{?proto.CallbackMessage} */ ( - jspb.Message.getWrapperField(this, node_pb.CallbackMessage, 22)); + return /** @type{?proto.Callback} */ ( + jspb.Message.getWrapperField(this, node_pb.Callback, 22)); }; -/** @param {?proto.CallbackMessage|undefined} value */ +/** @param {?proto.Callback|undefined} value */ proto.ServerMessage.prototype.setCallback = function(value) { jspb.Message.setOneofWrapperField(this, 22, proto.ServerMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearCallback = function() { this.setCallback(undefined); }; @@ -603,7 +652,7 @@ proto.ServerMessage.prototype.clearCallback = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasCallback = function() { return jspb.Message.getField(this, 22) != null; @@ -626,6 +675,9 @@ proto.ServerMessage.prototype.setPong = function(value) { }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearPong = function() { this.setPong(undefined); }; @@ -633,7 +685,7 @@ proto.ServerMessage.prototype.clearPong = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasPong = function() { return jspb.Message.getField(this, 18) != null; @@ -641,21 +693,24 @@ proto.ServerMessage.prototype.hasPong = function() { /** - * optional WorkingInitMessage init = 16; - * @return {?proto.WorkingInitMessage} + * optional WorkingInit init = 16; + * @return {?proto.WorkingInit} */ proto.ServerMessage.prototype.getInit = function() { - return /** @type{?proto.WorkingInitMessage} */ ( - jspb.Message.getWrapperField(this, proto.WorkingInitMessage, 16)); + return /** @type{?proto.WorkingInit} */ ( + jspb.Message.getWrapperField(this, proto.WorkingInit, 16)); }; -/** @param {?proto.WorkingInitMessage|undefined} value */ +/** @param {?proto.WorkingInit|undefined} value */ proto.ServerMessage.prototype.setInit = function(value) { jspb.Message.setOneofWrapperField(this, 16, proto.ServerMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearInit = function() { this.setInit(undefined); }; @@ -663,7 +718,7 @@ proto.ServerMessage.prototype.clearInit = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasInit = function() { return jspb.Message.getField(this, 16) != null; @@ -671,21 +726,24 @@ proto.ServerMessage.prototype.hasInit = function() { /** - * optional SharedProcessActiveMessage shared_process_active = 17; - * @return {?proto.SharedProcessActiveMessage} + * optional SharedProcessActive shared_process_active = 17; + * @return {?proto.SharedProcessActive} */ proto.ServerMessage.prototype.getSharedProcessActive = function() { - return /** @type{?proto.SharedProcessActiveMessage} */ ( - jspb.Message.getWrapperField(this, vscode_pb.SharedProcessActiveMessage, 17)); + return /** @type{?proto.SharedProcessActive} */ ( + jspb.Message.getWrapperField(this, vscode_pb.SharedProcessActive, 17)); }; -/** @param {?proto.SharedProcessActiveMessage|undefined} value */ +/** @param {?proto.SharedProcessActive|undefined} value */ proto.ServerMessage.prototype.setSharedProcessActive = function(value) { jspb.Message.setOneofWrapperField(this, 17, proto.ServerMessage.oneofGroups_[0], value); }; +/** + * Clears the message field making it undefined. + */ proto.ServerMessage.prototype.clearSharedProcessActive = function() { this.setSharedProcessActive(undefined); }; @@ -693,7 +751,7 @@ proto.ServerMessage.prototype.clearSharedProcessActive = function() { /** * Returns whether this field is set. - * @return {!boolean} + * @return {boolean} */ proto.ServerMessage.prototype.hasSharedProcessActive = function() { return jspb.Message.getField(this, 17) != null; @@ -701,23 +759,6 @@ proto.ServerMessage.prototype.hasSharedProcessActive = function() { -/** - * 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.WorkingInitMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.WorkingInitMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.WorkingInitMessage.displayName = 'proto.WorkingInitMessage'; -} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -731,8 +772,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ -proto.WorkingInitMessage.prototype.toObject = function(opt_includeInstance) { - return proto.WorkingInitMessage.toObject(opt_includeInstance, this); +proto.WorkingInit.prototype.toObject = function(opt_includeInstance) { + return proto.WorkingInit.toObject(opt_includeInstance, this); }; @@ -741,12 +782,12 @@ proto.WorkingInitMessage.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.WorkingInitMessage} msg The msg instance to transform. + * @param {!proto.WorkingInit} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.WorkingInitMessage.toObject = function(includeInstance, msg) { - var f, obj = { +proto.WorkingInit.toObject = function(includeInstance, msg) { + var obj = { homeDirectory: jspb.Message.getFieldWithDefault(msg, 1, ""), tmpDirectory: jspb.Message.getFieldWithDefault(msg, 2, ""), dataDirectory: jspb.Message.getFieldWithDefault(msg, 3, ""), @@ -767,23 +808,23 @@ proto.WorkingInitMessage.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.WorkingInitMessage} + * @return {!proto.WorkingInit} */ -proto.WorkingInitMessage.deserializeBinary = function(bytes) { +proto.WorkingInit.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.WorkingInitMessage; - return proto.WorkingInitMessage.deserializeBinaryFromReader(msg, reader); + var msg = new proto.WorkingInit; + return proto.WorkingInit.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.WorkingInitMessage} msg The message object to deserialize into. + * @param {!proto.WorkingInit} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.WorkingInitMessage} + * @return {!proto.WorkingInit} */ -proto.WorkingInitMessage.deserializeBinaryFromReader = function(msg, reader) { +proto.WorkingInit.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -807,7 +848,7 @@ proto.WorkingInitMessage.deserializeBinaryFromReader = function(msg, reader) { msg.setWorkingDirectory(value); break; case 5: - var value = /** @type {!proto.WorkingInitMessage.OperatingSystem} */ (reader.readEnum()); + var value = /** @type {!proto.WorkingInit.OperatingSystem} */ (reader.readEnum()); msg.setOperatingSystem(value); break; case 6: @@ -831,9 +872,9 @@ proto.WorkingInitMessage.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.WorkingInitMessage.prototype.serializeBinary = function() { +proto.WorkingInit.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.WorkingInitMessage.serializeBinaryToWriter(this, writer); + proto.WorkingInit.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -841,11 +882,11 @@ proto.WorkingInitMessage.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.WorkingInitMessage} message + * @param {!proto.WorkingInit} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.WorkingInitMessage.serializeBinaryToWriter = function(message, writer) { +proto.WorkingInit.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getHomeDirectory(); if (f.length > 0) { @@ -902,7 +943,7 @@ proto.WorkingInitMessage.serializeBinaryToWriter = function(message, writer) { /** * @enum {number} */ -proto.WorkingInitMessage.OperatingSystem = { +proto.WorkingInit.OperatingSystem = { WINDOWS: 0, LINUX: 1, MAC: 2 @@ -912,13 +953,13 @@ proto.WorkingInitMessage.OperatingSystem = { * optional string home_directory = 1; * @return {string} */ -proto.WorkingInitMessage.prototype.getHomeDirectory = function() { +proto.WorkingInit.prototype.getHomeDirectory = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ -proto.WorkingInitMessage.prototype.setHomeDirectory = function(value) { +proto.WorkingInit.prototype.setHomeDirectory = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; @@ -927,13 +968,13 @@ proto.WorkingInitMessage.prototype.setHomeDirectory = function(value) { * optional string tmp_directory = 2; * @return {string} */ -proto.WorkingInitMessage.prototype.getTmpDirectory = function() { +proto.WorkingInit.prototype.getTmpDirectory = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ -proto.WorkingInitMessage.prototype.setTmpDirectory = function(value) { +proto.WorkingInit.prototype.setTmpDirectory = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; @@ -942,13 +983,13 @@ proto.WorkingInitMessage.prototype.setTmpDirectory = function(value) { * optional string data_directory = 3; * @return {string} */ -proto.WorkingInitMessage.prototype.getDataDirectory = function() { +proto.WorkingInit.prototype.getDataDirectory = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ -proto.WorkingInitMessage.prototype.setDataDirectory = function(value) { +proto.WorkingInit.prototype.setDataDirectory = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; @@ -957,28 +998,28 @@ proto.WorkingInitMessage.prototype.setDataDirectory = function(value) { * optional string working_directory = 4; * @return {string} */ -proto.WorkingInitMessage.prototype.getWorkingDirectory = function() { +proto.WorkingInit.prototype.getWorkingDirectory = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** @param {string} value */ -proto.WorkingInitMessage.prototype.setWorkingDirectory = function(value) { +proto.WorkingInit.prototype.setWorkingDirectory = function(value) { jspb.Message.setProto3StringField(this, 4, value); }; /** * optional OperatingSystem operating_system = 5; - * @return {!proto.WorkingInitMessage.OperatingSystem} + * @return {!proto.WorkingInit.OperatingSystem} */ -proto.WorkingInitMessage.prototype.getOperatingSystem = function() { - return /** @type {!proto.WorkingInitMessage.OperatingSystem} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.WorkingInit.prototype.getOperatingSystem = function() { + return /** @type {!proto.WorkingInit.OperatingSystem} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; -/** @param {!proto.WorkingInitMessage.OperatingSystem} value */ -proto.WorkingInitMessage.prototype.setOperatingSystem = function(value) { +/** @param {!proto.WorkingInit.OperatingSystem} value */ +proto.WorkingInit.prototype.setOperatingSystem = function(value) { jspb.Message.setProto3EnumField(this, 5, value); }; @@ -987,13 +1028,13 @@ proto.WorkingInitMessage.prototype.setOperatingSystem = function(value) { * optional string shell = 6; * @return {string} */ -proto.WorkingInitMessage.prototype.getShell = function() { +proto.WorkingInit.prototype.getShell = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; /** @param {string} value */ -proto.WorkingInitMessage.prototype.setShell = function(value) { +proto.WorkingInit.prototype.setShell = function(value) { jspb.Message.setProto3StringField(this, 6, value); }; @@ -1002,13 +1043,13 @@ proto.WorkingInitMessage.prototype.setShell = function(value) { * optional string builtin_extensions_dir = 7; * @return {string} */ -proto.WorkingInitMessage.prototype.getBuiltinExtensionsDir = function() { +proto.WorkingInit.prototype.getBuiltinExtensionsDir = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); }; /** @param {string} value */ -proto.WorkingInitMessage.prototype.setBuiltinExtensionsDir = function(value) { +proto.WorkingInit.prototype.setBuiltinExtensionsDir = function(value) { jspb.Message.setProto3StringField(this, 7, value); }; diff --git a/packages/protocol/src/proto/node.proto b/packages/protocol/src/proto/node.proto index 889e7741..43c00654 100644 --- a/packages/protocol/src/proto/node.proto +++ b/packages/protocol/src/proto/node.proto @@ -9,84 +9,128 @@ enum Module { Trash = 5; } -// A proxy identified by a unique name like "fs". -message NamedProxyMessage { - uint64 id = 1; - Module module = 2; - string method = 3; - repeated string args = 4; -} +message Argument { + message ErrorValue { + string message = 1; + string stack = 2; + string code = 3; + } -// A general proxy identified by an ID like WriteStream. -message NumberedProxyMessage { - uint64 id = 1; - uint64 proxy_id = 2; - string method = 3; - repeated string args = 4; + message BufferValue { + bytes data = 1; + } + + message ObjectValue { + map data = 1; + } + + message ArrayValue { + repeated Argument data = 1; + } + + message ProxyValue { + uint64 id = 1; + } + + message FunctionValue { + uint64 id = 1; + } + + message NullValue {} + + message UndefinedValue {} + + oneof msg { + ErrorValue error = 1; + BufferValue buffer = 2; + ObjectValue object = 3; + ArrayValue array = 4; + ProxyValue proxy = 5; + FunctionValue function = 6; + NullValue null = 7; + UndefinedValue undefined = 8; + double number = 9; + string string = 10; + bool boolean = 11; + } } // Call a remote method. -message MethodMessage { +message Method { + // A proxy identified by a unique name like "fs". + message Named { + uint64 id = 1; + Module module = 2; + string method = 3; + repeated Argument args = 4; + } + + // A general proxy identified by an ID like WriteStream. + message Numbered { + uint64 id = 1; + uint64 proxy_id = 2; + string method = 3; + repeated Argument args = 4; + } + + // Remote method failed. + message Fail { + uint64 id = 1; + Argument response = 2; + } + + // Remote method succeeded. + message Success { + uint64 id = 1; + Argument response = 2; + } + oneof msg { - NamedProxyMessage named_proxy = 1; - NumberedProxyMessage numbered_proxy = 2; + Method.Named named_proxy = 1; + Method.Numbered numbered_proxy = 2; } } -// Call a remote callback. -message CallbackMessage { +message Callback { + // A remote callback for uniquely named proxy. + message Named { + Module module = 1; + uint64 callback_id = 2; + repeated Argument args = 3; + } + + // A remote callback for a numbered proxy. + message Numbered { + uint64 proxy_id = 1; + uint64 callback_id = 2; + repeated Argument args = 3; + } + oneof msg { - NamedCallbackMessage named_callback = 1; - NumberedCallbackMessage numbered_callback = 2; + Callback.Named named_callback = 1; + Callback.Numbered numbered_callback = 2; } } -// A remote callback for uniquely named proxy. -message NamedCallbackMessage { - Module module = 1; - uint64 callback_id = 2; - repeated string args = 3; -} - -// A remote callback for a numbered proxy. -message NumberedCallbackMessage { - uint64 proxy_id = 1; - uint64 callback_id = 2; - repeated string args = 3; -} - -// Emit an event. -message EventMessage { - oneof msg { - NamedEventMessage named_event = 1; - NumberedEventMessage numbered_event = 2; +message Event { + // Emit an event on a uniquely named proxy. + message Named { + Module module = 1; + string event = 2; + repeated Argument args = 3; } -} -// Emit an event on a uniquely named proxy. -message NamedEventMessage { - Module module = 1; - string event = 2; - repeated string args = 3; -} + // Emit an event on a numbered proxy. + message Numbered { + uint64 proxy_id = 1; + string event = 2; + repeated Argument args = 3; + } -// Emit an event on a numbered proxy. -message NumberedEventMessage { - uint64 proxy_id = 1; - string event = 2; - repeated string args = 3; -} - -// Remote method failed. -message FailMessage { - uint64 id = 1; - string response = 2; -} - -// Remote method succeeded. -message SuccessMessage { - uint64 id = 1; - string response = 2; + oneof msg { + Event.Named named_event = 1; + Event.Numbered numbered_event = 2; + } } message Ping {} diff --git a/packages/protocol/src/proto/node_pb.d.ts b/packages/protocol/src/proto/node_pb.d.ts index ded41450..b70d87f7 100644 --- a/packages/protocol/src/proto/node_pb.d.ts +++ b/packages/protocol/src/proto/node_pb.d.ts @@ -3,100 +3,413 @@ import * as jspb from "google-protobuf"; -export class NamedProxyMessage extends jspb.Message { - getId(): number; - setId(value: number): void; +export class Argument extends jspb.Message { + hasError(): boolean; + clearError(): void; + getError(): Argument.ErrorValue | undefined; + setError(value?: Argument.ErrorValue): void; - getModule(): Module; - setModule(value: Module): void; + hasBuffer(): boolean; + clearBuffer(): void; + getBuffer(): Argument.BufferValue | undefined; + setBuffer(value?: Argument.BufferValue): void; - getMethod(): string; - setMethod(value: string): void; + hasObject(): boolean; + clearObject(): void; + getObject(): Argument.ObjectValue | undefined; + setObject(value?: Argument.ObjectValue): void; - clearArgsList(): void; - getArgsList(): Array; - setArgsList(value: Array): void; - addArgs(value: string, index?: number): string; + hasArray(): boolean; + clearArray(): void; + getArray(): Argument.ArrayValue | undefined; + setArray(value?: Argument.ArrayValue): void; + hasProxy(): boolean; + clearProxy(): void; + getProxy(): Argument.ProxyValue | undefined; + setProxy(value?: Argument.ProxyValue): void; + + hasFunction(): boolean; + clearFunction(): void; + getFunction(): Argument.FunctionValue | undefined; + setFunction(value?: Argument.FunctionValue): void; + + hasNull(): boolean; + clearNull(): void; + getNull(): Argument.NullValue | undefined; + setNull(value?: Argument.NullValue): void; + + hasUndefined(): boolean; + clearUndefined(): void; + getUndefined(): Argument.UndefinedValue | undefined; + setUndefined(value?: Argument.UndefinedValue): void; + + hasNumber(): boolean; + clearNumber(): void; + getNumber(): number; + setNumber(value: number): void; + + hasString(): boolean; + clearString(): void; + getString(): string; + setString(value: string): void; + + hasBoolean(): boolean; + clearBoolean(): void; + getBoolean(): boolean; + setBoolean(value: boolean): void; + + getMsgCase(): Argument.MsgCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NamedProxyMessage.AsObject; - static toObject(includeInstance: boolean, msg: NamedProxyMessage): NamedProxyMessage.AsObject; + toObject(includeInstance?: boolean): Argument.AsObject; + static toObject(includeInstance: boolean, msg: Argument): Argument.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NamedProxyMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NamedProxyMessage; - static deserializeBinaryFromReader(message: NamedProxyMessage, reader: jspb.BinaryReader): NamedProxyMessage; + static serializeBinaryToWriter(message: Argument, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Argument; + static deserializeBinaryFromReader(message: Argument, reader: jspb.BinaryReader): Argument; } -export namespace NamedProxyMessage { +export namespace Argument { export type AsObject = { - id: number, - module: Module, - method: string, - argsList: Array, + error?: Argument.ErrorValue.AsObject, + buffer?: Argument.BufferValue.AsObject, + object?: Argument.ObjectValue.AsObject, + array?: Argument.ArrayValue.AsObject, + proxy?: Argument.ProxyValue.AsObject, + pb_function?: Argument.FunctionValue.AsObject, + pb_null?: Argument.NullValue.AsObject, + undefined?: Argument.UndefinedValue.AsObject, + number: number, + string: string, + pb_boolean: boolean, + } + + export class ErrorValue extends jspb.Message { + getMessage(): string; + setMessage(value: string): void; + + getStack(): string; + setStack(value: string): void; + + getCode(): string; + setCode(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ErrorValue.AsObject; + static toObject(includeInstance: boolean, msg: ErrorValue): ErrorValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ErrorValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ErrorValue; + static deserializeBinaryFromReader(message: ErrorValue, reader: jspb.BinaryReader): ErrorValue; + } + + export namespace ErrorValue { + export type AsObject = { + message: string, + stack: string, + code: string, + } + } + + export class BufferValue extends jspb.Message { + getData(): Uint8Array | string; + getData_asU8(): Uint8Array; + getData_asB64(): string; + setData(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BufferValue.AsObject; + static toObject(includeInstance: boolean, msg: BufferValue): BufferValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: BufferValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BufferValue; + static deserializeBinaryFromReader(message: BufferValue, reader: jspb.BinaryReader): BufferValue; + } + + export namespace BufferValue { + export type AsObject = { + data: Uint8Array | string, + } + } + + export class ObjectValue extends jspb.Message { + getDataMap(): jspb.Map; + clearDataMap(): void; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ObjectValue.AsObject; + static toObject(includeInstance: boolean, msg: ObjectValue): ObjectValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ObjectValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ObjectValue; + static deserializeBinaryFromReader(message: ObjectValue, reader: jspb.BinaryReader): ObjectValue; + } + + export namespace ObjectValue { + export type AsObject = { + dataMap: Array<[string, Argument.AsObject]>, + } + } + + export class ArrayValue extends jspb.Message { + clearDataList(): void; + getDataList(): Array; + setDataList(value: Array): void; + addData(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ArrayValue.AsObject; + static toObject(includeInstance: boolean, msg: ArrayValue): ArrayValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ArrayValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ArrayValue; + static deserializeBinaryFromReader(message: ArrayValue, reader: jspb.BinaryReader): ArrayValue; + } + + export namespace ArrayValue { + export type AsObject = { + dataList: Array, + } + } + + export class ProxyValue extends jspb.Message { + getId(): number; + setId(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProxyValue.AsObject; + static toObject(includeInstance: boolean, msg: ProxyValue): ProxyValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ProxyValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProxyValue; + static deserializeBinaryFromReader(message: ProxyValue, reader: jspb.BinaryReader): ProxyValue; + } + + export namespace ProxyValue { + export type AsObject = { + id: number, + } + } + + export class FunctionValue extends jspb.Message { + getId(): number; + setId(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FunctionValue.AsObject; + static toObject(includeInstance: boolean, msg: FunctionValue): FunctionValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FunctionValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FunctionValue; + static deserializeBinaryFromReader(message: FunctionValue, reader: jspb.BinaryReader): FunctionValue; + } + + export namespace FunctionValue { + export type AsObject = { + id: number, + } + } + + export class NullValue extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NullValue.AsObject; + static toObject(includeInstance: boolean, msg: NullValue): NullValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NullValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NullValue; + static deserializeBinaryFromReader(message: NullValue, reader: jspb.BinaryReader): NullValue; + } + + export namespace NullValue { + export type AsObject = { + } + } + + export class UndefinedValue extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UndefinedValue.AsObject; + static toObject(includeInstance: boolean, msg: UndefinedValue): UndefinedValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UndefinedValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UndefinedValue; + static deserializeBinaryFromReader(message: UndefinedValue, reader: jspb.BinaryReader): UndefinedValue; + } + + export namespace UndefinedValue { + export type AsObject = { + } + } + + export enum MsgCase { + MSG_NOT_SET = 0, + ERROR = 1, + BUFFER = 2, + OBJECT = 3, + ARRAY = 4, + PROXY = 5, + FUNCTION = 6, + NULL = 7, + UNDEFINED = 8, + NUMBER = 9, + STRING = 10, + BOOLEAN = 11, } } -export class NumberedProxyMessage extends jspb.Message { - getId(): number; - setId(value: number): void; - - getProxyId(): number; - setProxyId(value: number): void; - - getMethod(): string; - setMethod(value: string): void; - - clearArgsList(): void; - getArgsList(): Array; - setArgsList(value: Array): void; - addArgs(value: string, index?: number): string; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NumberedProxyMessage.AsObject; - static toObject(includeInstance: boolean, msg: NumberedProxyMessage): NumberedProxyMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NumberedProxyMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NumberedProxyMessage; - static deserializeBinaryFromReader(message: NumberedProxyMessage, reader: jspb.BinaryReader): NumberedProxyMessage; -} - -export namespace NumberedProxyMessage { - export type AsObject = { - id: number, - proxyId: number, - method: string, - argsList: Array, - } -} - -export class MethodMessage extends jspb.Message { +export class Method extends jspb.Message { hasNamedProxy(): boolean; clearNamedProxy(): void; - getNamedProxy(): NamedProxyMessage | undefined; - setNamedProxy(value?: NamedProxyMessage): void; + getNamedProxy(): Method.Named | undefined; + setNamedProxy(value?: Method.Named): void; hasNumberedProxy(): boolean; clearNumberedProxy(): void; - getNumberedProxy(): NumberedProxyMessage | undefined; - setNumberedProxy(value?: NumberedProxyMessage): void; + getNumberedProxy(): Method.Numbered | undefined; + setNumberedProxy(value?: Method.Numbered): void; - getMsgCase(): MethodMessage.MsgCase; + getMsgCase(): Method.MsgCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): MethodMessage.AsObject; - static toObject(includeInstance: boolean, msg: MethodMessage): MethodMessage.AsObject; + toObject(includeInstance?: boolean): Method.AsObject; + static toObject(includeInstance: boolean, msg: Method): Method.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: MethodMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): MethodMessage; - static deserializeBinaryFromReader(message: MethodMessage, reader: jspb.BinaryReader): MethodMessage; + static serializeBinaryToWriter(message: Method, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Method; + static deserializeBinaryFromReader(message: Method, reader: jspb.BinaryReader): Method; } -export namespace MethodMessage { +export namespace Method { export type AsObject = { - namedProxy?: NamedProxyMessage.AsObject, - numberedProxy?: NumberedProxyMessage.AsObject, + namedProxy?: Method.Named.AsObject, + numberedProxy?: Method.Numbered.AsObject, + } + + export class Named extends jspb.Message { + getId(): number; + setId(value: number): void; + + getModule(): Module; + setModule(value: Module): void; + + getMethod(): string; + setMethod(value: string): void; + + clearArgsList(): void; + getArgsList(): Array; + setArgsList(value: Array): void; + addArgs(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Named.AsObject; + static toObject(includeInstance: boolean, msg: Named): Named.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Named, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Named; + static deserializeBinaryFromReader(message: Named, reader: jspb.BinaryReader): Named; + } + + export namespace Named { + export type AsObject = { + id: number, + module: Module, + method: string, + argsList: Array, + } + } + + export class Numbered extends jspb.Message { + getId(): number; + setId(value: number): void; + + getProxyId(): number; + setProxyId(value: number): void; + + getMethod(): string; + setMethod(value: string): void; + + clearArgsList(): void; + getArgsList(): Array; + setArgsList(value: Array): void; + addArgs(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Numbered.AsObject; + static toObject(includeInstance: boolean, msg: Numbered): Numbered.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Numbered, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Numbered; + static deserializeBinaryFromReader(message: Numbered, reader: jspb.BinaryReader): Numbered; + } + + export namespace Numbered { + export type AsObject = { + id: number, + proxyId: number, + method: string, + argsList: Array, + } + } + + export class Fail extends jspb.Message { + getId(): number; + setId(value: number): void; + + hasResponse(): boolean; + clearResponse(): void; + getResponse(): Argument | undefined; + setResponse(value?: Argument): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Fail.AsObject; + static toObject(includeInstance: boolean, msg: Fail): Fail.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Fail, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Fail; + static deserializeBinaryFromReader(message: Fail, reader: jspb.BinaryReader): Fail; + } + + export namespace Fail { + export type AsObject = { + id: number, + response?: Argument.AsObject, + } + } + + export class Success extends jspb.Message { + getId(): number; + setId(value: number): void; + + hasResponse(): boolean; + clearResponse(): void; + getResponse(): Argument | undefined; + setResponse(value?: Argument): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Success.AsObject; + static toObject(includeInstance: boolean, msg: Success): Success.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Success, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Success; + static deserializeBinaryFromReader(message: Success, reader: jspb.BinaryReader): Success; + } + + export namespace Success { + export type AsObject = { + id: number, + response?: Argument.AsObject, + } } export enum MsgCase { @@ -106,32 +419,92 @@ export namespace MethodMessage { } } -export class CallbackMessage extends jspb.Message { +export class Callback extends jspb.Message { hasNamedCallback(): boolean; clearNamedCallback(): void; - getNamedCallback(): NamedCallbackMessage | undefined; - setNamedCallback(value?: NamedCallbackMessage): void; + getNamedCallback(): Callback.Named | undefined; + setNamedCallback(value?: Callback.Named): void; hasNumberedCallback(): boolean; clearNumberedCallback(): void; - getNumberedCallback(): NumberedCallbackMessage | undefined; - setNumberedCallback(value?: NumberedCallbackMessage): void; + getNumberedCallback(): Callback.Numbered | undefined; + setNumberedCallback(value?: Callback.Numbered): void; - getMsgCase(): CallbackMessage.MsgCase; + getMsgCase(): Callback.MsgCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): CallbackMessage.AsObject; - static toObject(includeInstance: boolean, msg: CallbackMessage): CallbackMessage.AsObject; + toObject(includeInstance?: boolean): Callback.AsObject; + static toObject(includeInstance: boolean, msg: Callback): Callback.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: CallbackMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): CallbackMessage; - static deserializeBinaryFromReader(message: CallbackMessage, reader: jspb.BinaryReader): CallbackMessage; + static serializeBinaryToWriter(message: Callback, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Callback; + static deserializeBinaryFromReader(message: Callback, reader: jspb.BinaryReader): Callback; } -export namespace CallbackMessage { +export namespace Callback { export type AsObject = { - namedCallback?: NamedCallbackMessage.AsObject, - numberedCallback?: NumberedCallbackMessage.AsObject, + namedCallback?: Callback.Named.AsObject, + numberedCallback?: Callback.Numbered.AsObject, + } + + export class Named extends jspb.Message { + getModule(): Module; + setModule(value: Module): void; + + getCallbackId(): number; + setCallbackId(value: number): void; + + clearArgsList(): void; + getArgsList(): Array; + setArgsList(value: Array): void; + addArgs(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Named.AsObject; + static toObject(includeInstance: boolean, msg: Named): Named.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Named, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Named; + static deserializeBinaryFromReader(message: Named, reader: jspb.BinaryReader): Named; + } + + export namespace Named { + export type AsObject = { + module: Module, + callbackId: number, + argsList: Array, + } + } + + export class Numbered extends jspb.Message { + getProxyId(): number; + setProxyId(value: number): void; + + getCallbackId(): number; + setCallbackId(value: number): void; + + clearArgsList(): void; + getArgsList(): Array; + setArgsList(value: Array): void; + addArgs(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Numbered.AsObject; + static toObject(includeInstance: boolean, msg: Numbered): Numbered.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Numbered, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Numbered; + static deserializeBinaryFromReader(message: Numbered, reader: jspb.BinaryReader): Numbered; + } + + export namespace Numbered { + export type AsObject = { + proxyId: number, + callbackId: number, + argsList: Array, + } } export enum MsgCase { @@ -141,92 +514,92 @@ export namespace CallbackMessage { } } -export class NamedCallbackMessage extends jspb.Message { - getModule(): Module; - setModule(value: Module): void; - - getCallbackId(): number; - setCallbackId(value: number): void; - - clearArgsList(): void; - getArgsList(): Array; - setArgsList(value: Array): void; - addArgs(value: string, index?: number): string; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NamedCallbackMessage.AsObject; - static toObject(includeInstance: boolean, msg: NamedCallbackMessage): NamedCallbackMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NamedCallbackMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NamedCallbackMessage; - static deserializeBinaryFromReader(message: NamedCallbackMessage, reader: jspb.BinaryReader): NamedCallbackMessage; -} - -export namespace NamedCallbackMessage { - export type AsObject = { - module: Module, - callbackId: number, - argsList: Array, - } -} - -export class NumberedCallbackMessage extends jspb.Message { - getProxyId(): number; - setProxyId(value: number): void; - - getCallbackId(): number; - setCallbackId(value: number): void; - - clearArgsList(): void; - getArgsList(): Array; - setArgsList(value: Array): void; - addArgs(value: string, index?: number): string; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NumberedCallbackMessage.AsObject; - static toObject(includeInstance: boolean, msg: NumberedCallbackMessage): NumberedCallbackMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NumberedCallbackMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NumberedCallbackMessage; - static deserializeBinaryFromReader(message: NumberedCallbackMessage, reader: jspb.BinaryReader): NumberedCallbackMessage; -} - -export namespace NumberedCallbackMessage { - export type AsObject = { - proxyId: number, - callbackId: number, - argsList: Array, - } -} - -export class EventMessage extends jspb.Message { +export class Event extends jspb.Message { hasNamedEvent(): boolean; clearNamedEvent(): void; - getNamedEvent(): NamedEventMessage | undefined; - setNamedEvent(value?: NamedEventMessage): void; + getNamedEvent(): Event.Named | undefined; + setNamedEvent(value?: Event.Named): void; hasNumberedEvent(): boolean; clearNumberedEvent(): void; - getNumberedEvent(): NumberedEventMessage | undefined; - setNumberedEvent(value?: NumberedEventMessage): void; + getNumberedEvent(): Event.Numbered | undefined; + setNumberedEvent(value?: Event.Numbered): void; - getMsgCase(): EventMessage.MsgCase; + getMsgCase(): Event.MsgCase; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): EventMessage.AsObject; - static toObject(includeInstance: boolean, msg: EventMessage): EventMessage.AsObject; + toObject(includeInstance?: boolean): Event.AsObject; + static toObject(includeInstance: boolean, msg: Event): Event.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: EventMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): EventMessage; - static deserializeBinaryFromReader(message: EventMessage, reader: jspb.BinaryReader): EventMessage; + static serializeBinaryToWriter(message: Event, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Event; + static deserializeBinaryFromReader(message: Event, reader: jspb.BinaryReader): Event; } -export namespace EventMessage { +export namespace Event { export type AsObject = { - namedEvent?: NamedEventMessage.AsObject, - numberedEvent?: NumberedEventMessage.AsObject, + namedEvent?: Event.Named.AsObject, + numberedEvent?: Event.Numbered.AsObject, + } + + export class Named extends jspb.Message { + getModule(): Module; + setModule(value: Module): void; + + getEvent(): string; + setEvent(value: string): void; + + clearArgsList(): void; + getArgsList(): Array; + setArgsList(value: Array): void; + addArgs(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Named.AsObject; + static toObject(includeInstance: boolean, msg: Named): Named.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Named, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Named; + static deserializeBinaryFromReader(message: Named, reader: jspb.BinaryReader): Named; + } + + export namespace Named { + export type AsObject = { + module: Module, + event: string, + argsList: Array, + } + } + + export class Numbered extends jspb.Message { + getProxyId(): number; + setProxyId(value: number): void; + + getEvent(): string; + setEvent(value: string): void; + + clearArgsList(): void; + getArgsList(): Array; + setArgsList(value: Array): void; + addArgs(value?: Argument, index?: number): Argument; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Numbered.AsObject; + static toObject(includeInstance: boolean, msg: Numbered): Numbered.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Numbered, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Numbered; + static deserializeBinaryFromReader(message: Numbered, reader: jspb.BinaryReader): Numbered; + } + + export namespace Numbered { + export type AsObject = { + proxyId: number, + event: string, + argsList: Array, + } } export enum MsgCase { @@ -236,114 +609,6 @@ export namespace EventMessage { } } -export class NamedEventMessage extends jspb.Message { - getModule(): Module; - setModule(value: Module): void; - - getEvent(): string; - setEvent(value: string): void; - - clearArgsList(): void; - getArgsList(): Array; - setArgsList(value: Array): void; - addArgs(value: string, index?: number): string; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NamedEventMessage.AsObject; - static toObject(includeInstance: boolean, msg: NamedEventMessage): NamedEventMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NamedEventMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NamedEventMessage; - static deserializeBinaryFromReader(message: NamedEventMessage, reader: jspb.BinaryReader): NamedEventMessage; -} - -export namespace NamedEventMessage { - export type AsObject = { - module: Module, - event: string, - argsList: Array, - } -} - -export class NumberedEventMessage extends jspb.Message { - getProxyId(): number; - setProxyId(value: number): void; - - getEvent(): string; - setEvent(value: string): void; - - clearArgsList(): void; - getArgsList(): Array; - setArgsList(value: Array): void; - addArgs(value: string, index?: number): string; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NumberedEventMessage.AsObject; - static toObject(includeInstance: boolean, msg: NumberedEventMessage): NumberedEventMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NumberedEventMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NumberedEventMessage; - static deserializeBinaryFromReader(message: NumberedEventMessage, reader: jspb.BinaryReader): NumberedEventMessage; -} - -export namespace NumberedEventMessage { - export type AsObject = { - proxyId: number, - event: string, - argsList: Array, - } -} - -export class FailMessage extends jspb.Message { - getId(): number; - setId(value: number): void; - - getResponse(): string; - setResponse(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): FailMessage.AsObject; - static toObject(includeInstance: boolean, msg: FailMessage): FailMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: FailMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): FailMessage; - static deserializeBinaryFromReader(message: FailMessage, reader: jspb.BinaryReader): FailMessage; -} - -export namespace FailMessage { - export type AsObject = { - id: number, - response: string, - } -} - -export class SuccessMessage extends jspb.Message { - getId(): number; - setId(value: number): void; - - getResponse(): string; - setResponse(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SuccessMessage.AsObject; - static toObject(includeInstance: boolean, msg: SuccessMessage): SuccessMessage.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SuccessMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SuccessMessage; - static deserializeBinaryFromReader(message: SuccessMessage, reader: jspb.BinaryReader): SuccessMessage; -} - -export namespace SuccessMessage { - export type AsObject = { - id: number, - response: string, - } -} - export class Ping extends jspb.Message { serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Ping.AsObject; diff --git a/packages/protocol/src/proto/node_pb.js b/packages/protocol/src/proto/node_pb.js index a0423f9c..c452afd3 100644 --- a/packages/protocol/src/proto/node_pb.js +++ b/packages/protocol/src/proto/node_pb.js @@ -11,21 +11,29 @@ var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); -goog.exportSymbol('proto.CallbackMessage', null, global); -goog.exportSymbol('proto.EventMessage', null, global); -goog.exportSymbol('proto.FailMessage', null, global); -goog.exportSymbol('proto.MethodMessage', null, global); +goog.exportSymbol('proto.Argument', null, global); +goog.exportSymbol('proto.Argument.ArrayValue', null, global); +goog.exportSymbol('proto.Argument.BufferValue', null, global); +goog.exportSymbol('proto.Argument.ErrorValue', null, global); +goog.exportSymbol('proto.Argument.FunctionValue', null, global); +goog.exportSymbol('proto.Argument.NullValue', null, global); +goog.exportSymbol('proto.Argument.ObjectValue', null, global); +goog.exportSymbol('proto.Argument.ProxyValue', null, global); +goog.exportSymbol('proto.Argument.UndefinedValue', null, global); +goog.exportSymbol('proto.Callback', null, global); +goog.exportSymbol('proto.Callback.Named', null, global); +goog.exportSymbol('proto.Callback.Numbered', null, global); +goog.exportSymbol('proto.Event', null, global); +goog.exportSymbol('proto.Event.Named', null, global); +goog.exportSymbol('proto.Event.Numbered', null, global); +goog.exportSymbol('proto.Method', null, global); +goog.exportSymbol('proto.Method.Fail', null, global); +goog.exportSymbol('proto.Method.Named', null, global); +goog.exportSymbol('proto.Method.Numbered', null, global); +goog.exportSymbol('proto.Method.Success', null, global); goog.exportSymbol('proto.Module', null, global); -goog.exportSymbol('proto.NamedCallbackMessage', null, global); -goog.exportSymbol('proto.NamedEventMessage', null, global); -goog.exportSymbol('proto.NamedProxyMessage', null, global); -goog.exportSymbol('proto.NumberedCallbackMessage', null, global); -goog.exportSymbol('proto.NumberedEventMessage', null, global); -goog.exportSymbol('proto.NumberedProxyMessage', null, global); goog.exportSymbol('proto.Ping', null, global); goog.exportSymbol('proto.Pong', null, global); -goog.exportSymbol('proto.SuccessMessage', null, global); - /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -36,240 +44,17 @@ goog.exportSymbol('proto.SuccessMessage', null, global); * @extends {jspb.Message} * @constructor */ -proto.NamedProxyMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.NamedProxyMessage.repeatedFields_, null); +proto.Argument = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.Argument.oneofGroups_); }; -goog.inherits(proto.NamedProxyMessage, jspb.Message); +goog.inherits(proto.Argument, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.NamedProxyMessage.displayName = 'proto.NamedProxyMessage'; + /** + * @public + * @override + */ + proto.Argument.displayName = 'proto.Argument'; } -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.NamedProxyMessage.repeatedFields_ = [4]; - - - -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.NamedProxyMessage.prototype.toObject = function(opt_includeInstance) { - return proto.NamedProxyMessage.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.NamedProxyMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NamedProxyMessage.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, 0), - module: jspb.Message.getFieldWithDefault(msg, 2, 0), - method: jspb.Message.getFieldWithDefault(msg, 3, ""), - argsList: jspb.Message.getRepeatedField(msg, 4) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.NamedProxyMessage} - */ -proto.NamedProxyMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.NamedProxyMessage; - return proto.NamedProxyMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.NamedProxyMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.NamedProxyMessage} - */ -proto.NamedProxyMessage.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.Module} */ (reader.readEnum()); - msg.setModule(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setMethod(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.addArgs(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.NamedProxyMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.NamedProxyMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.NamedProxyMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NamedProxyMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getModule(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } - f = message.getMethod(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getArgsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 4, - f - ); - } -}; - - -/** - * optional uint64 id = 1; - * @return {number} - */ -proto.NamedProxyMessage.prototype.getId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.NamedProxyMessage.prototype.setId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional Module module = 2; - * @return {!proto.Module} - */ -proto.NamedProxyMessage.prototype.getModule = function() { - return /** @type {!proto.Module} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** @param {!proto.Module} value */ -proto.NamedProxyMessage.prototype.setModule = function(value) { - jspb.Message.setProto3EnumField(this, 2, value); -}; - - -/** - * optional string method = 3; - * @return {string} - */ -proto.NamedProxyMessage.prototype.getMethod = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** @param {string} value */ -proto.NamedProxyMessage.prototype.setMethod = function(value) { - jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * repeated string args = 4; - * @return {!Array} - */ -proto.NamedProxyMessage.prototype.getArgsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); -}; - - -/** @param {!Array} value */ -proto.NamedProxyMessage.prototype.setArgsList = function(value) { - jspb.Message.setField(this, 4, value || []); -}; - - -/** - * @param {!string} value - * @param {number=} opt_index - */ -proto.NamedProxyMessage.prototype.addArgs = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 4, value, opt_index); -}; - - -proto.NamedProxyMessage.prototype.clearArgsList = function() { - this.setArgsList([]); -}; - - - /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -280,1964 +65,17 @@ proto.NamedProxyMessage.prototype.clearArgsList = function() { * @extends {jspb.Message} * @constructor */ -proto.NumberedProxyMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.NumberedProxyMessage.repeatedFields_, null); -}; -goog.inherits(proto.NumberedProxyMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.NumberedProxyMessage.displayName = 'proto.NumberedProxyMessage'; -} -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.NumberedProxyMessage.repeatedFields_ = [4]; - - - -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.NumberedProxyMessage.prototype.toObject = function(opt_includeInstance) { - return proto.NumberedProxyMessage.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.NumberedProxyMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NumberedProxyMessage.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, 0), - proxyId: jspb.Message.getFieldWithDefault(msg, 2, 0), - method: jspb.Message.getFieldWithDefault(msg, 3, ""), - argsList: jspb.Message.getRepeatedField(msg, 4) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.NumberedProxyMessage} - */ -proto.NumberedProxyMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.NumberedProxyMessage; - return proto.NumberedProxyMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.NumberedProxyMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.NumberedProxyMessage} - */ -proto.NumberedProxyMessage.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.setProxyId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setMethod(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.addArgs(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.NumberedProxyMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.NumberedProxyMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.NumberedProxyMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NumberedProxyMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getProxyId(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getMethod(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getArgsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 4, - f - ); - } -}; - - -/** - * optional uint64 id = 1; - * @return {number} - */ -proto.NumberedProxyMessage.prototype.getId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.NumberedProxyMessage.prototype.setId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 proxy_id = 2; - * @return {number} - */ -proto.NumberedProxyMessage.prototype.getProxyId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** @param {number} value */ -proto.NumberedProxyMessage.prototype.setProxyId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional string method = 3; - * @return {string} - */ -proto.NumberedProxyMessage.prototype.getMethod = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** @param {string} value */ -proto.NumberedProxyMessage.prototype.setMethod = function(value) { - jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * repeated string args = 4; - * @return {!Array} - */ -proto.NumberedProxyMessage.prototype.getArgsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); -}; - - -/** @param {!Array} value */ -proto.NumberedProxyMessage.prototype.setArgsList = function(value) { - jspb.Message.setField(this, 4, value || []); -}; - - -/** - * @param {!string} value - * @param {number=} opt_index - */ -proto.NumberedProxyMessage.prototype.addArgs = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 4, value, opt_index); -}; - - -proto.NumberedProxyMessage.prototype.clearArgsList = function() { - this.setArgsList([]); -}; - - - -/** - * 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.MethodMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.MethodMessage.oneofGroups_); -}; -goog.inherits(proto.MethodMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.MethodMessage.displayName = 'proto.MethodMessage'; -} -/** - * 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.MethodMessage.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.MethodMessage.MsgCase = { - MSG_NOT_SET: 0, - NAMED_PROXY: 1, - NUMBERED_PROXY: 2 -}; - -/** - * @return {proto.MethodMessage.MsgCase} - */ -proto.MethodMessage.prototype.getMsgCase = function() { - return /** @type {proto.MethodMessage.MsgCase} */(jspb.Message.computeOneofCase(this, proto.MethodMessage.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.MethodMessage.prototype.toObject = function(opt_includeInstance) { - return proto.MethodMessage.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.MethodMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.MethodMessage.toObject = function(includeInstance, msg) { - var f, obj = { - namedProxy: (f = msg.getNamedProxy()) && proto.NamedProxyMessage.toObject(includeInstance, f), - numberedProxy: (f = msg.getNumberedProxy()) && proto.NumberedProxyMessage.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.MethodMessage} - */ -proto.MethodMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.MethodMessage; - return proto.MethodMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.MethodMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.MethodMessage} - */ -proto.MethodMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.NamedProxyMessage; - reader.readMessage(value,proto.NamedProxyMessage.deserializeBinaryFromReader); - msg.setNamedProxy(value); - break; - case 2: - var value = new proto.NumberedProxyMessage; - reader.readMessage(value,proto.NumberedProxyMessage.deserializeBinaryFromReader); - msg.setNumberedProxy(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.MethodMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.MethodMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.MethodMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.MethodMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNamedProxy(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.NamedProxyMessage.serializeBinaryToWriter - ); - } - f = message.getNumberedProxy(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.NumberedProxyMessage.serializeBinaryToWriter - ); - } -}; - - -/** - * optional NamedProxyMessage named_proxy = 1; - * @return {?proto.NamedProxyMessage} - */ -proto.MethodMessage.prototype.getNamedProxy = function() { - return /** @type{?proto.NamedProxyMessage} */ ( - jspb.Message.getWrapperField(this, proto.NamedProxyMessage, 1)); -}; - - -/** @param {?proto.NamedProxyMessage|undefined} value */ -proto.MethodMessage.prototype.setNamedProxy = function(value) { - jspb.Message.setOneofWrapperField(this, 1, proto.MethodMessage.oneofGroups_[0], value); -}; - - -proto.MethodMessage.prototype.clearNamedProxy = function() { - this.setNamedProxy(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.MethodMessage.prototype.hasNamedProxy = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional NumberedProxyMessage numbered_proxy = 2; - * @return {?proto.NumberedProxyMessage} - */ -proto.MethodMessage.prototype.getNumberedProxy = function() { - return /** @type{?proto.NumberedProxyMessage} */ ( - jspb.Message.getWrapperField(this, proto.NumberedProxyMessage, 2)); -}; - - -/** @param {?proto.NumberedProxyMessage|undefined} value */ -proto.MethodMessage.prototype.setNumberedProxy = function(value) { - jspb.Message.setOneofWrapperField(this, 2, proto.MethodMessage.oneofGroups_[0], value); -}; - - -proto.MethodMessage.prototype.clearNumberedProxy = function() { - this.setNumberedProxy(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.MethodMessage.prototype.hasNumberedProxy = 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.CallbackMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.CallbackMessage.oneofGroups_); -}; -goog.inherits(proto.CallbackMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.CallbackMessage.displayName = 'proto.CallbackMessage'; -} -/** - * 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.CallbackMessage.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.CallbackMessage.MsgCase = { - MSG_NOT_SET: 0, - NAMED_CALLBACK: 1, - NUMBERED_CALLBACK: 2 -}; - -/** - * @return {proto.CallbackMessage.MsgCase} - */ -proto.CallbackMessage.prototype.getMsgCase = function() { - return /** @type {proto.CallbackMessage.MsgCase} */(jspb.Message.computeOneofCase(this, proto.CallbackMessage.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.CallbackMessage.prototype.toObject = function(opt_includeInstance) { - return proto.CallbackMessage.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.CallbackMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.CallbackMessage.toObject = function(includeInstance, msg) { - var f, obj = { - namedCallback: (f = msg.getNamedCallback()) && proto.NamedCallbackMessage.toObject(includeInstance, f), - numberedCallback: (f = msg.getNumberedCallback()) && proto.NumberedCallbackMessage.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.CallbackMessage} - */ -proto.CallbackMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.CallbackMessage; - return proto.CallbackMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.CallbackMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.CallbackMessage} - */ -proto.CallbackMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.NamedCallbackMessage; - reader.readMessage(value,proto.NamedCallbackMessage.deserializeBinaryFromReader); - msg.setNamedCallback(value); - break; - case 2: - var value = new proto.NumberedCallbackMessage; - reader.readMessage(value,proto.NumberedCallbackMessage.deserializeBinaryFromReader); - msg.setNumberedCallback(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.CallbackMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.CallbackMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.CallbackMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.CallbackMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNamedCallback(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.NamedCallbackMessage.serializeBinaryToWriter - ); - } - f = message.getNumberedCallback(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.NumberedCallbackMessage.serializeBinaryToWriter - ); - } -}; - - -/** - * optional NamedCallbackMessage named_callback = 1; - * @return {?proto.NamedCallbackMessage} - */ -proto.CallbackMessage.prototype.getNamedCallback = function() { - return /** @type{?proto.NamedCallbackMessage} */ ( - jspb.Message.getWrapperField(this, proto.NamedCallbackMessage, 1)); -}; - - -/** @param {?proto.NamedCallbackMessage|undefined} value */ -proto.CallbackMessage.prototype.setNamedCallback = function(value) { - jspb.Message.setOneofWrapperField(this, 1, proto.CallbackMessage.oneofGroups_[0], value); -}; - - -proto.CallbackMessage.prototype.clearNamedCallback = function() { - this.setNamedCallback(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.CallbackMessage.prototype.hasNamedCallback = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional NumberedCallbackMessage numbered_callback = 2; - * @return {?proto.NumberedCallbackMessage} - */ -proto.CallbackMessage.prototype.getNumberedCallback = function() { - return /** @type{?proto.NumberedCallbackMessage} */ ( - jspb.Message.getWrapperField(this, proto.NumberedCallbackMessage, 2)); -}; - - -/** @param {?proto.NumberedCallbackMessage|undefined} value */ -proto.CallbackMessage.prototype.setNumberedCallback = function(value) { - jspb.Message.setOneofWrapperField(this, 2, proto.CallbackMessage.oneofGroups_[0], value); -}; - - -proto.CallbackMessage.prototype.clearNumberedCallback = function() { - this.setNumberedCallback(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.CallbackMessage.prototype.hasNumberedCallback = 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.NamedCallbackMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.NamedCallbackMessage.repeatedFields_, null); -}; -goog.inherits(proto.NamedCallbackMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.NamedCallbackMessage.displayName = 'proto.NamedCallbackMessage'; -} -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.NamedCallbackMessage.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.NamedCallbackMessage.prototype.toObject = function(opt_includeInstance) { - return proto.NamedCallbackMessage.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.NamedCallbackMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NamedCallbackMessage.toObject = function(includeInstance, msg) { - var f, obj = { - module: jspb.Message.getFieldWithDefault(msg, 1, 0), - callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0), - argsList: jspb.Message.getRepeatedField(msg, 3) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.NamedCallbackMessage} - */ -proto.NamedCallbackMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.NamedCallbackMessage; - return proto.NamedCallbackMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.NamedCallbackMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.NamedCallbackMessage} - */ -proto.NamedCallbackMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.Module} */ (reader.readEnum()); - msg.setModule(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setCallbackId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addArgs(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.NamedCallbackMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.NamedCallbackMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.NamedCallbackMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NamedCallbackMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getModule(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getCallbackId(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getArgsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); - } -}; - - -/** - * optional Module module = 1; - * @return {!proto.Module} - */ -proto.NamedCallbackMessage.prototype.getModule = function() { - return /** @type {!proto.Module} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {!proto.Module} value */ -proto.NamedCallbackMessage.prototype.setModule = function(value) { - jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional uint64 callback_id = 2; - * @return {number} - */ -proto.NamedCallbackMessage.prototype.getCallbackId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** @param {number} value */ -proto.NamedCallbackMessage.prototype.setCallbackId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * repeated string args = 3; - * @return {!Array} - */ -proto.NamedCallbackMessage.prototype.getArgsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); -}; - - -/** @param {!Array} value */ -proto.NamedCallbackMessage.prototype.setArgsList = function(value) { - jspb.Message.setField(this, 3, value || []); -}; - - -/** - * @param {!string} value - * @param {number=} opt_index - */ -proto.NamedCallbackMessage.prototype.addArgs = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -proto.NamedCallbackMessage.prototype.clearArgsList = function() { - this.setArgsList([]); -}; - - - -/** - * 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.NumberedCallbackMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.NumberedCallbackMessage.repeatedFields_, null); -}; -goog.inherits(proto.NumberedCallbackMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.NumberedCallbackMessage.displayName = 'proto.NumberedCallbackMessage'; -} -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.NumberedCallbackMessage.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.NumberedCallbackMessage.prototype.toObject = function(opt_includeInstance) { - return proto.NumberedCallbackMessage.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.NumberedCallbackMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NumberedCallbackMessage.toObject = function(includeInstance, msg) { - var f, obj = { - proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0), - callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0), - argsList: jspb.Message.getRepeatedField(msg, 3) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.NumberedCallbackMessage} - */ -proto.NumberedCallbackMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.NumberedCallbackMessage; - return proto.NumberedCallbackMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.NumberedCallbackMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.NumberedCallbackMessage} - */ -proto.NumberedCallbackMessage.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.setProxyId(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setCallbackId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addArgs(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.NumberedCallbackMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.NumberedCallbackMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.NumberedCallbackMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NumberedCallbackMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getProxyId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getCallbackId(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getArgsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); - } -}; - - -/** - * optional uint64 proxy_id = 1; - * @return {number} - */ -proto.NumberedCallbackMessage.prototype.getProxyId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.NumberedCallbackMessage.prototype.setProxyId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional uint64 callback_id = 2; - * @return {number} - */ -proto.NumberedCallbackMessage.prototype.getCallbackId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** @param {number} value */ -proto.NumberedCallbackMessage.prototype.setCallbackId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * repeated string args = 3; - * @return {!Array} - */ -proto.NumberedCallbackMessage.prototype.getArgsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); -}; - - -/** @param {!Array} value */ -proto.NumberedCallbackMessage.prototype.setArgsList = function(value) { - jspb.Message.setField(this, 3, value || []); -}; - - -/** - * @param {!string} value - * @param {number=} opt_index - */ -proto.NumberedCallbackMessage.prototype.addArgs = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -proto.NumberedCallbackMessage.prototype.clearArgsList = function() { - this.setArgsList([]); -}; - - - -/** - * 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.EventMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.EventMessage.oneofGroups_); -}; -goog.inherits(proto.EventMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.EventMessage.displayName = 'proto.EventMessage'; -} -/** - * 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.EventMessage.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.EventMessage.MsgCase = { - MSG_NOT_SET: 0, - NAMED_EVENT: 1, - NUMBERED_EVENT: 2 -}; - -/** - * @return {proto.EventMessage.MsgCase} - */ -proto.EventMessage.prototype.getMsgCase = function() { - return /** @type {proto.EventMessage.MsgCase} */(jspb.Message.computeOneofCase(this, proto.EventMessage.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.EventMessage.prototype.toObject = function(opt_includeInstance) { - return proto.EventMessage.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.EventMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.EventMessage.toObject = function(includeInstance, msg) { - var f, obj = { - namedEvent: (f = msg.getNamedEvent()) && proto.NamedEventMessage.toObject(includeInstance, f), - numberedEvent: (f = msg.getNumberedEvent()) && proto.NumberedEventMessage.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.EventMessage} - */ -proto.EventMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.EventMessage; - return proto.EventMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.EventMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.EventMessage} - */ -proto.EventMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.NamedEventMessage; - reader.readMessage(value,proto.NamedEventMessage.deserializeBinaryFromReader); - msg.setNamedEvent(value); - break; - case 2: - var value = new proto.NumberedEventMessage; - reader.readMessage(value,proto.NumberedEventMessage.deserializeBinaryFromReader); - msg.setNumberedEvent(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.EventMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.EventMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.EventMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.EventMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNamedEvent(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.NamedEventMessage.serializeBinaryToWriter - ); - } - f = message.getNumberedEvent(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.NumberedEventMessage.serializeBinaryToWriter - ); - } -}; - - -/** - * optional NamedEventMessage named_event = 1; - * @return {?proto.NamedEventMessage} - */ -proto.EventMessage.prototype.getNamedEvent = function() { - return /** @type{?proto.NamedEventMessage} */ ( - jspb.Message.getWrapperField(this, proto.NamedEventMessage, 1)); -}; - - -/** @param {?proto.NamedEventMessage|undefined} value */ -proto.EventMessage.prototype.setNamedEvent = function(value) { - jspb.Message.setOneofWrapperField(this, 1, proto.EventMessage.oneofGroups_[0], value); -}; - - -proto.EventMessage.prototype.clearNamedEvent = function() { - this.setNamedEvent(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.EventMessage.prototype.hasNamedEvent = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional NumberedEventMessage numbered_event = 2; - * @return {?proto.NumberedEventMessage} - */ -proto.EventMessage.prototype.getNumberedEvent = function() { - return /** @type{?proto.NumberedEventMessage} */ ( - jspb.Message.getWrapperField(this, proto.NumberedEventMessage, 2)); -}; - - -/** @param {?proto.NumberedEventMessage|undefined} value */ -proto.EventMessage.prototype.setNumberedEvent = function(value) { - jspb.Message.setOneofWrapperField(this, 2, proto.EventMessage.oneofGroups_[0], value); -}; - - -proto.EventMessage.prototype.clearNumberedEvent = function() { - this.setNumberedEvent(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.EventMessage.prototype.hasNumberedEvent = 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.NamedEventMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.NamedEventMessage.repeatedFields_, null); -}; -goog.inherits(proto.NamedEventMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.NamedEventMessage.displayName = 'proto.NamedEventMessage'; -} -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.NamedEventMessage.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.NamedEventMessage.prototype.toObject = function(opt_includeInstance) { - return proto.NamedEventMessage.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.NamedEventMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NamedEventMessage.toObject = function(includeInstance, msg) { - var f, obj = { - module: jspb.Message.getFieldWithDefault(msg, 1, 0), - event: jspb.Message.getFieldWithDefault(msg, 2, ""), - argsList: jspb.Message.getRepeatedField(msg, 3) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.NamedEventMessage} - */ -proto.NamedEventMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.NamedEventMessage; - return proto.NamedEventMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.NamedEventMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.NamedEventMessage} - */ -proto.NamedEventMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.Module} */ (reader.readEnum()); - msg.setModule(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setEvent(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addArgs(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.NamedEventMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.NamedEventMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.NamedEventMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NamedEventMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getModule(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getEvent(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getArgsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); - } -}; - - -/** - * optional Module module = 1; - * @return {!proto.Module} - */ -proto.NamedEventMessage.prototype.getModule = function() { - return /** @type {!proto.Module} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {!proto.Module} value */ -proto.NamedEventMessage.prototype.setModule = function(value) { - jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional string event = 2; - * @return {string} - */ -proto.NamedEventMessage.prototype.getEvent = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** @param {string} value */ -proto.NamedEventMessage.prototype.setEvent = function(value) { - jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * repeated string args = 3; - * @return {!Array} - */ -proto.NamedEventMessage.prototype.getArgsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); -}; - - -/** @param {!Array} value */ -proto.NamedEventMessage.prototype.setArgsList = function(value) { - jspb.Message.setField(this, 3, value || []); -}; - - -/** - * @param {!string} value - * @param {number=} opt_index - */ -proto.NamedEventMessage.prototype.addArgs = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -proto.NamedEventMessage.prototype.clearArgsList = function() { - this.setArgsList([]); -}; - - - -/** - * 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.NumberedEventMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.NumberedEventMessage.repeatedFields_, null); -}; -goog.inherits(proto.NumberedEventMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.NumberedEventMessage.displayName = 'proto.NumberedEventMessage'; -} -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.NumberedEventMessage.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.NumberedEventMessage.prototype.toObject = function(opt_includeInstance) { - return proto.NumberedEventMessage.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.NumberedEventMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NumberedEventMessage.toObject = function(includeInstance, msg) { - var f, obj = { - proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0), - event: jspb.Message.getFieldWithDefault(msg, 2, ""), - argsList: jspb.Message.getRepeatedField(msg, 3) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.NumberedEventMessage} - */ -proto.NumberedEventMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.NumberedEventMessage; - return proto.NumberedEventMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.NumberedEventMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.NumberedEventMessage} - */ -proto.NumberedEventMessage.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.setProxyId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setEvent(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addArgs(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.NumberedEventMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.NumberedEventMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.NumberedEventMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.NumberedEventMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getProxyId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getEvent(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getArgsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); - } -}; - - -/** - * optional uint64 proxy_id = 1; - * @return {number} - */ -proto.NumberedEventMessage.prototype.getProxyId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.NumberedEventMessage.prototype.setProxyId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional string event = 2; - * @return {string} - */ -proto.NumberedEventMessage.prototype.getEvent = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** @param {string} value */ -proto.NumberedEventMessage.prototype.setEvent = function(value) { - jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * repeated string args = 3; - * @return {!Array} - */ -proto.NumberedEventMessage.prototype.getArgsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); -}; - - -/** @param {!Array} value */ -proto.NumberedEventMessage.prototype.setArgsList = function(value) { - jspb.Message.setField(this, 3, value || []); -}; - - -/** - * @param {!string} value - * @param {number=} opt_index - */ -proto.NumberedEventMessage.prototype.addArgs = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -proto.NumberedEventMessage.prototype.clearArgsList = function() { - this.setArgsList([]); -}; - - - -/** - * 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.FailMessage = function(opt_data) { +proto.Argument.ErrorValue = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.FailMessage, jspb.Message); +goog.inherits(proto.Argument.ErrorValue, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.FailMessage.displayName = 'proto.FailMessage'; + /** + * @public + * @override + */ + proto.Argument.ErrorValue.displayName = 'proto.Argument.ErrorValue'; } - - -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.FailMessage.prototype.toObject = function(opt_includeInstance) { - return proto.FailMessage.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.FailMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.FailMessage.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, 0), - response: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.FailMessage} - */ -proto.FailMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.FailMessage; - return proto.FailMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.FailMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.FailMessage} - */ -proto.FailMessage.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.setResponse(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.FailMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.FailMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.FailMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.FailMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getResponse(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } -}; - - -/** - * optional uint64 id = 1; - * @return {number} - */ -proto.FailMessage.prototype.getId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.FailMessage.prototype.setId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional string response = 2; - * @return {string} - */ -proto.FailMessage.prototype.getResponse = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** @param {string} value */ -proto.FailMessage.prototype.setResponse = function(value) { - jspb.Message.setProto3StringField(this, 2, value); -}; - - - /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -2248,165 +86,374 @@ proto.FailMessage.prototype.setResponse = function(value) { * @extends {jspb.Message} * @constructor */ -proto.SuccessMessage = function(opt_data) { +proto.Argument.BufferValue = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.SuccessMessage, jspb.Message); +goog.inherits(proto.Argument.BufferValue, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.SuccessMessage.displayName = 'proto.SuccessMessage'; + /** + * @public + * @override + */ + proto.Argument.BufferValue.displayName = 'proto.Argument.BufferValue'; } - - -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} + * 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.SuccessMessage.prototype.toObject = function(opt_includeInstance) { - return proto.SuccessMessage.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.SuccessMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.SuccessMessage.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, 0), - response: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.Argument.ObjectValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; +goog.inherits(proto.Argument.ObjectValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Argument.ObjectValue.displayName = 'proto.Argument.ObjectValue'; } - - /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.SuccessMessage} + * 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.SuccessMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.SuccessMessage; - return proto.SuccessMessage.deserializeBinaryFromReader(msg, reader); +proto.Argument.ArrayValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Argument.ArrayValue.repeatedFields_, null); }; - - +goog.inherits(proto.Argument.ArrayValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Argument.ArrayValue.displayName = 'proto.Argument.ArrayValue'; +} /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.SuccessMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.SuccessMessage} + * 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.SuccessMessage.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.setResponse(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.Argument.ProxyValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - +goog.inherits(proto.Argument.ProxyValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Argument.ProxyValue.displayName = 'proto.Argument.ProxyValue'; +} /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * 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.SuccessMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.SuccessMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.Argument.FunctionValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - +goog.inherits(proto.Argument.FunctionValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Argument.FunctionValue.displayName = 'proto.Argument.FunctionValue'; +} /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.SuccessMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * 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.SuccessMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getResponse(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } +proto.Argument.NullValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - +goog.inherits(proto.Argument.NullValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Argument.NullValue.displayName = 'proto.Argument.NullValue'; +} /** - * optional uint64 id = 1; - * @return {number} + * 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.SuccessMessage.prototype.getId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +proto.Argument.UndefinedValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - -/** @param {number} value */ -proto.SuccessMessage.prototype.setId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - +goog.inherits(proto.Argument.UndefinedValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Argument.UndefinedValue.displayName = 'proto.Argument.UndefinedValue'; +} /** - * optional string response = 2; - * @return {string} + * 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.SuccessMessage.prototype.getResponse = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.Method = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.Method.oneofGroups_); }; - - -/** @param {string} value */ -proto.SuccessMessage.prototype.setResponse = function(value) { - jspb.Message.setProto3StringField(this, 2, value); +goog.inherits(proto.Method, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Method.displayName = 'proto.Method'; +} +/** + * 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.Method.Named = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Method.Named.repeatedFields_, null); }; - - - +goog.inherits(proto.Method.Named, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Method.Named.displayName = 'proto.Method.Named'; +} +/** + * 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.Method.Numbered = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Method.Numbered.repeatedFields_, null); +}; +goog.inherits(proto.Method.Numbered, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Method.Numbered.displayName = 'proto.Method.Numbered'; +} +/** + * 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.Method.Fail = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.Method.Fail, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Method.Fail.displayName = 'proto.Method.Fail'; +} +/** + * 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.Method.Success = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.Method.Success, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Method.Success.displayName = 'proto.Method.Success'; +} +/** + * 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.Callback = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.Callback.oneofGroups_); +}; +goog.inherits(proto.Callback, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Callback.displayName = 'proto.Callback'; +} +/** + * 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.Callback.Named = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Callback.Named.repeatedFields_, null); +}; +goog.inherits(proto.Callback.Named, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Callback.Named.displayName = 'proto.Callback.Named'; +} +/** + * 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.Callback.Numbered = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Callback.Numbered.repeatedFields_, null); +}; +goog.inherits(proto.Callback.Numbered, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Callback.Numbered.displayName = 'proto.Callback.Numbered'; +} +/** + * 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.Event = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.Event.oneofGroups_); +}; +goog.inherits(proto.Event, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Event.displayName = 'proto.Event'; +} +/** + * 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.Event.Named = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Event.Named.repeatedFields_, null); +}; +goog.inherits(proto.Event.Named, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Event.Named.displayName = 'proto.Event.Named'; +} +/** + * 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.Event.Numbered = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.Event.Numbered.repeatedFields_, null); +}; +goog.inherits(proto.Event.Numbered, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Event.Numbered.displayName = 'proto.Event.Numbered'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -2422,8 +469,4037 @@ proto.Ping = function(opt_data) { }; goog.inherits(proto.Ping, jspb.Message); if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ proto.Ping.displayName = 'proto.Ping'; } +/** + * 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.Pong = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.Pong, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.Pong.displayName = 'proto.Pong'; +} + +/** + * 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.Argument.oneofGroups_ = [[1,2,3,4,5,6,7,8,9,10,11]]; + +/** + * @enum {number} + */ +proto.Argument.MsgCase = { + MSG_NOT_SET: 0, + ERROR: 1, + BUFFER: 2, + OBJECT: 3, + ARRAY: 4, + PROXY: 5, + FUNCTION: 6, + NULL: 7, + UNDEFINED: 8, + NUMBER: 9, + STRING: 10, + BOOLEAN: 11 +}; + +/** + * @return {proto.Argument.MsgCase} + */ +proto.Argument.prototype.getMsgCase = function() { + return /** @type {proto.Argument.MsgCase} */(jspb.Message.computeOneofCase(this, proto.Argument.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.Argument.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.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.Argument} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.toObject = function(includeInstance, msg) { + var obj = { + error: (f = msg.getError()) && proto.Argument.ErrorValue.toObject(includeInstance, f), + buffer: (f = msg.getBuffer()) && proto.Argument.BufferValue.toObject(includeInstance, f), + object: (f = msg.getObject()) && proto.Argument.ObjectValue.toObject(includeInstance, f), + array: (f = msg.getArray()) && proto.Argument.ArrayValue.toObject(includeInstance, f), + proxy: (f = msg.getProxy()) && proto.Argument.ProxyValue.toObject(includeInstance, f), + pb_function: (f = msg.getFunction()) && proto.Argument.FunctionValue.toObject(includeInstance, f), + pb_null: (f = msg.getNull()) && proto.Argument.NullValue.toObject(includeInstance, f), + undefined: (f = msg.getUndefined()) && proto.Argument.UndefinedValue.toObject(includeInstance, f), + number: +jspb.Message.getFieldWithDefault(msg, 9, 0.0), + string: jspb.Message.getFieldWithDefault(msg, 10, ""), + pb_boolean: jspb.Message.getFieldWithDefault(msg, 11, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument} + */ +proto.Argument.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument; + return proto.Argument.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument} + */ +proto.Argument.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.Argument.ErrorValue; + reader.readMessage(value,proto.Argument.ErrorValue.deserializeBinaryFromReader); + msg.setError(value); + break; + case 2: + var value = new proto.Argument.BufferValue; + reader.readMessage(value,proto.Argument.BufferValue.deserializeBinaryFromReader); + msg.setBuffer(value); + break; + case 3: + var value = new proto.Argument.ObjectValue; + reader.readMessage(value,proto.Argument.ObjectValue.deserializeBinaryFromReader); + msg.setObject(value); + break; + case 4: + var value = new proto.Argument.ArrayValue; + reader.readMessage(value,proto.Argument.ArrayValue.deserializeBinaryFromReader); + msg.setArray(value); + break; + case 5: + var value = new proto.Argument.ProxyValue; + reader.readMessage(value,proto.Argument.ProxyValue.deserializeBinaryFromReader); + msg.setProxy(value); + break; + case 6: + var value = new proto.Argument.FunctionValue; + reader.readMessage(value,proto.Argument.FunctionValue.deserializeBinaryFromReader); + msg.setFunction(value); + break; + case 7: + var value = new proto.Argument.NullValue; + reader.readMessage(value,proto.Argument.NullValue.deserializeBinaryFromReader); + msg.setNull(value); + break; + case 8: + var value = new proto.Argument.UndefinedValue; + reader.readMessage(value,proto.Argument.UndefinedValue.deserializeBinaryFromReader); + msg.setUndefined(value); + break; + case 9: + var value = /** @type {number} */ (reader.readDouble()); + msg.setNumber(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.setString(value); + break; + case 11: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBoolean(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getError(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.Argument.ErrorValue.serializeBinaryToWriter + ); + } + f = message.getBuffer(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.Argument.BufferValue.serializeBinaryToWriter + ); + } + f = message.getObject(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.Argument.ObjectValue.serializeBinaryToWriter + ); + } + f = message.getArray(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.Argument.ArrayValue.serializeBinaryToWriter + ); + } + f = message.getProxy(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.Argument.ProxyValue.serializeBinaryToWriter + ); + } + f = message.getFunction(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.Argument.FunctionValue.serializeBinaryToWriter + ); + } + f = message.getNull(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.Argument.NullValue.serializeBinaryToWriter + ); + } + f = message.getUndefined(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.Argument.UndefinedValue.serializeBinaryToWriter + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeDouble( + 9, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeString( + 10, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeBool( + 11, + f + ); + } +}; + + + + + +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.Argument.ErrorValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.ErrorValue.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.Argument.ErrorValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ErrorValue.toObject = function(includeInstance, msg) { + var obj = { + message: jspb.Message.getFieldWithDefault(msg, 1, ""), + stack: jspb.Message.getFieldWithDefault(msg, 2, ""), + code: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.ErrorValue} + */ +proto.Argument.ErrorValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.ErrorValue; + return proto.Argument.ErrorValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.ErrorValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.ErrorValue} + */ +proto.Argument.ErrorValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setStack(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setCode(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.ErrorValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.ErrorValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.ErrorValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ErrorValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getStack(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getCode(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string message = 1; + * @return {string} + */ +proto.Argument.ErrorValue.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.Argument.ErrorValue.prototype.setMessage = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string stack = 2; + * @return {string} + */ +proto.Argument.ErrorValue.prototype.getStack = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.Argument.ErrorValue.prototype.setStack = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string code = 3; + * @return {string} + */ +proto.Argument.ErrorValue.prototype.getCode = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.Argument.ErrorValue.prototype.setCode = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +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.Argument.BufferValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.BufferValue.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.Argument.BufferValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.BufferValue.toObject = function(includeInstance, msg) { + var obj = { + 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.Argument.BufferValue} + */ +proto.Argument.BufferValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.BufferValue; + return proto.Argument.BufferValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.BufferValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.BufferValue} + */ +proto.Argument.BufferValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.BufferValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.BufferValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.BufferValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.BufferValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes data = 1; + * @return {!(string|Uint8Array)} + */ +proto.Argument.BufferValue.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes data = 1; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.Argument.BufferValue.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 1; + * 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.Argument.BufferValue.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.Argument.BufferValue.prototype.setData = function(value) { + jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +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.Argument.ObjectValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.ObjectValue.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.Argument.ObjectValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ObjectValue.toObject = function(includeInstance, msg) { + var obj = { + dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, proto.Argument.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.ObjectValue} + */ +proto.Argument.ObjectValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.ObjectValue; + return proto.Argument.ObjectValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.ObjectValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.ObjectValue} + */ +proto.Argument.ObjectValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getDataMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.Argument.deserializeBinaryFromReader, ""); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.ObjectValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.ObjectValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.ObjectValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ObjectValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDataMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.Argument.serializeBinaryToWriter); + } +}; + + +/** + * map data = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.Argument.ObjectValue.prototype.getDataMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + proto.Argument)); +}; + + +/** + * Clears values from the map. The map will be non-null. + */ +proto.Argument.ObjectValue.prototype.clearDataMap = function() { + this.getDataMap().clear(); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Argument.ArrayValue.repeatedFields_ = [1]; + + + +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.Argument.ArrayValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.ArrayValue.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.Argument.ArrayValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ArrayValue.toObject = function(includeInstance, msg) { + var obj = { + dataList: jspb.Message.toObjectList(msg.getDataList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.ArrayValue} + */ +proto.Argument.ArrayValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.ArrayValue; + return proto.Argument.ArrayValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.ArrayValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.ArrayValue} + */ +proto.Argument.ArrayValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.ArrayValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.ArrayValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.ArrayValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ArrayValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDataList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Argument data = 1; + * @return {!Array} + */ +proto.Argument.ArrayValue.prototype.getDataList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 1)); +}; + + +/** @param {!Array} value */ +proto.Argument.ArrayValue.prototype.setDataList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Argument.ArrayValue.prototype.addData = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Argument.ArrayValue.prototype.clearDataList = function() { + this.setDataList([]); +}; + + + + + +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.Argument.ProxyValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.ProxyValue.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.Argument.ProxyValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ProxyValue.toObject = function(includeInstance, msg) { + var obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.ProxyValue} + */ +proto.Argument.ProxyValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.ProxyValue; + return proto.Argument.ProxyValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.ProxyValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.ProxyValue} + */ +proto.Argument.ProxyValue.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; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.ProxyValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.ProxyValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.ProxyValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.ProxyValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.Argument.ProxyValue.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Argument.ProxyValue.prototype.setId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +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.Argument.FunctionValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.FunctionValue.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.Argument.FunctionValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.FunctionValue.toObject = function(includeInstance, msg) { + var obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.FunctionValue} + */ +proto.Argument.FunctionValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.FunctionValue; + return proto.Argument.FunctionValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.FunctionValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.FunctionValue} + */ +proto.Argument.FunctionValue.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; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.FunctionValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.FunctionValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.FunctionValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.FunctionValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.Argument.FunctionValue.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Argument.FunctionValue.prototype.setId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +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.Argument.NullValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.NullValue.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.Argument.NullValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.NullValue.toObject = function(includeInstance, msg) { + var obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.NullValue} + */ +proto.Argument.NullValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.NullValue; + return proto.Argument.NullValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.NullValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.NullValue} + */ +proto.Argument.NullValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.NullValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.NullValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.NullValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.NullValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +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.Argument.UndefinedValue.prototype.toObject = function(opt_includeInstance) { + return proto.Argument.UndefinedValue.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.Argument.UndefinedValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.UndefinedValue.toObject = function(includeInstance, msg) { + var obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Argument.UndefinedValue} + */ +proto.Argument.UndefinedValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Argument.UndefinedValue; + return proto.Argument.UndefinedValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Argument.UndefinedValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Argument.UndefinedValue} + */ +proto.Argument.UndefinedValue.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Argument.UndefinedValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Argument.UndefinedValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Argument.UndefinedValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Argument.UndefinedValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + +/** + * optional ErrorValue error = 1; + * @return {?proto.Argument.ErrorValue} + */ +proto.Argument.prototype.getError = function() { + return /** @type{?proto.Argument.ErrorValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.ErrorValue, 1)); +}; + + +/** @param {?proto.Argument.ErrorValue|undefined} value */ +proto.Argument.prototype.setError = function(value) { + jspb.Message.setOneofWrapperField(this, 1, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearError = function() { + this.setError(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasError = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional BufferValue buffer = 2; + * @return {?proto.Argument.BufferValue} + */ +proto.Argument.prototype.getBuffer = function() { + return /** @type{?proto.Argument.BufferValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.BufferValue, 2)); +}; + + +/** @param {?proto.Argument.BufferValue|undefined} value */ +proto.Argument.prototype.setBuffer = function(value) { + jspb.Message.setOneofWrapperField(this, 2, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearBuffer = function() { + this.setBuffer(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasBuffer = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional ObjectValue object = 3; + * @return {?proto.Argument.ObjectValue} + */ +proto.Argument.prototype.getObject = function() { + return /** @type{?proto.Argument.ObjectValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.ObjectValue, 3)); +}; + + +/** @param {?proto.Argument.ObjectValue|undefined} value */ +proto.Argument.prototype.setObject = function(value) { + jspb.Message.setOneofWrapperField(this, 3, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearObject = function() { + this.setObject(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasObject = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional ArrayValue array = 4; + * @return {?proto.Argument.ArrayValue} + */ +proto.Argument.prototype.getArray = function() { + return /** @type{?proto.Argument.ArrayValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.ArrayValue, 4)); +}; + + +/** @param {?proto.Argument.ArrayValue|undefined} value */ +proto.Argument.prototype.setArray = function(value) { + jspb.Message.setOneofWrapperField(this, 4, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearArray = function() { + this.setArray(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasArray = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional ProxyValue proxy = 5; + * @return {?proto.Argument.ProxyValue} + */ +proto.Argument.prototype.getProxy = function() { + return /** @type{?proto.Argument.ProxyValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.ProxyValue, 5)); +}; + + +/** @param {?proto.Argument.ProxyValue|undefined} value */ +proto.Argument.prototype.setProxy = function(value) { + jspb.Message.setOneofWrapperField(this, 5, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearProxy = function() { + this.setProxy(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasProxy = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional FunctionValue function = 6; + * @return {?proto.Argument.FunctionValue} + */ +proto.Argument.prototype.getFunction = function() { + return /** @type{?proto.Argument.FunctionValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.FunctionValue, 6)); +}; + + +/** @param {?proto.Argument.FunctionValue|undefined} value */ +proto.Argument.prototype.setFunction = function(value) { + jspb.Message.setOneofWrapperField(this, 6, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearFunction = function() { + this.setFunction(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasFunction = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional NullValue null = 7; + * @return {?proto.Argument.NullValue} + */ +proto.Argument.prototype.getNull = function() { + return /** @type{?proto.Argument.NullValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.NullValue, 7)); +}; + + +/** @param {?proto.Argument.NullValue|undefined} value */ +proto.Argument.prototype.setNull = function(value) { + jspb.Message.setOneofWrapperField(this, 7, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearNull = function() { + this.setNull(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasNull = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional UndefinedValue undefined = 8; + * @return {?proto.Argument.UndefinedValue} + */ +proto.Argument.prototype.getUndefined = function() { + return /** @type{?proto.Argument.UndefinedValue} */ ( + jspb.Message.getWrapperField(this, proto.Argument.UndefinedValue, 8)); +}; + + +/** @param {?proto.Argument.UndefinedValue|undefined} value */ +proto.Argument.prototype.setUndefined = function(value) { + jspb.Message.setOneofWrapperField(this, 8, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Argument.prototype.clearUndefined = function() { + this.setUndefined(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasUndefined = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional double number = 9; + * @return {number} + */ +proto.Argument.prototype.getNumber = function() { + return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 9, 0.0)); +}; + + +/** @param {number} value */ +proto.Argument.prototype.setNumber = function(value) { + jspb.Message.setOneofField(this, 9, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + */ +proto.Argument.prototype.clearNumber = function() { + jspb.Message.setOneofField(this, 9, proto.Argument.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasNumber = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional string string = 10; + * @return {string} + */ +proto.Argument.prototype.getString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** @param {string} value */ +proto.Argument.prototype.setString = function(value) { + jspb.Message.setOneofField(this, 10, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + */ +proto.Argument.prototype.clearString = function() { + jspb.Message.setOneofField(this, 10, proto.Argument.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasString = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional bool boolean = 11; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.Argument.prototype.getBoolean = function() { + return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 11, false)); +}; + + +/** @param {boolean} value */ +proto.Argument.prototype.setBoolean = function(value) { + jspb.Message.setOneofField(this, 11, proto.Argument.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + */ +proto.Argument.prototype.clearBoolean = function() { + jspb.Message.setOneofField(this, 11, proto.Argument.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Argument.prototype.hasBoolean = function() { + return jspb.Message.getField(this, 11) != null; +}; + + + +/** + * 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.Method.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.Method.MsgCase = { + MSG_NOT_SET: 0, + NAMED_PROXY: 1, + NUMBERED_PROXY: 2 +}; + +/** + * @return {proto.Method.MsgCase} + */ +proto.Method.prototype.getMsgCase = function() { + return /** @type {proto.Method.MsgCase} */(jspb.Message.computeOneofCase(this, proto.Method.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.Method.prototype.toObject = function(opt_includeInstance) { + return proto.Method.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.Method} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.toObject = function(includeInstance, msg) { + var obj = { + namedProxy: (f = msg.getNamedProxy()) && proto.Method.Named.toObject(includeInstance, f), + numberedProxy: (f = msg.getNumberedProxy()) && proto.Method.Numbered.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.Method} + */ +proto.Method.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Method; + return proto.Method.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Method} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Method} + */ +proto.Method.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.Method.Named; + reader.readMessage(value,proto.Method.Named.deserializeBinaryFromReader); + msg.setNamedProxy(value); + break; + case 2: + var value = new proto.Method.Numbered; + reader.readMessage(value,proto.Method.Numbered.deserializeBinaryFromReader); + msg.setNumberedProxy(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Method.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Method.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Method} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNamedProxy(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.Method.Named.serializeBinaryToWriter + ); + } + f = message.getNumberedProxy(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.Method.Numbered.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Method.Named.repeatedFields_ = [4]; + + + +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.Method.Named.prototype.toObject = function(opt_includeInstance) { + return proto.Method.Named.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.Method.Named} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Named.toObject = function(includeInstance, msg) { + var obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, 0), + module: jspb.Message.getFieldWithDefault(msg, 2, 0), + method: jspb.Message.getFieldWithDefault(msg, 3, ""), + argsList: jspb.Message.toObjectList(msg.getArgsList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Method.Named} + */ +proto.Method.Named.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Method.Named; + return proto.Method.Named.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Method.Named} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Method.Named} + */ +proto.Method.Named.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.Module} */ (reader.readEnum()); + msg.setModule(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMethod(value); + break; + case 4: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addArgs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Method.Named.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Method.Named.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Method.Named} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Named.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getModule(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f + ); + } + f = message.getMethod(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.Method.Named.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Method.Named.prototype.setId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional Module module = 2; + * @return {!proto.Module} + */ +proto.Method.Named.prototype.getModule = function() { + return /** @type {!proto.Module} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {!proto.Module} value */ +proto.Method.Named.prototype.setModule = function(value) { + jspb.Message.setProto3EnumField(this, 2, value); +}; + + +/** + * optional string method = 3; + * @return {string} + */ +proto.Method.Named.prototype.getMethod = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.Method.Named.prototype.setMethod = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated Argument args = 4; + * @return {!Array} + */ +proto.Method.Named.prototype.getArgsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 4)); +}; + + +/** @param {!Array} value */ +proto.Method.Named.prototype.setArgsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Method.Named.prototype.addArgs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Method.Named.prototype.clearArgsList = function() { + this.setArgsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Method.Numbered.repeatedFields_ = [4]; + + + +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.Method.Numbered.prototype.toObject = function(opt_includeInstance) { + return proto.Method.Numbered.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.Method.Numbered} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Numbered.toObject = function(includeInstance, msg) { + var obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, 0), + proxyId: jspb.Message.getFieldWithDefault(msg, 2, 0), + method: jspb.Message.getFieldWithDefault(msg, 3, ""), + argsList: jspb.Message.toObjectList(msg.getArgsList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Method.Numbered} + */ +proto.Method.Numbered.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Method.Numbered; + return proto.Method.Numbered.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Method.Numbered} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Method.Numbered} + */ +proto.Method.Numbered.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.setProxyId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMethod(value); + break; + case 4: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addArgs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Method.Numbered.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Method.Numbered.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Method.Numbered} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Numbered.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getProxyId(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getMethod(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.Method.Numbered.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Method.Numbered.prototype.setId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 proxy_id = 2; + * @return {number} + */ +proto.Method.Numbered.prototype.getProxyId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.Method.Numbered.prototype.setProxyId = function(value) { + jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional string method = 3; + * @return {string} + */ +proto.Method.Numbered.prototype.getMethod = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.Method.Numbered.prototype.setMethod = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * repeated Argument args = 4; + * @return {!Array} + */ +proto.Method.Numbered.prototype.getArgsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 4)); +}; + + +/** @param {!Array} value */ +proto.Method.Numbered.prototype.setArgsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Method.Numbered.prototype.addArgs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Method.Numbered.prototype.clearArgsList = function() { + this.setArgsList([]); +}; + + + + + +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.Method.Fail.prototype.toObject = function(opt_includeInstance) { + return proto.Method.Fail.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.Method.Fail} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Fail.toObject = function(includeInstance, msg) { + var obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, 0), + response: (f = msg.getResponse()) && proto.Argument.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.Method.Fail} + */ +proto.Method.Fail.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Method.Fail; + return proto.Method.Fail.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Method.Fail} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Method.Fail} + */ +proto.Method.Fail.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.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.setResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Method.Fail.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Method.Fail.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Method.Fail} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Fail.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getResponse(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.Method.Fail.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Method.Fail.prototype.setId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional Argument response = 2; + * @return {?proto.Argument} + */ +proto.Method.Fail.prototype.getResponse = function() { + return /** @type{?proto.Argument} */ ( + jspb.Message.getWrapperField(this, proto.Argument, 2)); +}; + + +/** @param {?proto.Argument|undefined} value */ +proto.Method.Fail.prototype.setResponse = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Method.Fail.prototype.clearResponse = function() { + this.setResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Method.Fail.prototype.hasResponse = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +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.Method.Success.prototype.toObject = function(opt_includeInstance) { + return proto.Method.Success.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.Method.Success} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Success.toObject = function(includeInstance, msg) { + var obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, 0), + response: (f = msg.getResponse()) && proto.Argument.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.Method.Success} + */ +proto.Method.Success.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Method.Success; + return proto.Method.Success.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Method.Success} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Method.Success} + */ +proto.Method.Success.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.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.setResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Method.Success.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Method.Success.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Method.Success} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Method.Success.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getResponse(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 id = 1; + * @return {number} + */ +proto.Method.Success.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Method.Success.prototype.setId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional Argument response = 2; + * @return {?proto.Argument} + */ +proto.Method.Success.prototype.getResponse = function() { + return /** @type{?proto.Argument} */ ( + jspb.Message.getWrapperField(this, proto.Argument, 2)); +}; + + +/** @param {?proto.Argument|undefined} value */ +proto.Method.Success.prototype.setResponse = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Method.Success.prototype.clearResponse = function() { + this.setResponse(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Method.Success.prototype.hasResponse = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional Named named_proxy = 1; + * @return {?proto.Method.Named} + */ +proto.Method.prototype.getNamedProxy = function() { + return /** @type{?proto.Method.Named} */ ( + jspb.Message.getWrapperField(this, proto.Method.Named, 1)); +}; + + +/** @param {?proto.Method.Named|undefined} value */ +proto.Method.prototype.setNamedProxy = function(value) { + jspb.Message.setOneofWrapperField(this, 1, proto.Method.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Method.prototype.clearNamedProxy = function() { + this.setNamedProxy(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Method.prototype.hasNamedProxy = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Numbered numbered_proxy = 2; + * @return {?proto.Method.Numbered} + */ +proto.Method.prototype.getNumberedProxy = function() { + return /** @type{?proto.Method.Numbered} */ ( + jspb.Message.getWrapperField(this, proto.Method.Numbered, 2)); +}; + + +/** @param {?proto.Method.Numbered|undefined} value */ +proto.Method.prototype.setNumberedProxy = function(value) { + jspb.Message.setOneofWrapperField(this, 2, proto.Method.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Method.prototype.clearNumberedProxy = function() { + this.setNumberedProxy(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Method.prototype.hasNumberedProxy = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * 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.Callback.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.Callback.MsgCase = { + MSG_NOT_SET: 0, + NAMED_CALLBACK: 1, + NUMBERED_CALLBACK: 2 +}; + +/** + * @return {proto.Callback.MsgCase} + */ +proto.Callback.prototype.getMsgCase = function() { + return /** @type {proto.Callback.MsgCase} */(jspb.Message.computeOneofCase(this, proto.Callback.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.Callback.prototype.toObject = function(opt_includeInstance) { + return proto.Callback.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.Callback} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Callback.toObject = function(includeInstance, msg) { + var obj = { + namedCallback: (f = msg.getNamedCallback()) && proto.Callback.Named.toObject(includeInstance, f), + numberedCallback: (f = msg.getNumberedCallback()) && proto.Callback.Numbered.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.Callback} + */ +proto.Callback.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Callback; + return proto.Callback.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Callback} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Callback} + */ +proto.Callback.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.Callback.Named; + reader.readMessage(value,proto.Callback.Named.deserializeBinaryFromReader); + msg.setNamedCallback(value); + break; + case 2: + var value = new proto.Callback.Numbered; + reader.readMessage(value,proto.Callback.Numbered.deserializeBinaryFromReader); + msg.setNumberedCallback(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Callback.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Callback.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Callback} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Callback.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNamedCallback(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.Callback.Named.serializeBinaryToWriter + ); + } + f = message.getNumberedCallback(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.Callback.Numbered.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Callback.Named.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.Callback.Named.prototype.toObject = function(opt_includeInstance) { + return proto.Callback.Named.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.Callback.Named} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Callback.Named.toObject = function(includeInstance, msg) { + var obj = { + module: jspb.Message.getFieldWithDefault(msg, 1, 0), + callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0), + argsList: jspb.Message.toObjectList(msg.getArgsList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Callback.Named} + */ +proto.Callback.Named.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Callback.Named; + return proto.Callback.Named.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Callback.Named} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Callback.Named} + */ +proto.Callback.Named.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.Module} */ (reader.readEnum()); + msg.setModule(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setCallbackId(value); + break; + case 3: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addArgs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Callback.Named.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Callback.Named.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Callback.Named} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Callback.Named.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getModule(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getCallbackId(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Module module = 1; + * @return {!proto.Module} + */ +proto.Callback.Named.prototype.getModule = function() { + return /** @type {!proto.Module} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {!proto.Module} value */ +proto.Callback.Named.prototype.setModule = function(value) { + jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional uint64 callback_id = 2; + * @return {number} + */ +proto.Callback.Named.prototype.getCallbackId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.Callback.Named.prototype.setCallbackId = function(value) { + jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * repeated Argument args = 3; + * @return {!Array} + */ +proto.Callback.Named.prototype.getArgsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 3)); +}; + + +/** @param {!Array} value */ +proto.Callback.Named.prototype.setArgsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Callback.Named.prototype.addArgs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Callback.Named.prototype.clearArgsList = function() { + this.setArgsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Callback.Numbered.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.Callback.Numbered.prototype.toObject = function(opt_includeInstance) { + return proto.Callback.Numbered.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.Callback.Numbered} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Callback.Numbered.toObject = function(includeInstance, msg) { + var obj = { + proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0), + callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0), + argsList: jspb.Message.toObjectList(msg.getArgsList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Callback.Numbered} + */ +proto.Callback.Numbered.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Callback.Numbered; + return proto.Callback.Numbered.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Callback.Numbered} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Callback.Numbered} + */ +proto.Callback.Numbered.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.setProxyId(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setCallbackId(value); + break; + case 3: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addArgs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Callback.Numbered.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Callback.Numbered.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Callback.Numbered} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Callback.Numbered.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProxyId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getCallbackId(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 proxy_id = 1; + * @return {number} + */ +proto.Callback.Numbered.prototype.getProxyId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Callback.Numbered.prototype.setProxyId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 callback_id = 2; + * @return {number} + */ +proto.Callback.Numbered.prototype.getCallbackId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.Callback.Numbered.prototype.setCallbackId = function(value) { + jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * repeated Argument args = 3; + * @return {!Array} + */ +proto.Callback.Numbered.prototype.getArgsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 3)); +}; + + +/** @param {!Array} value */ +proto.Callback.Numbered.prototype.setArgsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Callback.Numbered.prototype.addArgs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Callback.Numbered.prototype.clearArgsList = function() { + this.setArgsList([]); +}; + + +/** + * optional Named named_callback = 1; + * @return {?proto.Callback.Named} + */ +proto.Callback.prototype.getNamedCallback = function() { + return /** @type{?proto.Callback.Named} */ ( + jspb.Message.getWrapperField(this, proto.Callback.Named, 1)); +}; + + +/** @param {?proto.Callback.Named|undefined} value */ +proto.Callback.prototype.setNamedCallback = function(value) { + jspb.Message.setOneofWrapperField(this, 1, proto.Callback.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Callback.prototype.clearNamedCallback = function() { + this.setNamedCallback(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Callback.prototype.hasNamedCallback = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Numbered numbered_callback = 2; + * @return {?proto.Callback.Numbered} + */ +proto.Callback.prototype.getNumberedCallback = function() { + return /** @type{?proto.Callback.Numbered} */ ( + jspb.Message.getWrapperField(this, proto.Callback.Numbered, 2)); +}; + + +/** @param {?proto.Callback.Numbered|undefined} value */ +proto.Callback.prototype.setNumberedCallback = function(value) { + jspb.Message.setOneofWrapperField(this, 2, proto.Callback.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Callback.prototype.clearNumberedCallback = function() { + this.setNumberedCallback(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Callback.prototype.hasNumberedCallback = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * 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.Event.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.Event.MsgCase = { + MSG_NOT_SET: 0, + NAMED_EVENT: 1, + NUMBERED_EVENT: 2 +}; + +/** + * @return {proto.Event.MsgCase} + */ +proto.Event.prototype.getMsgCase = function() { + return /** @type {proto.Event.MsgCase} */(jspb.Message.computeOneofCase(this, proto.Event.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.Event.prototype.toObject = function(opt_includeInstance) { + return proto.Event.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.Event} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Event.toObject = function(includeInstance, msg) { + var obj = { + namedEvent: (f = msg.getNamedEvent()) && proto.Event.Named.toObject(includeInstance, f), + numberedEvent: (f = msg.getNumberedEvent()) && proto.Event.Numbered.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.Event} + */ +proto.Event.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Event; + return proto.Event.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Event} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Event} + */ +proto.Event.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.Event.Named; + reader.readMessage(value,proto.Event.Named.deserializeBinaryFromReader); + msg.setNamedEvent(value); + break; + case 2: + var value = new proto.Event.Numbered; + reader.readMessage(value,proto.Event.Numbered.deserializeBinaryFromReader); + msg.setNumberedEvent(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Event.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Event.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Event} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Event.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNamedEvent(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.Event.Named.serializeBinaryToWriter + ); + } + f = message.getNumberedEvent(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.Event.Numbered.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Event.Named.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.Event.Named.prototype.toObject = function(opt_includeInstance) { + return proto.Event.Named.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.Event.Named} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Event.Named.toObject = function(includeInstance, msg) { + var obj = { + module: jspb.Message.getFieldWithDefault(msg, 1, 0), + event: jspb.Message.getFieldWithDefault(msg, 2, ""), + argsList: jspb.Message.toObjectList(msg.getArgsList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Event.Named} + */ +proto.Event.Named.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Event.Named; + return proto.Event.Named.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Event.Named} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Event.Named} + */ +proto.Event.Named.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.Module} */ (reader.readEnum()); + msg.setModule(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setEvent(value); + break; + case 3: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addArgs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Event.Named.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Event.Named.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Event.Named} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Event.Named.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getModule(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getEvent(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Module module = 1; + * @return {!proto.Module} + */ +proto.Event.Named.prototype.getModule = function() { + return /** @type {!proto.Module} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {!proto.Module} value */ +proto.Event.Named.prototype.setModule = function(value) { + jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional string event = 2; + * @return {string} + */ +proto.Event.Named.prototype.getEvent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.Event.Named.prototype.setEvent = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * repeated Argument args = 3; + * @return {!Array} + */ +proto.Event.Named.prototype.getArgsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 3)); +}; + + +/** @param {!Array} value */ +proto.Event.Named.prototype.setArgsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Event.Named.prototype.addArgs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Event.Named.prototype.clearArgsList = function() { + this.setArgsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.Event.Numbered.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.Event.Numbered.prototype.toObject = function(opt_includeInstance) { + return proto.Event.Numbered.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.Event.Numbered} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Event.Numbered.toObject = function(includeInstance, msg) { + var obj = { + proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0), + event: jspb.Message.getFieldWithDefault(msg, 2, ""), + argsList: jspb.Message.toObjectList(msg.getArgsList(), + proto.Argument.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.Event.Numbered} + */ +proto.Event.Numbered.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.Event.Numbered; + return proto.Event.Numbered.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.Event.Numbered} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.Event.Numbered} + */ +proto.Event.Numbered.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.setProxyId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setEvent(value); + break; + case 3: + var value = new proto.Argument; + reader.readMessage(value,proto.Argument.deserializeBinaryFromReader); + msg.addArgs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.Event.Numbered.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.Event.Numbered.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.Event.Numbered} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.Event.Numbered.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProxyId(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getEvent(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getArgsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.Argument.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 proxy_id = 1; + * @return {number} + */ +proto.Event.Numbered.prototype.getProxyId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.Event.Numbered.prototype.setProxyId = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string event = 2; + * @return {string} + */ +proto.Event.Numbered.prototype.getEvent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.Event.Numbered.prototype.setEvent = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * repeated Argument args = 3; + * @return {!Array} + */ +proto.Event.Numbered.prototype.getArgsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.Argument, 3)); +}; + + +/** @param {!Array} value */ +proto.Event.Numbered.prototype.setArgsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.Argument=} opt_value + * @param {number=} opt_index + * @return {!proto.Argument} + */ +proto.Event.Numbered.prototype.addArgs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.Argument, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.Event.Numbered.prototype.clearArgsList = function() { + this.setArgsList([]); +}; + + +/** + * optional Named named_event = 1; + * @return {?proto.Event.Named} + */ +proto.Event.prototype.getNamedEvent = function() { + return /** @type{?proto.Event.Named} */ ( + jspb.Message.getWrapperField(this, proto.Event.Named, 1)); +}; + + +/** @param {?proto.Event.Named|undefined} value */ +proto.Event.prototype.setNamedEvent = function(value) { + jspb.Message.setOneofWrapperField(this, 1, proto.Event.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Event.prototype.clearNamedEvent = function() { + this.setNamedEvent(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Event.prototype.hasNamedEvent = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Numbered numbered_event = 2; + * @return {?proto.Event.Numbered} + */ +proto.Event.prototype.getNumberedEvent = function() { + return /** @type{?proto.Event.Numbered} */ ( + jspb.Message.getWrapperField(this, proto.Event.Numbered, 2)); +}; + + +/** @param {?proto.Event.Numbered|undefined} value */ +proto.Event.prototype.setNumberedEvent = function(value) { + jspb.Message.setOneofWrapperField(this, 2, proto.Event.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.Event.prototype.clearNumberedEvent = function() { + this.setNumberedEvent(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.Event.prototype.hasNumberedEvent = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2452,7 +4528,7 @@ proto.Ping.prototype.toObject = function(opt_includeInstance) { * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Ping.toObject = function(includeInstance, msg) { - var f, obj = { + var obj = { }; @@ -2523,23 +4599,6 @@ proto.Ping.serializeBinaryToWriter = function(message, writer) { -/** - * 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.Pong = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.Pong, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.Pong.displayName = 'proto.Pong'; -} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2568,7 +4627,7 @@ proto.Pong.prototype.toObject = function(opt_includeInstance) { * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.Pong.toObject = function(includeInstance, msg) { - var f, obj = { + var obj = { }; diff --git a/packages/protocol/src/proto/vscode.proto b/packages/protocol/src/proto/vscode.proto index 3b9c6280..3e62b65f 100644 --- a/packages/protocol/src/proto/vscode.proto +++ b/packages/protocol/src/proto/vscode.proto @@ -1,7 +1,7 @@ syntax = "proto3"; // Sent when a shared process becomes active -message SharedProcessActiveMessage { +message SharedProcessActive { string socket_path = 1; string log_path = 2; -} \ No newline at end of file +} diff --git a/packages/protocol/src/proto/vscode_pb.d.ts b/packages/protocol/src/proto/vscode_pb.d.ts index 2e738d0c..f2a4ff4e 100644 --- a/packages/protocol/src/proto/vscode_pb.d.ts +++ b/packages/protocol/src/proto/vscode_pb.d.ts @@ -3,7 +3,7 @@ import * as jspb from "google-protobuf"; -export class SharedProcessActiveMessage extends jspb.Message { +export class SharedProcessActive extends jspb.Message { getSocketPath(): string; setSocketPath(value: string): void; @@ -11,16 +11,16 @@ export class SharedProcessActiveMessage extends jspb.Message { setLogPath(value: string): void; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SharedProcessActiveMessage.AsObject; - static toObject(includeInstance: boolean, msg: SharedProcessActiveMessage): SharedProcessActiveMessage.AsObject; + toObject(includeInstance?: boolean): SharedProcessActive.AsObject; + static toObject(includeInstance: boolean, msg: SharedProcessActive): SharedProcessActive.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SharedProcessActiveMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SharedProcessActiveMessage; - static deserializeBinaryFromReader(message: SharedProcessActiveMessage, reader: jspb.BinaryReader): SharedProcessActiveMessage; + static serializeBinaryToWriter(message: SharedProcessActive, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SharedProcessActive; + static deserializeBinaryFromReader(message: SharedProcessActive, reader: jspb.BinaryReader): SharedProcessActive; } -export namespace SharedProcessActiveMessage { +export namespace SharedProcessActive { export type AsObject = { socketPath: string, logPath: string, diff --git a/packages/protocol/src/proto/vscode_pb.js b/packages/protocol/src/proto/vscode_pb.js index 07335a8f..e03af0fe 100644 --- a/packages/protocol/src/proto/vscode_pb.js +++ b/packages/protocol/src/proto/vscode_pb.js @@ -11,8 +11,7 @@ var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); -goog.exportSymbol('proto.SharedProcessActiveMessage', null, global); - +goog.exportSymbol('proto.SharedProcessActive', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -23,15 +22,20 @@ goog.exportSymbol('proto.SharedProcessActiveMessage', null, global); * @extends {jspb.Message} * @constructor */ -proto.SharedProcessActiveMessage = function(opt_data) { +proto.SharedProcessActive = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.SharedProcessActiveMessage, jspb.Message); +goog.inherits(proto.SharedProcessActive, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.SharedProcessActiveMessage.displayName = 'proto.SharedProcessActiveMessage'; + /** + * @public + * @override + */ + proto.SharedProcessActive.displayName = 'proto.SharedProcessActive'; } + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. @@ -43,8 +47,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ -proto.SharedProcessActiveMessage.prototype.toObject = function(opt_includeInstance) { - return proto.SharedProcessActiveMessage.toObject(opt_includeInstance, this); +proto.SharedProcessActive.prototype.toObject = function(opt_includeInstance) { + return proto.SharedProcessActive.toObject(opt_includeInstance, this); }; @@ -53,12 +57,12 @@ proto.SharedProcessActiveMessage.prototype.toObject = function(opt_includeInstan * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.SharedProcessActiveMessage} msg The msg instance to transform. + * @param {!proto.SharedProcessActive} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.SharedProcessActiveMessage.toObject = function(includeInstance, msg) { - var f, obj = { +proto.SharedProcessActive.toObject = function(includeInstance, msg) { + var obj = { socketPath: jspb.Message.getFieldWithDefault(msg, 1, ""), logPath: jspb.Message.getFieldWithDefault(msg, 2, "") }; @@ -74,23 +78,23 @@ proto.SharedProcessActiveMessage.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.SharedProcessActiveMessage} + * @return {!proto.SharedProcessActive} */ -proto.SharedProcessActiveMessage.deserializeBinary = function(bytes) { +proto.SharedProcessActive.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.SharedProcessActiveMessage; - return proto.SharedProcessActiveMessage.deserializeBinaryFromReader(msg, reader); + var msg = new proto.SharedProcessActive; + return proto.SharedProcessActive.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.SharedProcessActiveMessage} msg The message object to deserialize into. + * @param {!proto.SharedProcessActive} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.SharedProcessActiveMessage} + * @return {!proto.SharedProcessActive} */ -proto.SharedProcessActiveMessage.deserializeBinaryFromReader = function(msg, reader) { +proto.SharedProcessActive.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -118,9 +122,9 @@ proto.SharedProcessActiveMessage.deserializeBinaryFromReader = function(msg, rea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.SharedProcessActiveMessage.prototype.serializeBinary = function() { +proto.SharedProcessActive.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.SharedProcessActiveMessage.serializeBinaryToWriter(this, writer); + proto.SharedProcessActive.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -128,11 +132,11 @@ proto.SharedProcessActiveMessage.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.SharedProcessActiveMessage} message + * @param {!proto.SharedProcessActive} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.SharedProcessActiveMessage.serializeBinaryToWriter = function(message, writer) { +proto.SharedProcessActive.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSocketPath(); if (f.length > 0) { @@ -155,13 +159,13 @@ proto.SharedProcessActiveMessage.serializeBinaryToWriter = function(message, wri * optional string socket_path = 1; * @return {string} */ -proto.SharedProcessActiveMessage.prototype.getSocketPath = function() { +proto.SharedProcessActive.prototype.getSocketPath = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ -proto.SharedProcessActiveMessage.prototype.setSocketPath = function(value) { +proto.SharedProcessActive.prototype.setSocketPath = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; @@ -170,13 +174,13 @@ proto.SharedProcessActiveMessage.prototype.setSocketPath = function(value) { * optional string log_path = 2; * @return {string} */ -proto.SharedProcessActiveMessage.prototype.getLogPath = function() { +proto.SharedProcessActive.prototype.getLogPath = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ -proto.SharedProcessActiveMessage.prototype.setLogPath = function(value) { +proto.SharedProcessActive.prototype.setLogPath = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; diff --git a/packages/protocol/test/child_process.test.ts b/packages/protocol/test/child_process.test.ts index 46298abd..54e8a9e2 100644 --- a/packages/protocol/test/child_process.test.ts +++ b/packages/protocol/test/child_process.test.ts @@ -10,7 +10,7 @@ describe("child_process", () => { const cp = client.modules[Module.ChildProcess]; const getStdout = async (proc: ChildProcess): Promise => { - return new Promise((r): Readable => proc.stdout.on("data", r)) + return new Promise((r): Readable => proc.stdout!.on("data", r)) .then((s) => s.toString()); }; @@ -36,10 +36,10 @@ describe("child_process", () => { it("should cat", async () => { const proc = cp.spawn("cat", []); expect(proc.pid).toBe(-1); - proc.stdin.write("banana"); + proc.stdin!.write("banana"); await expect(getStdout(proc)).resolves.toBe("banana"); - proc.stdin.end(); + proc.stdin!.end(); proc.kill(); expect(proc.pid).toBeGreaterThan(-1); diff --git a/packages/protocol/test/server.test.ts b/packages/protocol/test/server.test.ts index 23331089..4749e094 100644 --- a/packages/protocol/test/server.test.ts +++ b/packages/protocol/test/server.test.ts @@ -12,12 +12,10 @@ describe("Server", () => { workingDirectory, }); - it("should get init msg", (done) => { - client.initData.then((data) => { - expect(data.dataDirectory).toEqual(dataDirectory); - expect(data.workingDirectory).toEqual(workingDirectory); - expect(data.builtInExtensionsDirectory).toEqual(builtInExtensionsDirectory); - done(); - }); + it("should get init msg", async () => { + const data = await client.initData; + expect(data.dataDirectory).toEqual(dataDirectory); + expect(data.workingDirectory).toEqual(workingDirectory); + expect(data.builtInExtensionsDirectory).toEqual(builtInExtensionsDirectory); }); }); diff --git a/packages/protocol/test/util.test.ts b/packages/protocol/test/util.test.ts new file mode 100644 index 00000000..2f9514a0 --- /dev/null +++ b/packages/protocol/test/util.test.ts @@ -0,0 +1,101 @@ +import * as fs from "fs"; +import * as util from "util"; +import { argumentToProto, protoToArgument } from "../src/common/util"; + +describe("Convert", () => { + it("should convert nothing", () => { + expect(protoToArgument()).toBeUndefined(); + }); + + it("should convert null", () => { + expect(protoToArgument(argumentToProto(null))).toBeNull(); + }); + + it("should convert undefined", () => { + expect(protoToArgument(argumentToProto(undefined))).toBeUndefined(); + }); + + it("should convert string", () => { + expect(protoToArgument(argumentToProto("test"))).toBe("test"); + }); + + it("should convert number", () => { + expect(protoToArgument(argumentToProto(10))).toBe(10); + }); + + it("should convert boolean", () => { + expect(protoToArgument(argumentToProto(true))).toBe(true); + expect(protoToArgument(argumentToProto(false))).toBe(false); + }); + + it("should convert error", () => { + const error = new Error("message"); + const convertedError = protoToArgument(argumentToProto(error)); + + expect(convertedError instanceof Error).toBeTruthy(); + expect(convertedError.message).toBe("message"); + }); + + it("should convert buffer", async () => { + const buffer = await util.promisify(fs.readFile)(__filename); + expect(buffer instanceof Buffer).toBeTruthy(); + + const convertedBuffer = protoToArgument(argumentToProto(buffer)); + expect(convertedBuffer instanceof Buffer).toBeTruthy(); + expect(convertedBuffer.toString()).toBe(buffer.toString()); + }); + + it("should convert proxy", () => { + let i = 0; + const proto = argumentToProto( + { onEvent: (): void => undefined }, + undefined, + () => i++, + ); + + const proxy = protoToArgument(proto, undefined, (id) => { + return { + id: `created: ${id}`, + dispose: (): Promise => Promise.resolve(), + onDone: (): Promise => Promise.resolve(), + onEvent: (): Promise => Promise.resolve(), + }; + }); + + expect(proxy.id).toBe("created: 0"); + }); + + it("should convert function", () => { + const fn = jest.fn(); + // tslint:disable-next-line no-any + const map = new Map void>(); + let i = 0; + const proto = argumentToProto( + fn, + (f) => { + map.set(i++, f); + + return i - 1; + }, + ); + + const remoteFn = protoToArgument(proto, (id, args) => { + map.get(id)!(...args); + }); + + remoteFn("a", "b", 1); + + expect(fn).toHaveBeenCalledWith("a", "b", 1); + }); + + it("should convert array", () => { + const array = ["a", "b", 1, [1, "a"], null, undefined]; + expect(protoToArgument(argumentToProto(array))).toEqual(array); + }); + + it("should convert object", () => { + const obj = { a: "test" }; + // const obj = { "a": 1, "b": [1, "a"], test: null, test2: undefined }; + expect(protoToArgument(argumentToProto(obj))).toEqual(obj); + }); +}); diff --git a/packages/server/src/cli.ts b/packages/server/src/cli.ts index 84d53367..1b077a1a 100644 --- a/packages/server/src/cli.ts +++ b/packages/server/src/cli.ts @@ -1,5 +1,5 @@ import { field, logger } from "@coder/logger"; -import { ServerMessage, SharedProcessActiveMessage } from "@coder/protocol/src/proto"; +import { ServerMessage, SharedProcessActive } from "@coder/protocol/src/proto"; import { ChildProcess, fork, ForkOptions, spawn } from "child_process"; import { randomFillSync } from "crypto"; import * as fs from "fs"; @@ -145,7 +145,7 @@ if (isCli) { logger.info("Initializing", field("data-dir", dataDir), field("working-dir", workingDir), field("log-dir", logDir)); const sharedProcess = new SharedProcess(dataDir, builtInExtensionsDir); const sendSharedProcessReady = (socket: WebSocket): void => { - const active = new SharedProcessActiveMessage(); + const active = new SharedProcessActive(); active.setSocketPath(sharedProcess.socketPath); active.setLogPath(logDir); const serverMessage = new ServerMessage();