diff --git a/examples/build/client.js b/examples/build/client.js deleted file mode 100644 index e1a3940..0000000 --- a/examples/build/client.js +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug = require("debug"); -const grpc = require("grpc"); -const book_grpc_pb_1 = require("./proto/book_grpc_pb"); -const book_pb_1 = require("./proto/book_pb"); -const log = debug("SampleClient"); -const client = new book_grpc_pb_1.BookServiceClient("127.0.0.1:50051", grpc.credentials.createInsecure()); -const getBook = (isbn) => __awaiter(void 0, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - const request = new book_pb_1.GetBookRequest(); - request.setIsbn(isbn); - log(`[getBook] Request: ${JSON.stringify(request.toObject())}`); - client.getBook(request, (err, book) => { - if (err != null) { - debug(`[getBook] err:\nerr.message: ${err.message}\nerr.stack:\n${err.stack}`); - reject(err); - return; - } - log(`[getBook] Book: ${JSON.stringify(book.toObject())}`); - resolve(book); - }); - }); -}); -const getBooks = () => { - return new Promise((resolve) => { - const stream = client.getBooks(); - stream.on("data", (data) => { - log(`[getBooks] Book: ${JSON.stringify(data.toObject())}`); - }); - stream.on("end", () => { - log("[getBooks] Done."); - resolve(); - }); - for (let i = 0; i < 10; i++) { - const req = new book_pb_1.GetBookRequest(); - req.setIsbn(i); - log(`[getBooks] Request: ${JSON.stringify(req.toObject())}`); - stream.write(req); - } - stream.end(); - }); -}; -const getBooksViaAuthor = (author) => { - return new Promise((resolve) => { - const request = new book_pb_1.GetBookViaAuthor(); - request.setAuthor(author); - log(`[getBooksViaAuthor] Request: ${JSON.stringify(request.toObject())}`); - const stream = client.getBooksViaAuthor(request); - stream.on("data", (data) => { - log(`[getBooksViaAuthor] Book: ${JSON.stringify(data.toObject())}`); - }); - stream.on("end", () => { - log("[getBooksViaAuthor] Done."); - resolve(); - }); - }); -}; -const getGreatestBook = () => { - return new Promise((resolve) => { - const stream = client.getGreatestBook((err, data) => { - if (err != null) { - log(`[getGreatestBook] err:\nerr.message: ${err.message}\nerr.stack:\n${err.stack}`); - } - log(`[getGreatestBook] Book: ${JSON.stringify(data.toObject())}`); - resolve(); - }); - for (let i = 0; i < 10; i++) { - const req = new book_pb_1.GetBookRequest(); - req.setIsbn(i); - log(`[getGreatestBook] Request: ${JSON.stringify(req.toObject())}`); - stream.write(req); - } - stream.end(); - }); -}; -function main() { - return __awaiter(this, void 0, void 0, function* () { - yield getBook(1); - yield getBooks(); - yield getBooksViaAuthor("DefaultAuthor"); - yield getGreatestBook(); - }); -} -main().then((_) => _); -process.on("uncaughtException", (err) => { - log(`process on uncaughtException error: ${err}`); -}); -process.on("unhandledRejection", (err) => { - log(`process on unhandledRejection error: ${err}`); -}); -//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/examples/build/client.js.map b/examples/build/client.js.map deleted file mode 100644 index 7c92fab..0000000 --- a/examples/build/client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,+BAA+B;AAC/B,6BAA6B;AAE7B,uDAAyD;AACzD,6CAAyE;AAEzE,MAAM,GAAG,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAElC,MAAM,MAAM,GAAG,IAAI,gCAAiB,CAAC,iBAAiB,EAAE,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;AAE3F,MAAM,OAAO,GAAG,CAAO,IAAY,EAAE,EAAE;IACrC,OAAO,IAAI,OA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E,EAAE;IACvC,GAAG,CAAC,wCAAwC,GAAG,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/examples/build/grpcjs/proto/book_grpc_pb.d.ts b/examples/build/grpcjs/proto/book_grpc_pb.d.ts index d76dfa1..0c1f3b6 100644 --- a/examples/build/grpcjs/proto/book_grpc_pb.d.ts +++ b/examples/build/grpcjs/proto/book_grpc_pb.d.ts @@ -4,7 +4,8 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "grpc"; +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; import * as book_pb from "./book_pb"; interface IBookServiceService extends grpc.ServiceDefinition { @@ -56,7 +57,7 @@ export const BookServiceService: IBookServiceService; export interface IBookServiceServer { getBook: grpc.handleUnaryCall; getBooksViaAuthor: grpc.handleServerStreamingCall; - getGreatestBook: grpc.handleClientStreamingCall; + getGreatestBook: handleClientStreamingCall; getBooks: grpc.handleBidiStreamingCall; } diff --git a/examples/build/proto/book_grpc_pb.d.ts b/examples/build/proto/book_grpc_pb.d.ts deleted file mode 100644 index d76dfa1..0000000 --- a/examples/build/proto/book_grpc_pb.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -// package: com.book -// file: book.proto - -/* tslint:disable */ -/* eslint-disable */ - -import * as grpc from "grpc"; -import * as book_pb from "./book_pb"; - -interface IBookServiceService extends grpc.ServiceDefinition { - getBook: IBookServiceService_IGetBook; - getBooksViaAuthor: IBookServiceService_IGetBooksViaAuthor; - getGreatestBook: IBookServiceService_IGetGreatestBook; - getBooks: IBookServiceService_IGetBooks; -} - -interface IBookServiceService_IGetBook extends grpc.MethodDefinition { - path: string; // "/com.book.BookService/GetBook" - requestStream: boolean; // false - responseStream: boolean; // false - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} -interface IBookServiceService_IGetBooksViaAuthor extends grpc.MethodDefinition { - path: string; // "/com.book.BookService/GetBooksViaAuthor" - requestStream: boolean; // false - responseStream: boolean; // true - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} -interface IBookServiceService_IGetGreatestBook extends grpc.MethodDefinition { - path: string; // "/com.book.BookService/GetGreatestBook" - requestStream: boolean; // true - responseStream: boolean; // false - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} -interface IBookServiceService_IGetBooks extends grpc.MethodDefinition { - path: string; // "/com.book.BookService/GetBooks" - requestStream: boolean; // true - responseStream: boolean; // true - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} - -export const BookServiceService: IBookServiceService; - -export interface IBookServiceServer { - getBook: grpc.handleUnaryCall; - getBooksViaAuthor: grpc.handleServerStreamingCall; - getGreatestBook: grpc.handleClientStreamingCall; - getBooks: grpc.handleBidiStreamingCall; -} - -export interface IBookServiceClient { - getBook(request: book_pb.GetBookRequest, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientUnaryCall; - getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientUnaryCall; - getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientUnaryCall; - getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial): grpc.ClientReadableStream; - getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; - getGreatestBook(callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - getGreatestBook(metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - getGreatestBook(options: Partial, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - getGreatestBook(metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - getBooks(): grpc.ClientDuplexStream; - getBooks(options: Partial): grpc.ClientDuplexStream; - getBooks(metadata: grpc.Metadata, options?: Partial): grpc.ClientDuplexStream; -} - -export class BookServiceClient extends grpc.Client implements IBookServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); - public getBook(request: book_pb.GetBookRequest, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientUnaryCall; - public getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientUnaryCall; - public getBook(request: book_pb.GetBookRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientUnaryCall; - public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, options?: Partial): grpc.ClientReadableStream; - public getBooksViaAuthor(request: book_pb.GetBookViaAuthor, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; - public getGreatestBook(callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - public getGreatestBook(metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - public getGreatestBook(options: Partial, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - public getGreatestBook(metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: book_pb.Book) => void): grpc.ClientWritableStream; - public getBooks(options?: Partial): grpc.ClientDuplexStream; - public getBooks(metadata?: grpc.Metadata, options?: Partial): grpc.ClientDuplexStream; -} diff --git a/examples/build/proto/book_grpc_pb.js b/examples/build/proto/book_grpc_pb.js deleted file mode 100644 index 658d8d4..0000000 --- a/examples/build/proto/book_grpc_pb.js +++ /dev/null @@ -1,88 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -'use strict'; -var grpc = require('grpc'); -var book_pb = require('./book_pb.js'); - -function serialize_com_book_Book(arg) { - if (!(arg instanceof book_pb.Book)) { - throw new Error('Expected argument of type com.book.Book'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_com_book_Book(buffer_arg) { - return book_pb.Book.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_com_book_GetBookRequest(arg) { - if (!(arg instanceof book_pb.GetBookRequest)) { - throw new Error('Expected argument of type com.book.GetBookRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_com_book_GetBookRequest(buffer_arg) { - return book_pb.GetBookRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_com_book_GetBookViaAuthor(arg) { - if (!(arg instanceof book_pb.GetBookViaAuthor)) { - throw new Error('Expected argument of type com.book.GetBookViaAuthor'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_com_book_GetBookViaAuthor(buffer_arg) { - return book_pb.GetBookViaAuthor.deserializeBinary(new Uint8Array(buffer_arg)); -} - - -var BookServiceService = exports.BookServiceService = { - getBook: { - path: '/com.book.BookService/GetBook', - requestStream: false, - responseStream: false, - requestType: book_pb.GetBookRequest, - responseType: book_pb.Book, - requestSerialize: serialize_com_book_GetBookRequest, - requestDeserialize: deserialize_com_book_GetBookRequest, - responseSerialize: serialize_com_book_Book, - responseDeserialize: deserialize_com_book_Book, - }, - getBooksViaAuthor: { - path: '/com.book.BookService/GetBooksViaAuthor', - requestStream: false, - responseStream: true, - requestType: book_pb.GetBookViaAuthor, - responseType: book_pb.Book, - requestSerialize: serialize_com_book_GetBookViaAuthor, - requestDeserialize: deserialize_com_book_GetBookViaAuthor, - responseSerialize: serialize_com_book_Book, - responseDeserialize: deserialize_com_book_Book, - }, - getGreatestBook: { - path: '/com.book.BookService/GetGreatestBook', - requestStream: true, - responseStream: false, - requestType: book_pb.GetBookRequest, - responseType: book_pb.Book, - requestSerialize: serialize_com_book_GetBookRequest, - requestDeserialize: deserialize_com_book_GetBookRequest, - responseSerialize: serialize_com_book_Book, - responseDeserialize: deserialize_com_book_Book, - }, - getBooks: { - path: '/com.book.BookService/GetBooks', - requestStream: true, - responseStream: true, - requestType: book_pb.GetBookRequest, - responseType: book_pb.Book, - requestSerialize: serialize_com_book_GetBookRequest, - requestDeserialize: deserialize_com_book_GetBookRequest, - responseSerialize: serialize_com_book_Book, - responseDeserialize: deserialize_com_book_Book, - }, -}; - -exports.BookServiceClient = grpc.makeGenericClientConstructor(BookServiceService); diff --git a/examples/build/proto/book_pb.d.ts b/examples/build/proto/book_pb.d.ts deleted file mode 100644 index 7fcf383..0000000 --- a/examples/build/proto/book_pb.d.ts +++ /dev/null @@ -1,214 +0,0 @@ -// package: com.book -// file: book.proto - -/* tslint:disable */ -/* eslint-disable */ - -import * as jspb from "google-protobuf"; - -export class Book extends jspb.Message { - getIsbn(): number; - setIsbn(value: number): void; - - getTitle(): string; - setTitle(value: string): void; - - getAuthor(): string; - setAuthor(value: string): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Book.AsObject; - static toObject(includeInstance: boolean, msg: Book): Book.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Book, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Book; - static deserializeBinaryFromReader(message: Book, reader: jspb.BinaryReader): Book; -} - -export namespace Book { - export type AsObject = { - isbn: number, - title: string, - author: string, - } -} - -export class GetBookRequest extends jspb.Message { - getIsbn(): number; - setIsbn(value: number): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetBookRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetBookRequest): GetBookRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetBookRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetBookRequest; - static deserializeBinaryFromReader(message: GetBookRequest, reader: jspb.BinaryReader): GetBookRequest; -} - -export namespace GetBookRequest { - export type AsObject = { - isbn: number, - } -} - -export class GetBookViaAuthor extends jspb.Message { - getAuthor(): string; - setAuthor(value: string): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetBookViaAuthor.AsObject; - static toObject(includeInstance: boolean, msg: GetBookViaAuthor): GetBookViaAuthor.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetBookViaAuthor, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetBookViaAuthor; - static deserializeBinaryFromReader(message: GetBookViaAuthor, reader: jspb.BinaryReader): GetBookViaAuthor; -} - -export namespace GetBookViaAuthor { - export type AsObject = { - author: string, - } -} - -export class BookStore extends jspb.Message { - getName(): string; - setName(value: string): void; - - - getBooksMap(): jspb.Map; - clearBooksMap(): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): BookStore.AsObject; - static toObject(includeInstance: boolean, msg: BookStore): BookStore.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: BookStore, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): BookStore; - static deserializeBinaryFromReader(message: BookStore, reader: jspb.BinaryReader): BookStore; -} - -export namespace BookStore { - export type AsObject = { - name: string, - - booksMap: Array<[number, string]>, - } -} - -export class SpecialCases extends jspb.Message { - getNormal(): string; - setNormal(value: string): void; - - getDefault(): string; - setDefault(value: string): void; - - getFunction(): string; - setFunction(value: string): void; - - getVar(): string; - setVar(value: string): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SpecialCases.AsObject; - static toObject(includeInstance: boolean, msg: SpecialCases): SpecialCases.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SpecialCases, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SpecialCases; - static deserializeBinaryFromReader(message: SpecialCases, reader: jspb.BinaryReader): SpecialCases; -} - -export namespace SpecialCases { - export type AsObject = { - normal: string, - pb_default: string, - pb_function: string, - pb_var: string, - } -} - -export class OneOfSample extends jspb.Message { - - hasA1(): boolean; - clearA1(): void; - getA1(): boolean; - setA1(value: boolean): void; - - - hasB1(): boolean; - clearB1(): void; - getB1(): boolean; - setB1(value: boolean): void; - - - hasA2(): boolean; - clearA2(): void; - getA2(): boolean; - setA2(value: boolean): void; - - - hasB2(): boolean; - clearB2(): void; - getB2(): boolean; - setB2(value: boolean): void; - - - getSinglewordCase(): OneOfSample.SinglewordCase; - getTwoWordsCase(): OneOfSample.TwoWordsCase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): OneOfSample.AsObject; - static toObject(includeInstance: boolean, msg: OneOfSample): OneOfSample.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: OneOfSample, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): OneOfSample; - static deserializeBinaryFromReader(message: OneOfSample, reader: jspb.BinaryReader): OneOfSample; -} - -export namespace OneOfSample { - export type AsObject = { - a1: boolean, - b1: boolean, - a2: boolean, - b2: boolean, - } - - export enum SinglewordCase { - SINGLEWORD_NOT_SET = 0, - - A1 = 1, - - B1 = 2, - - } - - export enum TwoWordsCase { - TWO_WORDS_NOT_SET = 0, - - A_2 = 3, - - B_2 = 4, - - } - -} - -export enum EnumSample { - UNKNOWN = 0, - STARTED = 1, - RUNNING = 1, - CASETEST = 2, - HOW_ABOUT_THIS = 3, - ALLLOWERCASE = 4, -} diff --git a/examples/build/proto/book_pb.js b/examples/build/proto/book_pb.js deleted file mode 100644 index 6952b08..0000000 --- a/examples/build/proto/book_pb.js +++ /dev/null @@ -1,1236 +0,0 @@ -/** - * @fileoverview - * @enhanceable - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = Function('return this')(); - -goog.exportSymbol('proto.com.book.Book', null, global); -goog.exportSymbol('proto.com.book.BookStore', null, global); -goog.exportSymbol('proto.com.book.EnumSample', null, global); -goog.exportSymbol('proto.com.book.GetBookRequest', null, global); -goog.exportSymbol('proto.com.book.GetBookViaAuthor', null, global); -goog.exportSymbol('proto.com.book.OneOfSample', null, global); -goog.exportSymbol('proto.com.book.SpecialCases', null, global); - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.com.book.Book = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.com.book.Book, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.com.book.Book.displayName = 'proto.com.book.Book'; -} - - -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.com.book.Book.prototype.toObject = function(opt_includeInstance) { - return proto.com.book.Book.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.com.book.Book} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.Book.toObject = function(includeInstance, msg) { - var f, obj = { - isbn: jspb.Message.getFieldWithDefault(msg, 1, 0), - title: jspb.Message.getFieldWithDefault(msg, 2, ""), - author: 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.com.book.Book} - */ -proto.com.book.Book.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.com.book.Book; - return proto.com.book.Book.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.com.book.Book} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.com.book.Book} - */ -proto.com.book.Book.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setIsbn(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setTitle(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setAuthor(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.com.book.Book.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.com.book.Book.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.com.book.Book} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.Book.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIsbn(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getTitle(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getAuthor(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } -}; - - -/** - * optional int64 isbn = 1; - * @return {number} - */ -proto.com.book.Book.prototype.getIsbn = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.com.book.Book.prototype.setIsbn = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional string title = 2; - * @return {string} - */ -proto.com.book.Book.prototype.getTitle = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** @param {string} value */ -proto.com.book.Book.prototype.setTitle = function(value) { - jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string author = 3; - * @return {string} - */ -proto.com.book.Book.prototype.getAuthor = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** @param {string} value */ -proto.com.book.Book.prototype.setAuthor = function(value) { - jspb.Message.setProto3StringField(this, 3, value); -}; - - - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.com.book.GetBookRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.com.book.GetBookRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.com.book.GetBookRequest.displayName = 'proto.com.book.GetBookRequest'; -} - - -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.com.book.GetBookRequest.prototype.toObject = function(opt_includeInstance) { - return proto.com.book.GetBookRequest.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.com.book.GetBookRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.GetBookRequest.toObject = function(includeInstance, msg) { - var f, obj = { - isbn: 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.com.book.GetBookRequest} - */ -proto.com.book.GetBookRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.com.book.GetBookRequest; - return proto.com.book.GetBookRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.com.book.GetBookRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.com.book.GetBookRequest} - */ -proto.com.book.GetBookRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setIsbn(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.com.book.GetBookRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.com.book.GetBookRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.com.book.GetBookRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.GetBookRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getIsbn(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } -}; - - -/** - * optional int64 isbn = 1; - * @return {number} - */ -proto.com.book.GetBookRequest.prototype.getIsbn = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** @param {number} value */ -proto.com.book.GetBookRequest.prototype.setIsbn = function(value) { - jspb.Message.setProto3IntField(this, 1, value); -}; - - - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.com.book.GetBookViaAuthor = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.com.book.GetBookViaAuthor, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.com.book.GetBookViaAuthor.displayName = 'proto.com.book.GetBookViaAuthor'; -} - - -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.com.book.GetBookViaAuthor.prototype.toObject = function(opt_includeInstance) { - return proto.com.book.GetBookViaAuthor.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.com.book.GetBookViaAuthor} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.GetBookViaAuthor.toObject = function(includeInstance, msg) { - var f, obj = { - author: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.com.book.GetBookViaAuthor} - */ -proto.com.book.GetBookViaAuthor.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.com.book.GetBookViaAuthor; - return proto.com.book.GetBookViaAuthor.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.com.book.GetBookViaAuthor} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.com.book.GetBookViaAuthor} - */ -proto.com.book.GetBookViaAuthor.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.setAuthor(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.com.book.GetBookViaAuthor.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.com.book.GetBookViaAuthor.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.com.book.GetBookViaAuthor} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.GetBookViaAuthor.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getAuthor(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string author = 1; - * @return {string} - */ -proto.com.book.GetBookViaAuthor.prototype.getAuthor = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** @param {string} value */ -proto.com.book.GetBookViaAuthor.prototype.setAuthor = function(value) { - jspb.Message.setProto3StringField(this, 1, value); -}; - - - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.com.book.BookStore = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.com.book.BookStore, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.com.book.BookStore.displayName = 'proto.com.book.BookStore'; -} - - -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.com.book.BookStore.prototype.toObject = function(opt_includeInstance) { - return proto.com.book.BookStore.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.com.book.BookStore} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.BookStore.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - booksMap: (f = msg.getBooksMap()) ? f.toObject(includeInstance, undefined) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.com.book.BookStore} - */ -proto.com.book.BookStore.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.com.book.BookStore; - return proto.com.book.BookStore.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.com.book.BookStore} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.com.book.BookStore} - */ -proto.com.book.BookStore.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.setName(value); - break; - case 2: - var value = msg.getBooksMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.com.book.BookStore.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.com.book.BookStore.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.com.book.BookStore} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.BookStore.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getBooksMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.com.book.BookStore.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** @param {string} value */ -proto.com.book.BookStore.prototype.setName = function(value) { - jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * map books = 2; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.com.book.BookStore.prototype.getBooksMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 2, opt_noLazyCreate, - null)); -}; - - -proto.com.book.BookStore.prototype.clearBooksMap = function() { - this.getBooksMap().clear(); -}; - - - -/** - * 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.com.book.SpecialCases = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.com.book.SpecialCases, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.com.book.SpecialCases.displayName = 'proto.com.book.SpecialCases'; -} - - -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.com.book.SpecialCases.prototype.toObject = function(opt_includeInstance) { - return proto.com.book.SpecialCases.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.com.book.SpecialCases} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.SpecialCases.toObject = function(includeInstance, msg) { - var f, obj = { - normal: jspb.Message.getFieldWithDefault(msg, 1, ""), - pb_default: jspb.Message.getFieldWithDefault(msg, 2, ""), - pb_function: jspb.Message.getFieldWithDefault(msg, 3, ""), - pb_var: jspb.Message.getFieldWithDefault(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.com.book.SpecialCases} - */ -proto.com.book.SpecialCases.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.com.book.SpecialCases; - return proto.com.book.SpecialCases.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.com.book.SpecialCases} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.com.book.SpecialCases} - */ -proto.com.book.SpecialCases.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.setNormal(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDefault(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setFunction(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setVar(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.com.book.SpecialCases.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.com.book.SpecialCases.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.com.book.SpecialCases} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.SpecialCases.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNormal(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getDefault(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getFunction(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getVar(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } -}; - - -/** - * optional string normal = 1; - * @return {string} - */ -proto.com.book.SpecialCases.prototype.getNormal = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** @param {string} value */ -proto.com.book.SpecialCases.prototype.setNormal = function(value) { - jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string default = 2; - * @return {string} - */ -proto.com.book.SpecialCases.prototype.getDefault = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** @param {string} value */ -proto.com.book.SpecialCases.prototype.setDefault = function(value) { - jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string function = 3; - * @return {string} - */ -proto.com.book.SpecialCases.prototype.getFunction = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** @param {string} value */ -proto.com.book.SpecialCases.prototype.setFunction = function(value) { - jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional string var = 4; - * @return {string} - */ -proto.com.book.SpecialCases.prototype.getVar = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** @param {string} value */ -proto.com.book.SpecialCases.prototype.setVar = function(value) { - jspb.Message.setProto3StringField(this, 4, value); -}; - - - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.com.book.OneOfSample = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.com.book.OneOfSample.oneofGroups_); -}; -goog.inherits(proto.com.book.OneOfSample, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.com.book.OneOfSample.displayName = 'proto.com.book.OneOfSample'; -} -/** - * 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.com.book.OneOfSample.oneofGroups_ = [[1,2],[3,4]]; - -/** - * @enum {number} - */ -proto.com.book.OneOfSample.SinglewordCase = { - SINGLEWORD_NOT_SET: 0, - A1: 1, - B1: 2 -}; - -/** - * @return {proto.com.book.OneOfSample.SinglewordCase} - */ -proto.com.book.OneOfSample.prototype.getSinglewordCase = function() { - return /** @type {proto.com.book.OneOfSample.SinglewordCase} */(jspb.Message.computeOneofCase(this, proto.com.book.OneOfSample.oneofGroups_[0])); -}; - -/** - * @enum {number} - */ -proto.com.book.OneOfSample.TwoWordsCase = { - TWO_WORDS_NOT_SET: 0, - A_2: 3, - B_2: 4 -}; - -/** - * @return {proto.com.book.OneOfSample.TwoWordsCase} - */ -proto.com.book.OneOfSample.prototype.getTwoWordsCase = function() { - return /** @type {proto.com.book.OneOfSample.TwoWordsCase} */(jspb.Message.computeOneofCase(this, proto.com.book.OneOfSample.oneofGroups_[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.com.book.OneOfSample.prototype.toObject = function(opt_includeInstance) { - return proto.com.book.OneOfSample.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.com.book.OneOfSample} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.OneOfSample.toObject = function(includeInstance, msg) { - var f, obj = { - a1: jspb.Message.getFieldWithDefault(msg, 1, false), - b1: jspb.Message.getFieldWithDefault(msg, 2, false), - a2: jspb.Message.getFieldWithDefault(msg, 3, false), - b2: jspb.Message.getFieldWithDefault(msg, 4, 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.com.book.OneOfSample} - */ -proto.com.book.OneOfSample.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.com.book.OneOfSample; - return proto.com.book.OneOfSample.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.com.book.OneOfSample} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.com.book.OneOfSample} - */ -proto.com.book.OneOfSample.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setA1(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setB1(value); - break; - case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setA2(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setB2(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.com.book.OneOfSample.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.com.book.OneOfSample.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.com.book.OneOfSample} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.com.book.OneOfSample.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeBool( - 1, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeBool( - 2, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeBool( - 3, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); - if (f != null) { - writer.writeBool( - 4, - f - ); - } -}; - - -/** - * optional bool a1 = 1; - * 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.com.book.OneOfSample.prototype.getA1 = function() { - return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 1, false)); -}; - - -/** @param {boolean} value */ -proto.com.book.OneOfSample.prototype.setA1 = function(value) { - jspb.Message.setOneofField(this, 1, proto.com.book.OneOfSample.oneofGroups_[0], value); -}; - - -proto.com.book.OneOfSample.prototype.clearA1 = function() { - jspb.Message.setOneofField(this, 1, proto.com.book.OneOfSample.oneofGroups_[0], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.com.book.OneOfSample.prototype.hasA1 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional bool b1 = 2; - * 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.com.book.OneOfSample.prototype.getB1 = function() { - return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 2, false)); -}; - - -/** @param {boolean} value */ -proto.com.book.OneOfSample.prototype.setB1 = function(value) { - jspb.Message.setOneofField(this, 2, proto.com.book.OneOfSample.oneofGroups_[0], value); -}; - - -proto.com.book.OneOfSample.prototype.clearB1 = function() { - jspb.Message.setOneofField(this, 2, proto.com.book.OneOfSample.oneofGroups_[0], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.com.book.OneOfSample.prototype.hasB1 = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional bool a_2 = 3; - * 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.com.book.OneOfSample.prototype.getA2 = function() { - return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 3, false)); -}; - - -/** @param {boolean} value */ -proto.com.book.OneOfSample.prototype.setA2 = function(value) { - jspb.Message.setOneofField(this, 3, proto.com.book.OneOfSample.oneofGroups_[1], value); -}; - - -proto.com.book.OneOfSample.prototype.clearA2 = function() { - jspb.Message.setOneofField(this, 3, proto.com.book.OneOfSample.oneofGroups_[1], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.com.book.OneOfSample.prototype.hasA2 = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional bool b_2 = 4; - * 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.com.book.OneOfSample.prototype.getB2 = function() { - return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 4, false)); -}; - - -/** @param {boolean} value */ -proto.com.book.OneOfSample.prototype.setB2 = function(value) { - jspb.Message.setOneofField(this, 4, proto.com.book.OneOfSample.oneofGroups_[1], value); -}; - - -proto.com.book.OneOfSample.prototype.clearB2 = function() { - jspb.Message.setOneofField(this, 4, proto.com.book.OneOfSample.oneofGroups_[1], undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.com.book.OneOfSample.prototype.hasB2 = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * @enum {number} - */ -proto.com.book.EnumSample = { - UNKNOWN: 0, - STARTED: 1, - RUNNING: 1, - CASETEST: 2, - HOW_ABOUT_THIS: 3, - ALLLOWERCASE: 4 -}; - -goog.object.extend(exports, proto.com.book); diff --git a/examples/build/server.js b/examples/build/server.js deleted file mode 100644 index 499a5ee..0000000 --- a/examples/build/server.js +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env node -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug = require("debug"); -const grpc = require("grpc"); -const book_grpc_pb_1 = require("./proto/book_grpc_pb"); -const book_pb_1 = require("./proto/book_pb"); -const log = debug("SampleServer"); -class ServerImpl { - getBook(call, callback) { - const book = new book_pb_1.Book(); - book.setTitle("DefaultBook"); - book.setAuthor("DefaultAuthor"); - log(`[getBook] Done: ${JSON.stringify(book.toObject())}`); - callback(null, book); - } - ; - getBooks(call) { - call.on("data", (request) => { - const reply = new book_pb_1.Book(); - reply.setTitle(`Book${request.getIsbn()}`); - reply.setAuthor(`Author${request.getIsbn()}`); - reply.setIsbn(request.getIsbn()); - log(`[getBooks] Write: ${JSON.stringify(reply.toObject())}`); - call.write(reply); - }); - call.on("end", () => { - log("[getBooks] Done."); - call.end(); - }); - } - ; - getBooksViaAuthor(call) { - log(`[getBooksViaAuthor] Request: ${JSON.stringify(call.request.toObject())}`); - for (let i = 1; i <= 10; i++) { - const reply = new book_pb_1.Book(); - reply.setTitle(`Book${i}`); - reply.setAuthor(call.request.getAuthor()); - reply.setIsbn(i); - log(`[getBooksViaAuthor] Write: ${JSON.stringify(reply.toObject())}`); - call.write(reply); - } - log("[getBooksViaAuthor] Done."); - call.end(); - } - ; - getGreatestBook(call, callback) { - let lastOne; - call.on("data", (request) => { - log(`[getGreatestBook] Request: ${JSON.stringify(request.toObject())}`); - lastOne = request; - }); - call.on("end", () => { - const reply = new book_pb_1.Book(); - reply.setIsbn(lastOne.getIsbn()); - reply.setTitle("LastOne"); - reply.setAuthor("LastOne"); - log(`[getGreatestBook] Done: ${JSON.stringify(reply.toObject())}`); - callback(null, reply); - }); - } - ; -} -function startServer() { - const server = new grpc.Server(); - server.addService(book_grpc_pb_1.BookServiceService, new ServerImpl()); - server.bind("127.0.0.1:50051", grpc.ServerCredentials.createInsecure()); - server.start(); - log("Server started, listening: 127.0.0.1:50051"); -} -startServer(); -process.on("uncaughtException", (err) => { - log(`process on uncaughtException error: ${err}`); -}); -process.on("unhandledRejection", (err) => { - log(`process on unhandledRejection error: ${err}`); -}); -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/examples/build/server.js.map b/examples/build/server.js.map deleted file mode 100644 index ed2a020..0000000 --- a/examples/build/server.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAEA,+BAA+B;AAC/B,6BAA6B;AAE7B,uDAA8E;AAC9E,6CAAyE;AAEzE,MAAM,GAAG,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAElC,MAAM,UAAU;IACZ,OAAO,CAAC,IAA0C,EAAE,QAAkC;QAClF,MAAM,IAAI,GAAG,IAAI,cAAI,EAAE,CAAC;QAExB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QAEhC,GAAG,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,C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AAE,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,GAAG,CAAC,4CAA4C,CAAC,CAAC;AACpD,CAAC;AAED,WAAW,EAAE,CAAC;AAEd,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,GAAG,CAAC,uCAAuC,GAAG,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,EAAE;IACvC,GAAG,CAAC,wCAAwC,GAAG,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/examples/src/grpcjs/proto/book_grpc_pb.d.ts b/examples/src/grpcjs/proto/book_grpc_pb.d.ts index d76dfa1..0c1f3b6 100644 --- a/examples/src/grpcjs/proto/book_grpc_pb.d.ts +++ b/examples/src/grpcjs/proto/book_grpc_pb.d.ts @@ -4,7 +4,8 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "grpc"; +import * as grpc from "@grpc/grpc-js"; +import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; import * as book_pb from "./book_pb"; interface IBookServiceService extends grpc.ServiceDefinition { @@ -56,7 +57,7 @@ export const BookServiceService: IBookServiceService; export interface IBookServiceServer { getBook: grpc.handleUnaryCall; getBooksViaAuthor: grpc.handleServerStreamingCall; - getGreatestBook: grpc.handleClientStreamingCall; + getGreatestBook: handleClientStreamingCall; getBooks: grpc.handleBidiStreamingCall; }