diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..867b62c Binary files /dev/null and b/.DS_Store differ diff --git a/examples/.DS_Store b/examples/.DS_Store new file mode 100644 index 0000000..4f9e4a6 Binary files /dev/null and b/examples/.DS_Store differ diff --git a/examples/generated-grpc-native/proto/examplecom/annotations_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/annotations_pb.d.ts new file mode 100644 index 0000000..2c0f3e2 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/annotations_pb.d.ts @@ -0,0 +1,41 @@ +// package: examplecom +// file: proto/examplecom/annotations.proto + +import * as jspb from "google-protobuf"; + +export class AnnotatedMessage extends jspb.Message { + getMyunit64(): string; + setMyunit64(value: string): void; + + getMyint64(): string; + setMyint64(value: string): void; + + getMyfixed64(): string; + setMyfixed64(value: string): void; + + getMysint64(): string; + setMysint64(value: string): void; + + getMysfixed64(): string; + setMysfixed64(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): AnnotatedMessage.AsObject; + static toObject(includeInstance: boolean, msg: AnnotatedMessage): AnnotatedMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: AnnotatedMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AnnotatedMessage; + static deserializeBinaryFromReader(message: AnnotatedMessage, reader: jspb.BinaryReader): AnnotatedMessage; +} + +export namespace AnnotatedMessage { + export type AsObject = { + myunit64: string, + myint64: string, + myfixed64: string, + mysint64: string, + mysfixed64: string, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/annotations_pb.js b/examples/generated-grpc-native/proto/examplecom/annotations_pb.js new file mode 100644 index 0000000..f1c2264 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/annotations_pb.js @@ -0,0 +1,290 @@ +// source: proto/examplecom/annotations.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.AnnotatedMessage', 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.examplecom.AnnotatedMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.AnnotatedMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.AnnotatedMessage.displayName = 'proto.examplecom.AnnotatedMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.AnnotatedMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.AnnotatedMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.AnnotatedMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.AnnotatedMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myunit64: jspb.Message.getFieldWithDefault(msg, 1, "0"), + myint64: jspb.Message.getFieldWithDefault(msg, 2, "0"), + myfixed64: jspb.Message.getFieldWithDefault(msg, 3, "0"), + mysint64: jspb.Message.getFieldWithDefault(msg, 4, "0"), + mysfixed64: jspb.Message.getFieldWithDefault(msg, 5, "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.examplecom.AnnotatedMessage} + */ +proto.examplecom.AnnotatedMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.AnnotatedMessage; + return proto.examplecom.AnnotatedMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.AnnotatedMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.AnnotatedMessage} + */ +proto.examplecom.AnnotatedMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMyunit64(value); + break; + case 2: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMyint64(value); + break; + case 3: + var value = /** @type {string} */ (reader.readFixed64String()); + msg.setMyfixed64(value); + break; + case 4: + var value = /** @type {string} */ (reader.readSint64String()); + msg.setMysint64(value); + break; + case 5: + var value = /** @type {string} */ (reader.readSfixed64String()); + msg.setMysfixed64(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.AnnotatedMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.AnnotatedMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.AnnotatedMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.AnnotatedMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyunit64(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 1, + f + ); + } + f = message.getMyint64(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 2, + f + ); + } + f = message.getMyfixed64(); + if (parseInt(f, 10) !== 0) { + writer.writeFixed64String( + 3, + f + ); + } + f = message.getMysint64(); + if (parseInt(f, 10) !== 0) { + writer.writeSint64String( + 4, + f + ); + } + f = message.getMysfixed64(); + if (parseInt(f, 10) !== 0) { + writer.writeSfixed64String( + 5, + f + ); + } +}; + + +/** + * optional uint64 myUnit64 = 1; + * @return {string} + */ +proto.examplecom.AnnotatedMessage.prototype.getMyunit64 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.AnnotatedMessage} returns this + */ +proto.examplecom.AnnotatedMessage.prototype.setMyunit64 = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); +}; + + +/** + * optional int64 myInt64 = 2; + * @return {string} + */ +proto.examplecom.AnnotatedMessage.prototype.getMyint64 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.AnnotatedMessage} returns this + */ +proto.examplecom.AnnotatedMessage.prototype.setMyint64 = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); +}; + + +/** + * optional fixed64 myFixed64 = 3; + * @return {string} + */ +proto.examplecom.AnnotatedMessage.prototype.getMyfixed64 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.AnnotatedMessage} returns this + */ +proto.examplecom.AnnotatedMessage.prototype.setMyfixed64 = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); +}; + + +/** + * optional sint64 mySint64 = 4; + * @return {string} + */ +proto.examplecom.AnnotatedMessage.prototype.getMysint64 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.AnnotatedMessage} returns this + */ +proto.examplecom.AnnotatedMessage.prototype.setMysint64 = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); +}; + + +/** + * optional sfixed64 mySfixed64 = 5; + * @return {string} + */ +proto.examplecom.AnnotatedMessage.prototype.getMysfixed64 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.AnnotatedMessage} returns this + */ +proto.examplecom.AnnotatedMessage.prototype.setMysfixed64 = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/annotations_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/annotations_pb_service.d.ts new file mode 100644 index 0000000..414651f --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/annotations_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/annotations.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/annotations_pb_service.js b/examples/generated-grpc-native/proto/examplecom/annotations_pb_service.js new file mode 100644 index 0000000..414651f --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/annotations_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/annotations.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/casing_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/casing_pb.d.ts new file mode 100644 index 0000000..e7ed925 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/casing_pb.d.ts @@ -0,0 +1,41 @@ +// package: examplecom +// file: proto/examplecom/casing.proto + +import * as jspb from "google-protobuf"; + +export class CasingMessage extends jspb.Message { + getTitlecase(): string; + setTitlecase(value: string): void; + + getCamelcase(): string; + setCamelcase(value: string): void; + + getSnakeCase(): string; + setSnakeCase(value: string): void; + + getLeadingunderscorecamelcase(): string; + setLeadingunderscorecamelcase(value: string): void; + + getLeadingunderscoretitlecase(): string; + setLeadingunderscoretitlecase(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CasingMessage.AsObject; + static toObject(includeInstance: boolean, msg: CasingMessage): CasingMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CasingMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CasingMessage; + static deserializeBinaryFromReader(message: CasingMessage, reader: jspb.BinaryReader): CasingMessage; +} + +export namespace CasingMessage { + export type AsObject = { + titlecase: string, + camelcase: string, + snakeCase: string, + leadingunderscorecamelcase: string, + leadingunderscoretitlecase: string, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/casing_pb.js b/examples/generated-grpc-native/proto/examplecom/casing_pb.js new file mode 100644 index 0000000..7ed90a4 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/casing_pb.js @@ -0,0 +1,290 @@ +// source: proto/examplecom/casing.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.CasingMessage', 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.examplecom.CasingMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.CasingMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.CasingMessage.displayName = 'proto.examplecom.CasingMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.CasingMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.CasingMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.CasingMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.CasingMessage.toObject = function(includeInstance, msg) { + var f, obj = { + titlecase: jspb.Message.getFieldWithDefault(msg, 1, ""), + camelcase: jspb.Message.getFieldWithDefault(msg, 2, ""), + snakeCase: jspb.Message.getFieldWithDefault(msg, 3, ""), + leadingunderscorecamelcase: jspb.Message.getFieldWithDefault(msg, 4, ""), + leadingunderscoretitlecase: jspb.Message.getFieldWithDefault(msg, 5, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.examplecom.CasingMessage} + */ +proto.examplecom.CasingMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.CasingMessage; + return proto.examplecom.CasingMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.CasingMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.CasingMessage} + */ +proto.examplecom.CasingMessage.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.setTitlecase(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setCamelcase(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setSnakeCase(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setLeadingunderscorecamelcase(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setLeadingunderscoretitlecase(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.CasingMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.CasingMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.CasingMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.CasingMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTitlecase(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getCamelcase(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getSnakeCase(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getLeadingunderscorecamelcase(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getLeadingunderscoretitlecase(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } +}; + + +/** + * optional string TitleCase = 1; + * @return {string} + */ +proto.examplecom.CasingMessage.prototype.getTitlecase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.CasingMessage} returns this + */ +proto.examplecom.CasingMessage.prototype.setTitlecase = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string camelCase = 2; + * @return {string} + */ +proto.examplecom.CasingMessage.prototype.getCamelcase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.CasingMessage} returns this + */ +proto.examplecom.CasingMessage.prototype.setCamelcase = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string snake_case = 3; + * @return {string} + */ +proto.examplecom.CasingMessage.prototype.getSnakeCase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.CasingMessage} returns this + */ +proto.examplecom.CasingMessage.prototype.setSnakeCase = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string _leadingUnderscoreCamelCase = 4; + * @return {string} + */ +proto.examplecom.CasingMessage.prototype.getLeadingunderscorecamelcase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.CasingMessage} returns this + */ +proto.examplecom.CasingMessage.prototype.setLeadingunderscorecamelcase = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string _LeadingUnderscoreTitleCase = 5; + * @return {string} + */ +proto.examplecom.CasingMessage.prototype.getLeadingunderscoretitlecase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.CasingMessage} returns this + */ +proto.examplecom.CasingMessage.prototype.setLeadingunderscoretitlecase = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/casing_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/casing_pb_service.d.ts new file mode 100644 index 0000000..360ca43 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/casing_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/casing.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/casing_pb_service.js b/examples/generated-grpc-native/proto/examplecom/casing_pb_service.js new file mode 100644 index 0000000..360ca43 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/casing_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/casing.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb.d.ts new file mode 100644 index 0000000..6990710 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb.d.ts @@ -0,0 +1,21 @@ +// package: examplecom +// file: proto/examplecom/empty_message_no_service.proto + +import * as jspb from "google-protobuf"; + +export class NoService extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NoService.AsObject; + static toObject(includeInstance: boolean, msg: NoService): NoService.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NoService, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NoService; + static deserializeBinaryFromReader(message: NoService, reader: jspb.BinaryReader): NoService; +} + +export namespace NoService { + export type AsObject = { + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb.js b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb.js new file mode 100644 index 0000000..f7955a9 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb.js @@ -0,0 +1,141 @@ +// source: proto/examplecom/empty_message_no_service.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.NoService', 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.examplecom.NoService = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.NoService, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.NoService.displayName = 'proto.examplecom.NoService'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.NoService.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.NoService.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.NoService} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.NoService.toObject = function(includeInstance, msg) { + var f, 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.examplecom.NoService} + */ +proto.examplecom.NoService.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.NoService; + return proto.examplecom.NoService.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.NoService} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.NoService} + */ +proto.examplecom.NoService.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.examplecom.NoService.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.NoService.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.NoService} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.NoService.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb_service.d.ts new file mode 100644 index 0000000..8f08f53 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/empty_message_no_service.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb_service.js b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb_service.js new file mode 100644 index 0000000..8f08f53 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/empty_message_no_service_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/empty_message_no_service.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/enum_message_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/enum_message_pb.d.ts new file mode 100644 index 0000000..61181ee --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/enum_message_pb.d.ts @@ -0,0 +1,51 @@ +// package: examplecom +// file: proto/examplecom/enum_message.proto + +import * as jspb from "google-protobuf"; +import * as proto_othercom_external_enum_pb from "../../proto/othercom/external_enum_pb"; + +export class EnumMessage extends jspb.Message { + getInternalEnum(): EnumMessage.InternalEnumMap[keyof EnumMessage.InternalEnumMap]; + setInternalEnum(value: EnumMessage.InternalEnumMap[keyof EnumMessage.InternalEnumMap]): void; + + clearInternalEnumsList(): void; + getInternalEnumsList(): Array; + setInternalEnumsList(value: Array): void; + addInternalEnums(value: EnumMessage.InternalEnumMap[keyof EnumMessage.InternalEnumMap], index?: number): EnumMessage.InternalEnumMap[keyof EnumMessage.InternalEnumMap]; + + getExternalEnum(): proto_othercom_external_enum_pb.ExternalEnumMap[keyof proto_othercom_external_enum_pb.ExternalEnumMap]; + setExternalEnum(value: proto_othercom_external_enum_pb.ExternalEnumMap[keyof proto_othercom_external_enum_pb.ExternalEnumMap]): void; + + clearExternalEnumsList(): void; + getExternalEnumsList(): Array; + setExternalEnumsList(value: Array): void; + addExternalEnums(value: proto_othercom_external_enum_pb.ExternalEnumMap[keyof proto_othercom_external_enum_pb.ExternalEnumMap], index?: number): proto_othercom_external_enum_pb.ExternalEnumMap[keyof proto_othercom_external_enum_pb.ExternalEnumMap]; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EnumMessage.AsObject; + static toObject(includeInstance: boolean, msg: EnumMessage): EnumMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumMessage; + static deserializeBinaryFromReader(message: EnumMessage, reader: jspb.BinaryReader): EnumMessage; +} + +export namespace EnumMessage { + export type AsObject = { + internalEnum: EnumMessage.InternalEnumMap[keyof EnumMessage.InternalEnumMap], + internalEnumsList: Array, + externalEnum: proto_othercom_external_enum_pb.ExternalEnumMap[keyof proto_othercom_external_enum_pb.ExternalEnumMap], + externalEnumsList: Array, + } + + export interface InternalEnumMap { + DEFAULT: 0; + FIRST: 1; + SECOND: 2; + THIRD: 3; + } + + export const InternalEnum: InternalEnumMap; +} + diff --git a/examples/generated-grpc-native/proto/examplecom/enum_message_pb.js b/examples/generated-grpc-native/proto/examplecom/enum_message_pb.js new file mode 100644 index 0000000..07528d5 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/enum_message_pb.js @@ -0,0 +1,322 @@ +// source: proto/examplecom/enum_message.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var proto_othercom_external_enum_pb = require('../../proto/othercom/external_enum_pb.js'); +goog.object.extend(proto, proto_othercom_external_enum_pb); +goog.exportSymbol('proto.examplecom.EnumMessage', null, global); +goog.exportSymbol('proto.examplecom.EnumMessage.InternalEnum', 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.examplecom.EnumMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.examplecom.EnumMessage.repeatedFields_, null); +}; +goog.inherits(proto.examplecom.EnumMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.EnumMessage.displayName = 'proto.examplecom.EnumMessage'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.examplecom.EnumMessage.repeatedFields_ = [2,4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.EnumMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.EnumMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.EnumMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.EnumMessage.toObject = function(includeInstance, msg) { + var f, obj = { + internalEnum: jspb.Message.getFieldWithDefault(msg, 1, 0), + internalEnumsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, + externalEnum: jspb.Message.getFieldWithDefault(msg, 3, 0), + externalEnumsList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : 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.examplecom.EnumMessage} + */ +proto.examplecom.EnumMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.EnumMessage; + return proto.examplecom.EnumMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.EnumMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.EnumMessage} + */ +proto.examplecom.EnumMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.examplecom.EnumMessage.InternalEnum} */ (reader.readEnum()); + msg.setInternalEnum(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addInternalEnums(values[i]); + } + break; + case 3: + var value = /** @type {!proto.othercom.ExternalEnum} */ (reader.readEnum()); + msg.setExternalEnum(value); + break; + case 4: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addExternalEnums(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.EnumMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.EnumMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.EnumMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.EnumMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInternalEnum(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getInternalEnumsList(); + if (f.length > 0) { + writer.writePackedEnum( + 2, + f + ); + } + f = message.getExternalEnum(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getExternalEnumsList(); + if (f.length > 0) { + writer.writePackedEnum( + 4, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.examplecom.EnumMessage.InternalEnum = { + DEFAULT: 0, + FIRST: 1, + SECOND: 2, + THIRD: 3 +}; + +/** + * optional InternalEnum internal_enum = 1; + * @return {!proto.examplecom.EnumMessage.InternalEnum} + */ +proto.examplecom.EnumMessage.prototype.getInternalEnum = function() { + return /** @type {!proto.examplecom.EnumMessage.InternalEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.examplecom.EnumMessage.InternalEnum} value + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.setInternalEnum = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * repeated InternalEnum internal_enums = 2; + * @return {!Array} + */ +proto.examplecom.EnumMessage.prototype.getInternalEnumsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.setInternalEnumsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!proto.examplecom.EnumMessage.InternalEnum} value + * @param {number=} opt_index + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.addInternalEnums = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.clearInternalEnumsList = function() { + return this.setInternalEnumsList([]); +}; + + +/** + * optional othercom.ExternalEnum external_enum = 3; + * @return {!proto.othercom.ExternalEnum} + */ +proto.examplecom.EnumMessage.prototype.getExternalEnum = function() { + return /** @type {!proto.othercom.ExternalEnum} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.othercom.ExternalEnum} value + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.setExternalEnum = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * repeated othercom.ExternalEnum external_enums = 4; + * @return {!Array} + */ +proto.examplecom.EnumMessage.prototype.getExternalEnumsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.setExternalEnumsList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!proto.othercom.ExternalEnum} value + * @param {number=} opt_index + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.addExternalEnums = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.EnumMessage} returns this + */ +proto.examplecom.EnumMessage.prototype.clearExternalEnumsList = function() { + return this.setExternalEnumsList([]); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/enum_message_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/enum_message_pb_service.d.ts new file mode 100644 index 0000000..d12dd4a --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/enum_message_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/enum_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/enum_message_pb_service.js b/examples/generated-grpc-native/proto/examplecom/enum_message_pb_service.js new file mode 100644 index 0000000..d12dd4a --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/enum_message_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/enum_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/extensions_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/extensions_pb.d.ts new file mode 100644 index 0000000..27ca00f --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/extensions_pb.d.ts @@ -0,0 +1,53 @@ +// package: examplecom +// file: proto/examplecom/extensions.proto + +import * as jspb from "google-protobuf"; + +export class ExtensionMessage extends jspb.Message { + hasMyExtensionString(): boolean; + clearMyExtensionString(): void; + getMyExtensionString(): string | undefined; + setMyExtensionString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ExtensionMessage.AsObject; + static toObject(includeInstance: boolean, msg: ExtensionMessage): ExtensionMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExtensionMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExtensionMessage; + static deserializeBinaryFromReader(message: ExtensionMessage, reader: jspb.BinaryReader): ExtensionMessage; +} + +export namespace ExtensionMessage { + export type AsObject = { + myExtensionString?: string, + } +} + +export class MyBase extends jspb.Message { + hasMyBaseString(): boolean; + clearMyBaseString(): void; + getMyBaseString(): string | undefined; + setMyBaseString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MyBase.AsObject; + static toObject(includeInstance: boolean, msg: MyBase): MyBase.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MyBase, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MyBase; + static deserializeBinaryFromReader(message: MyBase, reader: jspb.BinaryReader): MyBase; +} + +export namespace MyBase { + export type AsObject = { + myBaseString?: string, + } +} + + export const myExtensionInt32: jspb.ExtensionFieldInfo; + + export const myExtensionMessage: jspb.ExtensionFieldInfo; + diff --git a/examples/generated-grpc-native/proto/examplecom/extensions_pb.js b/examples/generated-grpc-native/proto/examplecom/extensions_pb.js new file mode 100644 index 0000000..72a0867 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/extensions_pb.js @@ -0,0 +1,448 @@ +// source: proto/examplecom/extensions.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.ExtensionMessage', null, global); +goog.exportSymbol('proto.examplecom.MyBase', null, global); +goog.exportSymbol('proto.examplecom.myExtensionInt32', null, global); +goog.exportSymbol('proto.examplecom.myExtensionMessage', 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.examplecom.ExtensionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.ExtensionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.ExtensionMessage.displayName = 'proto.examplecom.ExtensionMessage'; +} +/** + * 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.examplecom.MyBase = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.examplecom.MyBase, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.MyBase.displayName = 'proto.examplecom.MyBase'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.examplecom.MyBase.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.examplecom.MyBase.extensionsBinary = {}; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.ExtensionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.ExtensionMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.ExtensionMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ExtensionMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myExtensionString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : 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.examplecom.ExtensionMessage} + */ +proto.examplecom.ExtensionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.ExtensionMessage; + return proto.examplecom.ExtensionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.ExtensionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.ExtensionMessage} + */ +proto.examplecom.ExtensionMessage.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.setMyExtensionString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.ExtensionMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.ExtensionMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.ExtensionMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ExtensionMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string my_extension_string = 1; + * @return {string} + */ +proto.examplecom.ExtensionMessage.prototype.getMyExtensionString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ExtensionMessage} returns this + */ +proto.examplecom.ExtensionMessage.prototype.setMyExtensionString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.ExtensionMessage} returns this + */ +proto.examplecom.ExtensionMessage.prototype.clearMyExtensionString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ExtensionMessage.prototype.hasMyExtensionString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.MyBase.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.MyBase.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.MyBase} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MyBase.toObject = function(includeInstance, msg) { + var f, obj = { + myBaseString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.examplecom.MyBase.extensions, proto.examplecom.MyBase.prototype.getExtension, + 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.examplecom.MyBase} + */ +proto.examplecom.MyBase.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.MyBase; + return proto.examplecom.MyBase.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.MyBase} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.MyBase} + */ +proto.examplecom.MyBase.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.setMyBaseString(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.examplecom.MyBase.extensionsBinary, + proto.examplecom.MyBase.prototype.getExtension, + proto.examplecom.MyBase.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.MyBase.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.MyBase.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.MyBase} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MyBase.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.examplecom.MyBase.extensionsBinary, proto.examplecom.MyBase.prototype.getExtension); +}; + + +/** + * required string my_base_string = 1; + * @return {string} + */ +proto.examplecom.MyBase.prototype.getMyBaseString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.MyBase} returns this + */ +proto.examplecom.MyBase.prototype.setMyBaseString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.MyBase} returns this + */ +proto.examplecom.MyBase.prototype.clearMyBaseString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MyBase.prototype.hasMyBaseString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `myExtensionInt32`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.examplecom.myExtensionInt32 = new jspb.ExtensionFieldInfo( + 1000, + {myExtensionInt32: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.examplecom.MyBase.extensionsBinary[1000] = new jspb.ExtensionFieldBinaryInfo( + proto.examplecom.myExtensionInt32, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.examplecom.MyBase.extensions[1000] = proto.examplecom.myExtensionInt32; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `myExtensionMessage`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.examplecom.myExtensionMessage = new jspb.ExtensionFieldInfo( + 1001, + {myExtensionMessage: 0}, + proto.examplecom.ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.examplecom.ExtensionMessage.toObject), + 0); + +proto.examplecom.MyBase.extensionsBinary[1001] = new jspb.ExtensionFieldBinaryInfo( + proto.examplecom.myExtensionMessage, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.examplecom.ExtensionMessage.serializeBinaryToWriter, + proto.examplecom.ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.examplecom.MyBase.extensions[1001] = proto.examplecom.myExtensionMessage; + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/extensions_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/extensions_pb_service.d.ts new file mode 100644 index 0000000..df4bca8 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/extensions_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/extensions.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/extensions_pb_service.js b/examples/generated-grpc-native/proto/examplecom/extensions_pb_service.js new file mode 100644 index 0000000..df4bca8 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/extensions_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/extensions.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/getter_name_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/getter_name_pb.d.ts new file mode 100644 index 0000000..25e5995 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/getter_name_pb.d.ts @@ -0,0 +1,35 @@ +// package: examplecom +// file: proto/examplecom/getter_name.proto + +import * as jspb from "google-protobuf"; + +export class GetterNameConflictMessage extends jspb.Message { + hasExtension$(): boolean; + clearExtension$(): void; + getExtension$(): string | undefined; + setExtension$(value: string): void; + + hasJsPbMessageId$(): boolean; + clearJsPbMessageId$(): void; + getJsPbMessageId$(): Uint8Array | string; + getJsPbMessageId_asU8(): Uint8Array; + getJsPbMessageId_asB64(): string; + setJsPbMessageId$(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetterNameConflictMessage.AsObject; + static toObject(includeInstance: boolean, msg: GetterNameConflictMessage): GetterNameConflictMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GetterNameConflictMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetterNameConflictMessage; + static deserializeBinaryFromReader(message: GetterNameConflictMessage, reader: jspb.BinaryReader): GetterNameConflictMessage; +} + +export namespace GetterNameConflictMessage { + export type AsObject = { + extension?: string, + jsPbMessageId: Uint8Array | string, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/getter_name_pb.js b/examples/generated-grpc-native/proto/examplecom/getter_name_pb.js new file mode 100644 index 0000000..067ee47 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/getter_name_pb.js @@ -0,0 +1,260 @@ +// source: proto/examplecom/getter_name.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.GetterNameConflictMessage', 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.examplecom.GetterNameConflictMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.GetterNameConflictMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.GetterNameConflictMessage.displayName = 'proto.examplecom.GetterNameConflictMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.GetterNameConflictMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.GetterNameConflictMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.GetterNameConflictMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.GetterNameConflictMessage.toObject = function(includeInstance, msg) { + var f, obj = { + extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, + jsPbMessageId: msg.getJsPbMessageId_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.examplecom.GetterNameConflictMessage} + */ +proto.examplecom.GetterNameConflictMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.GetterNameConflictMessage; + return proto.examplecom.GetterNameConflictMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.GetterNameConflictMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.GetterNameConflictMessage} + */ +proto.examplecom.GetterNameConflictMessage.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.setExtension$(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setJsPbMessageId$(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.GetterNameConflictMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.GetterNameConflictMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.GetterNameConflictMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.GetterNameConflictMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional string extension = 1; + * @return {string} + */ +proto.examplecom.GetterNameConflictMessage.prototype.getExtension$ = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.GetterNameConflictMessage} returns this + */ +proto.examplecom.GetterNameConflictMessage.prototype.setExtension$ = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.GetterNameConflictMessage} returns this + */ +proto.examplecom.GetterNameConflictMessage.prototype.clearExtension$ = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.GetterNameConflictMessage.prototype.hasExtension$ = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes js_pb_message_id = 2; + * @return {!(string|Uint8Array)} + */ +proto.examplecom.GetterNameConflictMessage.prototype.getJsPbMessageId$ = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes js_pb_message_id = 2; + * This is a type-conversion wrapper around `getJsPbMessageId$()` + * @return {string} + */ +proto.examplecom.GetterNameConflictMessage.prototype.getJsPbMessageId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getJsPbMessageId$())); +}; + + +/** + * optional bytes js_pb_message_id = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getJsPbMessageId$()` + * @return {!Uint8Array} + */ +proto.examplecom.GetterNameConflictMessage.prototype.getJsPbMessageId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getJsPbMessageId$())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.examplecom.GetterNameConflictMessage} returns this + */ +proto.examplecom.GetterNameConflictMessage.prototype.setJsPbMessageId$ = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.GetterNameConflictMessage} returns this + */ +proto.examplecom.GetterNameConflictMessage.prototype.clearJsPbMessageId$ = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.GetterNameConflictMessage.prototype.hasJsPbMessageId$ = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/getter_name_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/getter_name_pb_service.d.ts new file mode 100644 index 0000000..3671807 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/getter_name_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/getter_name.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/getter_name_pb_service.js b/examples/generated-grpc-native/proto/examplecom/getter_name_pb_service.js new file mode 100644 index 0000000..3671807 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/getter_name_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/getter_name.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/map_message_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/map_message_pb.d.ts new file mode 100644 index 0000000..b767467 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/map_message_pb.d.ts @@ -0,0 +1,66 @@ +// package: examplecom +// file: proto/examplecom/map_message.proto + +import * as jspb from "google-protobuf"; +import * as proto_othercom_external_enum_pb from "../../proto/othercom/external_enum_pb"; +import * as proto_othercom_external_child_message_pb from "../../proto/othercom/external_child_message_pb"; + +export class MapMessage extends jspb.Message { + getInternalEnumsMap(): jspb.Map; + clearInternalEnumsMap(): void; + getInternalChildrenMap(): jspb.Map; + clearInternalChildrenMap(): void; + getExternalEnumsMap(): jspb.Map; + clearExternalEnumsMap(): void; + getExternalChildrenMap(): jspb.Map; + clearExternalChildrenMap(): void; + getPrimitiveIntsMap(): jspb.Map; + clearPrimitiveIntsMap(): void; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MapMessage.AsObject; + static toObject(includeInstance: boolean, msg: MapMessage): MapMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MapMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MapMessage; + static deserializeBinaryFromReader(message: MapMessage, reader: jspb.BinaryReader): MapMessage; +} + +export namespace MapMessage { + export type AsObject = { + internalEnumsMap: Array<[number, MapMessage.InternalEnumMap[keyof MapMessage.InternalEnumMap]]>, + internalChildrenMap: Array<[string, MapMessage.InternalChildMessage.AsObject]>, + externalEnumsMap: Array<[number, proto_othercom_external_enum_pb.ExternalEnum[keyof proto_othercom_external_enum_pb.ExternalEnum]]>, + externalChildrenMap: Array<[string, proto_othercom_external_child_message_pb.ExternalChildMessage.AsObject]>, + primitiveIntsMap: Array<[string, number]>, + } + + export class InternalChildMessage extends jspb.Message { + getMyString(): string; + setMyString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): InternalChildMessage.AsObject; + static toObject(includeInstance: boolean, msg: InternalChildMessage): InternalChildMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: InternalChildMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): InternalChildMessage; + static deserializeBinaryFromReader(message: InternalChildMessage, reader: jspb.BinaryReader): InternalChildMessage; + } + + export namespace InternalChildMessage { + export type AsObject = { + myString: string, + } + } + + export interface InternalEnumMap { + DEFAULT: 0; + FIRST: 1; + SECOND: 2; + } + + export const InternalEnum: InternalEnumMap; +} + diff --git a/examples/generated-grpc-native/proto/examplecom/map_message_pb.js b/examples/generated-grpc-native/proto/examplecom/map_message_pb.js new file mode 100644 index 0000000..2f9912c --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/map_message_pb.js @@ -0,0 +1,471 @@ +// source: proto/examplecom/map_message.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var proto_othercom_external_enum_pb = require('../../proto/othercom/external_enum_pb.js'); +goog.object.extend(proto, proto_othercom_external_enum_pb); +var proto_othercom_external_child_message_pb = require('../../proto/othercom/external_child_message_pb.js'); +goog.object.extend(proto, proto_othercom_external_child_message_pb); +goog.exportSymbol('proto.examplecom.MapMessage', null, global); +goog.exportSymbol('proto.examplecom.MapMessage.InternalChildMessage', null, global); +goog.exportSymbol('proto.examplecom.MapMessage.InternalEnum', 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.examplecom.MapMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.MapMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.MapMessage.displayName = 'proto.examplecom.MapMessage'; +} +/** + * 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.examplecom.MapMessage.InternalChildMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.MapMessage.InternalChildMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.MapMessage.InternalChildMessage.displayName = 'proto.examplecom.MapMessage.InternalChildMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.MapMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.MapMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.MapMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MapMessage.toObject = function(includeInstance, msg) { + var f, obj = { + internalEnumsMap: (f = msg.getInternalEnumsMap()) ? f.toObject(includeInstance, undefined) : [], + internalChildrenMap: (f = msg.getInternalChildrenMap()) ? f.toObject(includeInstance, proto.examplecom.MapMessage.InternalChildMessage.toObject) : [], + externalEnumsMap: (f = msg.getExternalEnumsMap()) ? f.toObject(includeInstance, undefined) : [], + externalChildrenMap: (f = msg.getExternalChildrenMap()) ? f.toObject(includeInstance, proto.othercom.ExternalChildMessage.toObject) : [], + primitiveIntsMap: (f = msg.getPrimitiveIntsMap()) ? 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.examplecom.MapMessage} + */ +proto.examplecom.MapMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.MapMessage; + return proto.examplecom.MapMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.MapMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.MapMessage} + */ +proto.examplecom.MapMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getInternalEnumsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readEnum, null, 0, 0); + }); + break; + case 2: + var value = msg.getInternalChildrenMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.examplecom.MapMessage.InternalChildMessage.deserializeBinaryFromReader, "", new proto.examplecom.MapMessage.InternalChildMessage()); + }); + break; + case 3: + var value = msg.getExternalEnumsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readEnum, null, 0, 0); + }); + break; + case 4: + var value = msg.getExternalChildrenMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.othercom.ExternalChildMessage.deserializeBinaryFromReader, "", new proto.othercom.ExternalChildMessage()); + }); + break; + case 5: + var value = msg.getPrimitiveIntsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.MapMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.MapMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.MapMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MapMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInternalEnumsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeEnum); + } + f = message.getInternalChildrenMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.examplecom.MapMessage.InternalChildMessage.serializeBinaryToWriter); + } + f = message.getExternalEnumsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeEnum); + } + f = message.getExternalChildrenMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.othercom.ExternalChildMessage.serializeBinaryToWriter); + } + f = message.getPrimitiveIntsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); + } +}; + + +/** + * @enum {number} + */ +proto.examplecom.MapMessage.InternalEnum = { + DEFAULT: 0, + FIRST: 1, + SECOND: 2 +}; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.MapMessage.InternalChildMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.MapMessage.InternalChildMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.MapMessage.InternalChildMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MapMessage.InternalChildMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myString: 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.examplecom.MapMessage.InternalChildMessage} + */ +proto.examplecom.MapMessage.InternalChildMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.MapMessage.InternalChildMessage; + return proto.examplecom.MapMessage.InternalChildMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.MapMessage.InternalChildMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.MapMessage.InternalChildMessage} + */ +proto.examplecom.MapMessage.InternalChildMessage.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.setMyString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.MapMessage.InternalChildMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.MapMessage.InternalChildMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.MapMessage.InternalChildMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MapMessage.InternalChildMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string my_string = 1; + * @return {string} + */ +proto.examplecom.MapMessage.InternalChildMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.MapMessage.InternalChildMessage} returns this + */ +proto.examplecom.MapMessage.InternalChildMessage.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * map internal_enums = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.examplecom.MapMessage.prototype.getInternalEnumsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.examplecom.MapMessage} returns this + */ +proto.examplecom.MapMessage.prototype.clearInternalEnumsMap = function() { + this.getInternalEnumsMap().clear(); + return this;}; + + +/** + * map internal_children = 2; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.examplecom.MapMessage.prototype.getInternalChildrenMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 2, opt_noLazyCreate, + proto.examplecom.MapMessage.InternalChildMessage)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.examplecom.MapMessage} returns this + */ +proto.examplecom.MapMessage.prototype.clearInternalChildrenMap = function() { + this.getInternalChildrenMap().clear(); + return this;}; + + +/** + * map external_enums = 3; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.examplecom.MapMessage.prototype.getExternalEnumsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 3, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.examplecom.MapMessage} returns this + */ +proto.examplecom.MapMessage.prototype.clearExternalEnumsMap = function() { + this.getExternalEnumsMap().clear(); + return this;}; + + +/** + * map external_children = 4; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.examplecom.MapMessage.prototype.getExternalChildrenMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 4, opt_noLazyCreate, + proto.othercom.ExternalChildMessage)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.examplecom.MapMessage} returns this + */ +proto.examplecom.MapMessage.prototype.clearExternalChildrenMap = function() { + this.getExternalChildrenMap().clear(); + return this;}; + + +/** + * map primitive_ints = 5; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.examplecom.MapMessage.prototype.getPrimitiveIntsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 5, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.examplecom.MapMessage} returns this + */ +proto.examplecom.MapMessage.prototype.clearPrimitiveIntsMap = function() { + this.getPrimitiveIntsMap().clear(); + return this;}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/map_message_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/map_message_pb_service.d.ts new file mode 100644 index 0000000..f80a25a --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/map_message_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/map_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/map_message_pb_service.js b/examples/generated-grpc-native/proto/examplecom/map_message_pb_service.js new file mode 100644 index 0000000..f80a25a --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/map_message_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/map_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/oneof_message_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb.d.ts new file mode 100644 index 0000000..0a613e0 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb.d.ts @@ -0,0 +1,145 @@ +// package: examplecom +// file: proto/examplecom/oneof_message.proto + +import * as jspb from "google-protobuf"; +import * as proto_othercom_external_child_message_pb from "../../proto/othercom/external_child_message_pb"; + +export class OneOfMessage extends jspb.Message { + hasInternalChildMessage(): boolean; + clearInternalChildMessage(): void; + getInternalChildMessage(): OneOfMessage.InternalChildMessage | undefined; + setInternalChildMessage(value?: OneOfMessage.InternalChildMessage): void; + + hasExternalChildMessage(): boolean; + clearExternalChildMessage(): void; + getExternalChildMessage(): proto_othercom_external_child_message_pb.ExternalChildMessage | undefined; + setExternalChildMessage(value?: proto_othercom_external_child_message_pb.ExternalChildMessage): void; + + hasMyString(): boolean; + clearMyString(): void; + getMyString(): string; + setMyString(value: string): void; + + hasMyInt64(): boolean; + clearMyInt64(): void; + getMyInt64(): number; + setMyInt64(value: number): void; + + getGroupCase(): OneOfMessage.GroupCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OneOfMessage.AsObject; + static toObject(includeInstance: boolean, msg: OneOfMessage): OneOfMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OneOfMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OneOfMessage; + static deserializeBinaryFromReader(message: OneOfMessage, reader: jspb.BinaryReader): OneOfMessage; +} + +export namespace OneOfMessage { + export type AsObject = { + internalChildMessage?: OneOfMessage.InternalChildMessage.AsObject, + externalChildMessage?: proto_othercom_external_child_message_pb.ExternalChildMessage.AsObject, + myString: string, + myInt64: number, + } + + export class InternalChildMessage extends jspb.Message { + getMyString(): string; + setMyString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): InternalChildMessage.AsObject; + static toObject(includeInstance: boolean, msg: InternalChildMessage): InternalChildMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: InternalChildMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): InternalChildMessage; + static deserializeBinaryFromReader(message: InternalChildMessage, reader: jspb.BinaryReader): InternalChildMessage; + } + + export namespace InternalChildMessage { + export type AsObject = { + myString: string, + } + } + + export enum GroupCase { + GROUP_NOT_SET = 0, + INTERNAL_CHILD_MESSAGE = 1, + EXTERNAL_CHILD_MESSAGE = 2, + MY_STRING = 3, + MY_INT64 = 4, + } +} + +export class CamelCasedOneOfMessage extends jspb.Message { + hasAnint(): boolean; + clearAnint(): void; + getAnint(): number; + setAnint(value: number): void; + + hasThestring(): boolean; + clearThestring(): void; + getThestring(): string; + setThestring(value: string): void; + + getCamelcasedmessageCase(): CamelCasedOneOfMessage.CamelcasedmessageCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CamelCasedOneOfMessage.AsObject; + static toObject(includeInstance: boolean, msg: CamelCasedOneOfMessage): CamelCasedOneOfMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CamelCasedOneOfMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CamelCasedOneOfMessage; + static deserializeBinaryFromReader(message: CamelCasedOneOfMessage, reader: jspb.BinaryReader): CamelCasedOneOfMessage; +} + +export namespace CamelCasedOneOfMessage { + export type AsObject = { + anint: number, + thestring: string, + } + + export enum CamelcasedmessageCase { + CAMELCASEDMESSAGE_NOT_SET = 0, + ANINT = 1, + THESTRING = 2, + } +} + +export class SnakeCasedOneOfMessage extends jspb.Message { + hasAnint(): boolean; + clearAnint(): void; + getAnint(): number; + setAnint(value: number): void; + + hasThestring(): boolean; + clearThestring(): void; + getThestring(): string; + setThestring(value: string): void; + + getSnakeCasedMessageCase(): SnakeCasedOneOfMessage.SnakeCasedMessageCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SnakeCasedOneOfMessage.AsObject; + static toObject(includeInstance: boolean, msg: SnakeCasedOneOfMessage): SnakeCasedOneOfMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SnakeCasedOneOfMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SnakeCasedOneOfMessage; + static deserializeBinaryFromReader(message: SnakeCasedOneOfMessage, reader: jspb.BinaryReader): SnakeCasedOneOfMessage; +} + +export namespace SnakeCasedOneOfMessage { + export type AsObject = { + anint: number, + thestring: string, + } + + export enum SnakeCasedMessageCase { + SNAKE_CASED_MESSAGE_NOT_SET = 0, + ANINT = 1, + THESTRING = 2, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/oneof_message_pb.js b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb.js new file mode 100644 index 0000000..0ae7ae8 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb.js @@ -0,0 +1,1011 @@ +// source: proto/examplecom/oneof_message.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var proto_othercom_external_child_message_pb = require('../../proto/othercom/external_child_message_pb.js'); +goog.object.extend(proto, proto_othercom_external_child_message_pb); +goog.exportSymbol('proto.examplecom.CamelCasedOneOfMessage', null, global); +goog.exportSymbol('proto.examplecom.CamelCasedOneOfMessage.CamelcasedmessageCase', null, global); +goog.exportSymbol('proto.examplecom.OneOfMessage', null, global); +goog.exportSymbol('proto.examplecom.OneOfMessage.GroupCase', null, global); +goog.exportSymbol('proto.examplecom.OneOfMessage.InternalChildMessage', null, global); +goog.exportSymbol('proto.examplecom.SnakeCasedOneOfMessage', null, global); +goog.exportSymbol('proto.examplecom.SnakeCasedOneOfMessage.SnakeCasedMessageCase', 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.examplecom.OneOfMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.examplecom.OneOfMessage.oneofGroups_); +}; +goog.inherits(proto.examplecom.OneOfMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.OneOfMessage.displayName = 'proto.examplecom.OneOfMessage'; +} +/** + * 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.examplecom.OneOfMessage.InternalChildMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.OneOfMessage.InternalChildMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.OneOfMessage.InternalChildMessage.displayName = 'proto.examplecom.OneOfMessage.InternalChildMessage'; +} +/** + * 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.examplecom.CamelCasedOneOfMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.examplecom.CamelCasedOneOfMessage.oneofGroups_); +}; +goog.inherits(proto.examplecom.CamelCasedOneOfMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.CamelCasedOneOfMessage.displayName = 'proto.examplecom.CamelCasedOneOfMessage'; +} +/** + * 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.examplecom.SnakeCasedOneOfMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.examplecom.SnakeCasedOneOfMessage.oneofGroups_); +}; +goog.inherits(proto.examplecom.SnakeCasedOneOfMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.SnakeCasedOneOfMessage.displayName = 'proto.examplecom.SnakeCasedOneOfMessage'; +} + +/** + * 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.examplecom.OneOfMessage.oneofGroups_ = [[1,2,3,4]]; + +/** + * @enum {number} + */ +proto.examplecom.OneOfMessage.GroupCase = { + GROUP_NOT_SET: 0, + INTERNAL_CHILD_MESSAGE: 1, + EXTERNAL_CHILD_MESSAGE: 2, + MY_STRING: 3, + MY_INT64: 4 +}; + +/** + * @return {proto.examplecom.OneOfMessage.GroupCase} + */ +proto.examplecom.OneOfMessage.prototype.getGroupCase = function() { + return /** @type {proto.examplecom.OneOfMessage.GroupCase} */(jspb.Message.computeOneofCase(this, proto.examplecom.OneOfMessage.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.OneOfMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.OneOfMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.OneOfMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.OneOfMessage.toObject = function(includeInstance, msg) { + var f, obj = { + internalChildMessage: (f = msg.getInternalChildMessage()) && proto.examplecom.OneOfMessage.InternalChildMessage.toObject(includeInstance, f), + externalChildMessage: (f = msg.getExternalChildMessage()) && proto_othercom_external_child_message_pb.ExternalChildMessage.toObject(includeInstance, f), + myString: jspb.Message.getFieldWithDefault(msg, 3, ""), + myInt64: jspb.Message.getFieldWithDefault(msg, 4, 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.examplecom.OneOfMessage} + */ +proto.examplecom.OneOfMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.OneOfMessage; + return proto.examplecom.OneOfMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.OneOfMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.OneOfMessage} + */ +proto.examplecom.OneOfMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.examplecom.OneOfMessage.InternalChildMessage; + reader.readMessage(value,proto.examplecom.OneOfMessage.InternalChildMessage.deserializeBinaryFromReader); + msg.setInternalChildMessage(value); + break; + case 2: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.setExternalChildMessage(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMyString(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMyInt64(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.OneOfMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.OneOfMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.OneOfMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.OneOfMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInternalChildMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.examplecom.OneOfMessage.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getExternalChildMessage(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeInt64( + 4, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.OneOfMessage.InternalChildMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.OneOfMessage.InternalChildMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.OneOfMessage.InternalChildMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.OneOfMessage.InternalChildMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myString: 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.examplecom.OneOfMessage.InternalChildMessage} + */ +proto.examplecom.OneOfMessage.InternalChildMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.OneOfMessage.InternalChildMessage; + return proto.examplecom.OneOfMessage.InternalChildMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.OneOfMessage.InternalChildMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.OneOfMessage.InternalChildMessage} + */ +proto.examplecom.OneOfMessage.InternalChildMessage.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.setMyString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.OneOfMessage.InternalChildMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.OneOfMessage.InternalChildMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.OneOfMessage.InternalChildMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.OneOfMessage.InternalChildMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string my_string = 1; + * @return {string} + */ +proto.examplecom.OneOfMessage.InternalChildMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.OneOfMessage.InternalChildMessage} returns this + */ +proto.examplecom.OneOfMessage.InternalChildMessage.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional InternalChildMessage internal_child_message = 1; + * @return {?proto.examplecom.OneOfMessage.InternalChildMessage} + */ +proto.examplecom.OneOfMessage.prototype.getInternalChildMessage = function() { + return /** @type{?proto.examplecom.OneOfMessage.InternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto.examplecom.OneOfMessage.InternalChildMessage, 1)); +}; + + +/** + * @param {?proto.examplecom.OneOfMessage.InternalChildMessage|undefined} value + * @return {!proto.examplecom.OneOfMessage} returns this +*/ +proto.examplecom.OneOfMessage.prototype.setInternalChildMessage = function(value) { + return jspb.Message.setOneofWrapperField(this, 1, proto.examplecom.OneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.OneOfMessage} returns this + */ +proto.examplecom.OneOfMessage.prototype.clearInternalChildMessage = function() { + return this.setInternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.OneOfMessage.prototype.hasInternalChildMessage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional othercom.ExternalChildMessage external_child_message = 2; + * @return {?proto.othercom.ExternalChildMessage} + */ +proto.examplecom.OneOfMessage.prototype.getExternalChildMessage = function() { + return /** @type{?proto.othercom.ExternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 2)); +}; + + +/** + * @param {?proto.othercom.ExternalChildMessage|undefined} value + * @return {!proto.examplecom.OneOfMessage} returns this +*/ +proto.examplecom.OneOfMessage.prototype.setExternalChildMessage = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.examplecom.OneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.OneOfMessage} returns this + */ +proto.examplecom.OneOfMessage.prototype.clearExternalChildMessage = function() { + return this.setExternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.OneOfMessage.prototype.hasExternalChildMessage = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string my_string = 3; + * @return {string} + */ +proto.examplecom.OneOfMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.OneOfMessage} returns this + */ +proto.examplecom.OneOfMessage.prototype.setMyString = function(value) { + return jspb.Message.setOneofField(this, 3, proto.examplecom.OneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.OneOfMessage} returns this + */ +proto.examplecom.OneOfMessage.prototype.clearMyString = function() { + return jspb.Message.setOneofField(this, 3, proto.examplecom.OneOfMessage.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.OneOfMessage.prototype.hasMyString = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional int64 my_int64 = 4; + * @return {number} + */ +proto.examplecom.OneOfMessage.prototype.getMyInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.OneOfMessage} returns this + */ +proto.examplecom.OneOfMessage.prototype.setMyInt64 = function(value) { + return jspb.Message.setOneofField(this, 4, proto.examplecom.OneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.OneOfMessage} returns this + */ +proto.examplecom.OneOfMessage.prototype.clearMyInt64 = function() { + return jspb.Message.setOneofField(this, 4, proto.examplecom.OneOfMessage.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.OneOfMessage.prototype.hasMyInt64 = function() { + return jspb.Message.getField(this, 4) != 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.examplecom.CamelCasedOneOfMessage.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.examplecom.CamelCasedOneOfMessage.CamelcasedmessageCase = { + CAMELCASEDMESSAGE_NOT_SET: 0, + ANINT: 1, + THESTRING: 2 +}; + +/** + * @return {proto.examplecom.CamelCasedOneOfMessage.CamelcasedmessageCase} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.getCamelcasedmessageCase = function() { + return /** @type {proto.examplecom.CamelCasedOneOfMessage.CamelcasedmessageCase} */(jspb.Message.computeOneofCase(this, proto.examplecom.CamelCasedOneOfMessage.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.CamelCasedOneOfMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.CamelCasedOneOfMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.CamelCasedOneOfMessage.toObject = function(includeInstance, msg) { + var f, obj = { + anint: jspb.Message.getFieldWithDefault(msg, 1, 0), + thestring: 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.examplecom.CamelCasedOneOfMessage} + */ +proto.examplecom.CamelCasedOneOfMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.CamelCasedOneOfMessage; + return proto.examplecom.CamelCasedOneOfMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.CamelCasedOneOfMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.CamelCasedOneOfMessage} + */ +proto.examplecom.CamelCasedOneOfMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnint(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setThestring(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.CamelCasedOneOfMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.CamelCasedOneOfMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.CamelCasedOneOfMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional int32 anInt = 1; + * @return {number} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.getAnint = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.CamelCasedOneOfMessage} returns this + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.setAnint = function(value) { + return jspb.Message.setOneofField(this, 1, proto.examplecom.CamelCasedOneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.CamelCasedOneOfMessage} returns this + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.clearAnint = function() { + return jspb.Message.setOneofField(this, 1, proto.examplecom.CamelCasedOneOfMessage.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.hasAnint = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string theString = 2; + * @return {string} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.getThestring = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.CamelCasedOneOfMessage} returns this + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.setThestring = function(value) { + return jspb.Message.setOneofField(this, 2, proto.examplecom.CamelCasedOneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.CamelCasedOneOfMessage} returns this + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.clearThestring = function() { + return jspb.Message.setOneofField(this, 2, proto.examplecom.CamelCasedOneOfMessage.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.CamelCasedOneOfMessage.prototype.hasThestring = 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.examplecom.SnakeCasedOneOfMessage.oneofGroups_ = [[1,2]]; + +/** + * @enum {number} + */ +proto.examplecom.SnakeCasedOneOfMessage.SnakeCasedMessageCase = { + SNAKE_CASED_MESSAGE_NOT_SET: 0, + ANINT: 1, + THESTRING: 2 +}; + +/** + * @return {proto.examplecom.SnakeCasedOneOfMessage.SnakeCasedMessageCase} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.getSnakeCasedMessageCase = function() { + return /** @type {proto.examplecom.SnakeCasedOneOfMessage.SnakeCasedMessageCase} */(jspb.Message.computeOneofCase(this, proto.examplecom.SnakeCasedOneOfMessage.oneofGroups_[0])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.SnakeCasedOneOfMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.SnakeCasedOneOfMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.SnakeCasedOneOfMessage.toObject = function(includeInstance, msg) { + var f, obj = { + anint: jspb.Message.getFieldWithDefault(msg, 1, 0), + thestring: 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.examplecom.SnakeCasedOneOfMessage} + */ +proto.examplecom.SnakeCasedOneOfMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.SnakeCasedOneOfMessage; + return proto.examplecom.SnakeCasedOneOfMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.SnakeCasedOneOfMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.SnakeCasedOneOfMessage} + */ +proto.examplecom.SnakeCasedOneOfMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnint(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setThestring(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.SnakeCasedOneOfMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.SnakeCasedOneOfMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.SnakeCasedOneOfMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional int32 anint = 1; + * @return {number} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.getAnint = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.SnakeCasedOneOfMessage} returns this + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.setAnint = function(value) { + return jspb.Message.setOneofField(this, 1, proto.examplecom.SnakeCasedOneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SnakeCasedOneOfMessage} returns this + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.clearAnint = function() { + return jspb.Message.setOneofField(this, 1, proto.examplecom.SnakeCasedOneOfMessage.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.hasAnint = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string theString = 2; + * @return {string} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.getThestring = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.SnakeCasedOneOfMessage} returns this + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.setThestring = function(value) { + return jspb.Message.setOneofField(this, 2, proto.examplecom.SnakeCasedOneOfMessage.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SnakeCasedOneOfMessage} returns this + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.clearThestring = function() { + return jspb.Message.setOneofField(this, 2, proto.examplecom.SnakeCasedOneOfMessage.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SnakeCasedOneOfMessage.prototype.hasThestring = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/oneof_message_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb_service.d.ts new file mode 100644 index 0000000..62a2c13 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/oneof_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/oneof_message_pb_service.js b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb_service.js new file mode 100644 index 0000000..62a2c13 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/oneof_message_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/oneof_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb.d.ts new file mode 100644 index 0000000..809372f --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb.d.ts @@ -0,0 +1,80 @@ +// package: examplecom +// file: proto/examplecom/parent_message_v2.proto + +import * as jspb from "google-protobuf"; +import * as proto_othercom_external_child_message_pb from "../../proto/othercom/external_child_message_pb"; + +export class ParentMessageV2 extends jspb.Message { + hasInternalChildMessage(): boolean; + clearInternalChildMessage(): void; + getInternalChildMessage(): ParentMessageV2.InternalChildMessage; + setInternalChildMessage(value?: ParentMessageV2.InternalChildMessage): void; + + hasOptInternalChildMessage(): boolean; + clearOptInternalChildMessage(): void; + getOptInternalChildMessage(): ParentMessageV2.InternalChildMessage | undefined; + setOptInternalChildMessage(value?: ParentMessageV2.InternalChildMessage): void; + + clearInternalChildrenList(): void; + getInternalChildrenList(): Array; + setInternalChildrenList(value: Array): void; + addInternalChildren(value?: ParentMessageV2.InternalChildMessage, index?: number): ParentMessageV2.InternalChildMessage; + + hasExternalChildMessage(): boolean; + clearExternalChildMessage(): void; + getExternalChildMessage(): proto_othercom_external_child_message_pb.ExternalChildMessage; + setExternalChildMessage(value?: proto_othercom_external_child_message_pb.ExternalChildMessage): void; + + hasOptExternalChildMessage(): boolean; + clearOptExternalChildMessage(): void; + getOptExternalChildMessage(): proto_othercom_external_child_message_pb.ExternalChildMessage | undefined; + setOptExternalChildMessage(value?: proto_othercom_external_child_message_pb.ExternalChildMessage): void; + + clearExternalChildrenList(): void; + getExternalChildrenList(): Array; + setExternalChildrenList(value: Array): void; + addExternalChildren(value?: proto_othercom_external_child_message_pb.ExternalChildMessage, index?: number): proto_othercom_external_child_message_pb.ExternalChildMessage; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ParentMessageV2.AsObject; + static toObject(includeInstance: boolean, msg: ParentMessageV2): ParentMessageV2.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ParentMessageV2, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ParentMessageV2; + static deserializeBinaryFromReader(message: ParentMessageV2, reader: jspb.BinaryReader): ParentMessageV2; +} + +export namespace ParentMessageV2 { + export type AsObject = { + internalChildMessage: ParentMessageV2.InternalChildMessage.AsObject, + optInternalChildMessage?: ParentMessageV2.InternalChildMessage.AsObject, + internalChildrenList: Array, + externalChildMessage: proto_othercom_external_child_message_pb.ExternalChildMessage.AsObject, + optExternalChildMessage?: proto_othercom_external_child_message_pb.ExternalChildMessage.AsObject, + externalChildrenList: Array, + } + + export class InternalChildMessage extends jspb.Message { + hasMyString(): boolean; + clearMyString(): void; + getMyString(): string | undefined; + setMyString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): InternalChildMessage.AsObject; + static toObject(includeInstance: boolean, msg: InternalChildMessage): InternalChildMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: InternalChildMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): InternalChildMessage; + static deserializeBinaryFromReader(message: InternalChildMessage, reader: jspb.BinaryReader): InternalChildMessage; + } + + export namespace InternalChildMessage { + export type AsObject = { + myString?: string, + } + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb.js b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb.js new file mode 100644 index 0000000..eb45248 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb.js @@ -0,0 +1,629 @@ +// source: proto/examplecom/parent_message_v2.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var proto_othercom_external_child_message_pb = require('../../proto/othercom/external_child_message_pb.js'); +goog.object.extend(proto, proto_othercom_external_child_message_pb); +goog.exportSymbol('proto.examplecom.ParentMessageV2', null, global); +goog.exportSymbol('proto.examplecom.ParentMessageV2.InternalChildMessage', 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.examplecom.ParentMessageV2 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.examplecom.ParentMessageV2.repeatedFields_, null); +}; +goog.inherits(proto.examplecom.ParentMessageV2, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.ParentMessageV2.displayName = 'proto.examplecom.ParentMessageV2'; +} +/** + * 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.examplecom.ParentMessageV2.InternalChildMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.ParentMessageV2.InternalChildMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.ParentMessageV2.InternalChildMessage.displayName = 'proto.examplecom.ParentMessageV2.InternalChildMessage'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.examplecom.ParentMessageV2.repeatedFields_ = [3,6]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.ParentMessageV2.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.ParentMessageV2.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.ParentMessageV2} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV2.toObject = function(includeInstance, msg) { + var f, obj = { + internalChildMessage: (f = msg.getInternalChildMessage()) && proto.examplecom.ParentMessageV2.InternalChildMessage.toObject(includeInstance, f), + optInternalChildMessage: (f = msg.getOptInternalChildMessage()) && proto.examplecom.ParentMessageV2.InternalChildMessage.toObject(includeInstance, f), + internalChildrenList: jspb.Message.toObjectList(msg.getInternalChildrenList(), + proto.examplecom.ParentMessageV2.InternalChildMessage.toObject, includeInstance), + externalChildMessage: (f = msg.getExternalChildMessage()) && proto_othercom_external_child_message_pb.ExternalChildMessage.toObject(includeInstance, f), + optExternalChildMessage: (f = msg.getOptExternalChildMessage()) && proto_othercom_external_child_message_pb.ExternalChildMessage.toObject(includeInstance, f), + externalChildrenList: jspb.Message.toObjectList(msg.getExternalChildrenList(), + proto_othercom_external_child_message_pb.ExternalChildMessage.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.examplecom.ParentMessageV2} + */ +proto.examplecom.ParentMessageV2.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.ParentMessageV2; + return proto.examplecom.ParentMessageV2.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.ParentMessageV2} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.ParentMessageV2} + */ +proto.examplecom.ParentMessageV2.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.examplecom.ParentMessageV2.InternalChildMessage; + reader.readMessage(value,proto.examplecom.ParentMessageV2.InternalChildMessage.deserializeBinaryFromReader); + msg.setInternalChildMessage(value); + break; + case 2: + var value = new proto.examplecom.ParentMessageV2.InternalChildMessage; + reader.readMessage(value,proto.examplecom.ParentMessageV2.InternalChildMessage.deserializeBinaryFromReader); + msg.setOptInternalChildMessage(value); + break; + case 3: + var value = new proto.examplecom.ParentMessageV2.InternalChildMessage; + reader.readMessage(value,proto.examplecom.ParentMessageV2.InternalChildMessage.deserializeBinaryFromReader); + msg.addInternalChildren(value); + break; + case 4: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.setExternalChildMessage(value); + break; + case 5: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.setOptExternalChildMessage(value); + break; + case 6: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.addExternalChildren(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.ParentMessageV2.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.ParentMessageV2.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.ParentMessageV2} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV2.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInternalChildMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.examplecom.ParentMessageV2.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getOptInternalChildMessage(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.examplecom.ParentMessageV2.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getInternalChildrenList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.examplecom.ParentMessageV2.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getExternalChildMessage(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getOptExternalChildMessage(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getExternalChildrenList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 6, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.ParentMessageV2.InternalChildMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.ParentMessageV2.InternalChildMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : 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.examplecom.ParentMessageV2.InternalChildMessage} + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.ParentMessageV2.InternalChildMessage; + return proto.examplecom.ParentMessageV2.InternalChildMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.ParentMessageV2.InternalChildMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.ParentMessageV2.InternalChildMessage} + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.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.setMyString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.ParentMessageV2.InternalChildMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.ParentMessageV2.InternalChildMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string my_string = 1; + * @return {string} + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ParentMessageV2.InternalChildMessage} returns this + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.prototype.setMyString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.ParentMessageV2.InternalChildMessage} returns this + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.prototype.clearMyString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV2.InternalChildMessage.prototype.hasMyString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required InternalChildMessage internal_child_message = 1; + * @return {!proto.examplecom.ParentMessageV2.InternalChildMessage} + */ +proto.examplecom.ParentMessageV2.prototype.getInternalChildMessage = function() { + return /** @type{!proto.examplecom.ParentMessageV2.InternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto.examplecom.ParentMessageV2.InternalChildMessage, 1, 1)); +}; + + +/** + * @param {!proto.examplecom.ParentMessageV2.InternalChildMessage} value + * @return {!proto.examplecom.ParentMessageV2} returns this +*/ +proto.examplecom.ParentMessageV2.prototype.setInternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.ParentMessageV2} returns this + */ +proto.examplecom.ParentMessageV2.prototype.clearInternalChildMessage = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV2.prototype.hasInternalChildMessage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional InternalChildMessage opt_internal_child_message = 2; + * @return {?proto.examplecom.ParentMessageV2.InternalChildMessage} + */ +proto.examplecom.ParentMessageV2.prototype.getOptInternalChildMessage = function() { + return /** @type{?proto.examplecom.ParentMessageV2.InternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto.examplecom.ParentMessageV2.InternalChildMessage, 2)); +}; + + +/** + * @param {?proto.examplecom.ParentMessageV2.InternalChildMessage|undefined} value + * @return {!proto.examplecom.ParentMessageV2} returns this +*/ +proto.examplecom.ParentMessageV2.prototype.setOptInternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.ParentMessageV2} returns this + */ +proto.examplecom.ParentMessageV2.prototype.clearOptInternalChildMessage = function() { + return this.setOptInternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV2.prototype.hasOptInternalChildMessage = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated InternalChildMessage internal_children = 3; + * @return {!Array} + */ +proto.examplecom.ParentMessageV2.prototype.getInternalChildrenList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.examplecom.ParentMessageV2.InternalChildMessage, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.ParentMessageV2} returns this +*/ +proto.examplecom.ParentMessageV2.prototype.setInternalChildrenList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.examplecom.ParentMessageV2.InternalChildMessage=} opt_value + * @param {number=} opt_index + * @return {!proto.examplecom.ParentMessageV2.InternalChildMessage} + */ +proto.examplecom.ParentMessageV2.prototype.addInternalChildren = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.examplecom.ParentMessageV2.InternalChildMessage, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.ParentMessageV2} returns this + */ +proto.examplecom.ParentMessageV2.prototype.clearInternalChildrenList = function() { + return this.setInternalChildrenList([]); +}; + + +/** + * required othercom.ExternalChildMessage external_child_message = 4; + * @return {!proto.othercom.ExternalChildMessage} + */ +proto.examplecom.ParentMessageV2.prototype.getExternalChildMessage = function() { + return /** @type{!proto.othercom.ExternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 4, 1)); +}; + + +/** + * @param {!proto.othercom.ExternalChildMessage} value + * @return {!proto.examplecom.ParentMessageV2} returns this +*/ +proto.examplecom.ParentMessageV2.prototype.setExternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.ParentMessageV2} returns this + */ +proto.examplecom.ParentMessageV2.prototype.clearExternalChildMessage = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV2.prototype.hasExternalChildMessage = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional othercom.ExternalChildMessage opt_external_child_message = 5; + * @return {?proto.othercom.ExternalChildMessage} + */ +proto.examplecom.ParentMessageV2.prototype.getOptExternalChildMessage = function() { + return /** @type{?proto.othercom.ExternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 5)); +}; + + +/** + * @param {?proto.othercom.ExternalChildMessage|undefined} value + * @return {!proto.examplecom.ParentMessageV2} returns this +*/ +proto.examplecom.ParentMessageV2.prototype.setOptExternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.ParentMessageV2} returns this + */ +proto.examplecom.ParentMessageV2.prototype.clearOptExternalChildMessage = function() { + return this.setOptExternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV2.prototype.hasOptExternalChildMessage = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * repeated othercom.ExternalChildMessage external_children = 6; + * @return {!Array} + */ +proto.examplecom.ParentMessageV2.prototype.getExternalChildrenList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.ParentMessageV2} returns this +*/ +proto.examplecom.ParentMessageV2.prototype.setExternalChildrenList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 6, value); +}; + + +/** + * @param {!proto.othercom.ExternalChildMessage=} opt_value + * @param {number=} opt_index + * @return {!proto.othercom.ExternalChildMessage} + */ +proto.examplecom.ParentMessageV2.prototype.addExternalChildren = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.othercom.ExternalChildMessage, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.ParentMessageV2} returns this + */ +proto.examplecom.ParentMessageV2.prototype.clearExternalChildrenList = function() { + return this.setExternalChildrenList([]); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb_service.d.ts new file mode 100644 index 0000000..dfa8872 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/parent_message_v2.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb_service.js b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb_service.js new file mode 100644 index 0000000..dfa8872 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v2_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/parent_message_v2.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb.d.ts new file mode 100644 index 0000000..74008a6 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb.d.ts @@ -0,0 +1,78 @@ +// package: examplecom +// file: proto/examplecom/parent_message_v3.proto + +import * as jspb from "google-protobuf"; +import * as proto_othercom_external_child_message_pb from "../../proto/othercom/external_child_message_pb"; + +export class ParentMessageV3 extends jspb.Message { + hasInternalChildMessage(): boolean; + clearInternalChildMessage(): void; + getInternalChildMessage(): ParentMessageV3.InternalChildMessage | undefined; + setInternalChildMessage(value?: ParentMessageV3.InternalChildMessage): void; + + hasOptInternalChildMessage(): boolean; + clearOptInternalChildMessage(): void; + getOptInternalChildMessage(): ParentMessageV3.InternalChildMessage | undefined; + setOptInternalChildMessage(value?: ParentMessageV3.InternalChildMessage): void; + + clearInternalChildrenList(): void; + getInternalChildrenList(): Array; + setInternalChildrenList(value: Array): void; + addInternalChildren(value?: ParentMessageV3.InternalChildMessage, index?: number): ParentMessageV3.InternalChildMessage; + + hasExternalChildMessage(): boolean; + clearExternalChildMessage(): void; + getExternalChildMessage(): proto_othercom_external_child_message_pb.ExternalChildMessage | undefined; + setExternalChildMessage(value?: proto_othercom_external_child_message_pb.ExternalChildMessage): void; + + hasOptExternalChildMessage(): boolean; + clearOptExternalChildMessage(): void; + getOptExternalChildMessage(): proto_othercom_external_child_message_pb.ExternalChildMessage | undefined; + setOptExternalChildMessage(value?: proto_othercom_external_child_message_pb.ExternalChildMessage): void; + + clearExternalChildrenList(): void; + getExternalChildrenList(): Array; + setExternalChildrenList(value: Array): void; + addExternalChildren(value?: proto_othercom_external_child_message_pb.ExternalChildMessage, index?: number): proto_othercom_external_child_message_pb.ExternalChildMessage; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ParentMessageV3.AsObject; + static toObject(includeInstance: boolean, msg: ParentMessageV3): ParentMessageV3.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ParentMessageV3, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ParentMessageV3; + static deserializeBinaryFromReader(message: ParentMessageV3, reader: jspb.BinaryReader): ParentMessageV3; +} + +export namespace ParentMessageV3 { + export type AsObject = { + internalChildMessage?: ParentMessageV3.InternalChildMessage.AsObject, + optInternalChildMessage?: ParentMessageV3.InternalChildMessage.AsObject, + internalChildrenList: Array, + externalChildMessage?: proto_othercom_external_child_message_pb.ExternalChildMessage.AsObject, + optExternalChildMessage?: proto_othercom_external_child_message_pb.ExternalChildMessage.AsObject, + externalChildrenList: Array, + } + + export class InternalChildMessage extends jspb.Message { + getMyString(): string; + setMyString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): InternalChildMessage.AsObject; + static toObject(includeInstance: boolean, msg: InternalChildMessage): InternalChildMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: InternalChildMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): InternalChildMessage; + static deserializeBinaryFromReader(message: InternalChildMessage, reader: jspb.BinaryReader): InternalChildMessage; + } + + export namespace InternalChildMessage { + export type AsObject = { + myString: string, + } + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb.js b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb.js new file mode 100644 index 0000000..463b964 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb.js @@ -0,0 +1,611 @@ +// source: proto/examplecom/parent_message_v3.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var proto_othercom_external_child_message_pb = require('../../proto/othercom/external_child_message_pb.js'); +goog.object.extend(proto, proto_othercom_external_child_message_pb); +goog.exportSymbol('proto.examplecom.ParentMessageV3', null, global); +goog.exportSymbol('proto.examplecom.ParentMessageV3.InternalChildMessage', 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.examplecom.ParentMessageV3 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.examplecom.ParentMessageV3.repeatedFields_, null); +}; +goog.inherits(proto.examplecom.ParentMessageV3, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.ParentMessageV3.displayName = 'proto.examplecom.ParentMessageV3'; +} +/** + * 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.examplecom.ParentMessageV3.InternalChildMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.ParentMessageV3.InternalChildMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.ParentMessageV3.InternalChildMessage.displayName = 'proto.examplecom.ParentMessageV3.InternalChildMessage'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.examplecom.ParentMessageV3.repeatedFields_ = [3,6]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.ParentMessageV3.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.ParentMessageV3.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.ParentMessageV3} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV3.toObject = function(includeInstance, msg) { + var f, obj = { + internalChildMessage: (f = msg.getInternalChildMessage()) && proto.examplecom.ParentMessageV3.InternalChildMessage.toObject(includeInstance, f), + optInternalChildMessage: (f = msg.getOptInternalChildMessage()) && proto.examplecom.ParentMessageV3.InternalChildMessage.toObject(includeInstance, f), + internalChildrenList: jspb.Message.toObjectList(msg.getInternalChildrenList(), + proto.examplecom.ParentMessageV3.InternalChildMessage.toObject, includeInstance), + externalChildMessage: (f = msg.getExternalChildMessage()) && proto_othercom_external_child_message_pb.ExternalChildMessage.toObject(includeInstance, f), + optExternalChildMessage: (f = msg.getOptExternalChildMessage()) && proto_othercom_external_child_message_pb.ExternalChildMessage.toObject(includeInstance, f), + externalChildrenList: jspb.Message.toObjectList(msg.getExternalChildrenList(), + proto_othercom_external_child_message_pb.ExternalChildMessage.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.examplecom.ParentMessageV3} + */ +proto.examplecom.ParentMessageV3.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.ParentMessageV3; + return proto.examplecom.ParentMessageV3.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.ParentMessageV3} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.ParentMessageV3} + */ +proto.examplecom.ParentMessageV3.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.examplecom.ParentMessageV3.InternalChildMessage; + reader.readMessage(value,proto.examplecom.ParentMessageV3.InternalChildMessage.deserializeBinaryFromReader); + msg.setInternalChildMessage(value); + break; + case 2: + var value = new proto.examplecom.ParentMessageV3.InternalChildMessage; + reader.readMessage(value,proto.examplecom.ParentMessageV3.InternalChildMessage.deserializeBinaryFromReader); + msg.setOptInternalChildMessage(value); + break; + case 3: + var value = new proto.examplecom.ParentMessageV3.InternalChildMessage; + reader.readMessage(value,proto.examplecom.ParentMessageV3.InternalChildMessage.deserializeBinaryFromReader); + msg.addInternalChildren(value); + break; + case 4: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.setExternalChildMessage(value); + break; + case 5: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.setOptExternalChildMessage(value); + break; + case 6: + var value = new proto_othercom_external_child_message_pb.ExternalChildMessage; + reader.readMessage(value,proto_othercom_external_child_message_pb.ExternalChildMessage.deserializeBinaryFromReader); + msg.addExternalChildren(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.ParentMessageV3.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.ParentMessageV3.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.ParentMessageV3} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV3.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInternalChildMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.examplecom.ParentMessageV3.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getOptInternalChildMessage(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.examplecom.ParentMessageV3.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getInternalChildrenList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.examplecom.ParentMessageV3.InternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getExternalChildMessage(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getOptExternalChildMessage(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } + f = message.getExternalChildrenList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 6, + f, + proto_othercom_external_child_message_pb.ExternalChildMessage.serializeBinaryToWriter + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.ParentMessageV3.InternalChildMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.ParentMessageV3.InternalChildMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myString: 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.examplecom.ParentMessageV3.InternalChildMessage} + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.ParentMessageV3.InternalChildMessage; + return proto.examplecom.ParentMessageV3.InternalChildMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.ParentMessageV3.InternalChildMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.ParentMessageV3.InternalChildMessage} + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.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.setMyString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.ParentMessageV3.InternalChildMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.ParentMessageV3.InternalChildMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string my_string = 1; + * @return {string} + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ParentMessageV3.InternalChildMessage} returns this + */ +proto.examplecom.ParentMessageV3.InternalChildMessage.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional InternalChildMessage internal_child_message = 1; + * @return {?proto.examplecom.ParentMessageV3.InternalChildMessage} + */ +proto.examplecom.ParentMessageV3.prototype.getInternalChildMessage = function() { + return /** @type{?proto.examplecom.ParentMessageV3.InternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto.examplecom.ParentMessageV3.InternalChildMessage, 1)); +}; + + +/** + * @param {?proto.examplecom.ParentMessageV3.InternalChildMessage|undefined} value + * @return {!proto.examplecom.ParentMessageV3} returns this +*/ +proto.examplecom.ParentMessageV3.prototype.setInternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.ParentMessageV3} returns this + */ +proto.examplecom.ParentMessageV3.prototype.clearInternalChildMessage = function() { + return this.setInternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV3.prototype.hasInternalChildMessage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional InternalChildMessage opt_internal_child_message = 2; + * @return {?proto.examplecom.ParentMessageV3.InternalChildMessage} + */ +proto.examplecom.ParentMessageV3.prototype.getOptInternalChildMessage = function() { + return /** @type{?proto.examplecom.ParentMessageV3.InternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto.examplecom.ParentMessageV3.InternalChildMessage, 2)); +}; + + +/** + * @param {?proto.examplecom.ParentMessageV3.InternalChildMessage|undefined} value + * @return {!proto.examplecom.ParentMessageV3} returns this +*/ +proto.examplecom.ParentMessageV3.prototype.setOptInternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.ParentMessageV3} returns this + */ +proto.examplecom.ParentMessageV3.prototype.clearOptInternalChildMessage = function() { + return this.setOptInternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV3.prototype.hasOptInternalChildMessage = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated InternalChildMessage internal_children = 3; + * @return {!Array} + */ +proto.examplecom.ParentMessageV3.prototype.getInternalChildrenList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.examplecom.ParentMessageV3.InternalChildMessage, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.ParentMessageV3} returns this +*/ +proto.examplecom.ParentMessageV3.prototype.setInternalChildrenList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.examplecom.ParentMessageV3.InternalChildMessage=} opt_value + * @param {number=} opt_index + * @return {!proto.examplecom.ParentMessageV3.InternalChildMessage} + */ +proto.examplecom.ParentMessageV3.prototype.addInternalChildren = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.examplecom.ParentMessageV3.InternalChildMessage, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.ParentMessageV3} returns this + */ +proto.examplecom.ParentMessageV3.prototype.clearInternalChildrenList = function() { + return this.setInternalChildrenList([]); +}; + + +/** + * optional othercom.ExternalChildMessage external_child_message = 4; + * @return {?proto.othercom.ExternalChildMessage} + */ +proto.examplecom.ParentMessageV3.prototype.getExternalChildMessage = function() { + return /** @type{?proto.othercom.ExternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 4)); +}; + + +/** + * @param {?proto.othercom.ExternalChildMessage|undefined} value + * @return {!proto.examplecom.ParentMessageV3} returns this +*/ +proto.examplecom.ParentMessageV3.prototype.setExternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.ParentMessageV3} returns this + */ +proto.examplecom.ParentMessageV3.prototype.clearExternalChildMessage = function() { + return this.setExternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV3.prototype.hasExternalChildMessage = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional othercom.ExternalChildMessage opt_external_child_message = 5; + * @return {?proto.othercom.ExternalChildMessage} + */ +proto.examplecom.ParentMessageV3.prototype.getOptExternalChildMessage = function() { + return /** @type{?proto.othercom.ExternalChildMessage} */ ( + jspb.Message.getWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 5)); +}; + + +/** + * @param {?proto.othercom.ExternalChildMessage|undefined} value + * @return {!proto.examplecom.ParentMessageV3} returns this +*/ +proto.examplecom.ParentMessageV3.prototype.setOptExternalChildMessage = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.ParentMessageV3} returns this + */ +proto.examplecom.ParentMessageV3.prototype.clearOptExternalChildMessage = function() { + return this.setOptExternalChildMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.ParentMessageV3.prototype.hasOptExternalChildMessage = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * repeated othercom.ExternalChildMessage external_children = 6; + * @return {!Array} + */ +proto.examplecom.ParentMessageV3.prototype.getExternalChildrenList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto_othercom_external_child_message_pb.ExternalChildMessage, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.ParentMessageV3} returns this +*/ +proto.examplecom.ParentMessageV3.prototype.setExternalChildrenList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 6, value); +}; + + +/** + * @param {!proto.othercom.ExternalChildMessage=} opt_value + * @param {number=} opt_index + * @return {!proto.othercom.ExternalChildMessage} + */ +proto.examplecom.ParentMessageV3.prototype.addExternalChildren = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.othercom.ExternalChildMessage, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.ParentMessageV3} returns this + */ +proto.examplecom.ParentMessageV3.prototype.clearExternalChildrenList = function() { + return this.setExternalChildrenList([]); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb_service.d.ts new file mode 100644 index 0000000..419294c --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/parent_message_v3.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb_service.js b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb_service.js new file mode 100644 index 0000000..419294c --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/parent_message_v3_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/parent_message_v3.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb.d.ts new file mode 100644 index 0000000..8cd1dfe --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb.d.ts @@ -0,0 +1,211 @@ +// package: examplecom +// file: proto/examplecom/primitive_message_v2.proto + +import * as jspb from "google-protobuf"; + +export class PrimitiveMessageV2 extends jspb.Message { + hasMyDouble(): boolean; + clearMyDouble(): void; + getMyDouble(): number | undefined; + setMyDouble(value: number): void; + + hasMyFloat(): boolean; + clearMyFloat(): void; + getMyFloat(): number | undefined; + setMyFloat(value: number): void; + + hasMyInt32(): boolean; + clearMyInt32(): void; + getMyInt32(): number | undefined; + setMyInt32(value: number): void; + + hasMyInt64(): boolean; + clearMyInt64(): void; + getMyInt64(): number | undefined; + setMyInt64(value: number): void; + + hasMyUint32(): boolean; + clearMyUint32(): void; + getMyUint32(): number | undefined; + setMyUint32(value: number): void; + + hasMyUint64(): boolean; + clearMyUint64(): void; + getMyUint64(): number | undefined; + setMyUint64(value: number): void; + + hasMySint32(): boolean; + clearMySint32(): void; + getMySint32(): number | undefined; + setMySint32(value: number): void; + + hasMySint64(): boolean; + clearMySint64(): void; + getMySint64(): number | undefined; + setMySint64(value: number): void; + + hasMyFixed32(): boolean; + clearMyFixed32(): void; + getMyFixed32(): number | undefined; + setMyFixed32(value: number): void; + + hasMyFixed64(): boolean; + clearMyFixed64(): void; + getMyFixed64(): number | undefined; + setMyFixed64(value: number): void; + + hasMySfixed32(): boolean; + clearMySfixed32(): void; + getMySfixed32(): number | undefined; + setMySfixed32(value: number): void; + + hasMySfixed64(): boolean; + clearMySfixed64(): void; + getMySfixed64(): number | undefined; + setMySfixed64(value: number): void; + + hasMyBool(): boolean; + clearMyBool(): void; + getMyBool(): boolean | undefined; + setMyBool(value: boolean): void; + + hasMyString(): boolean; + clearMyString(): void; + getMyString(): string | undefined; + setMyString(value: string): void; + + hasMyBytes(): boolean; + clearMyBytes(): void; + getMyBytes(): Uint8Array | string; + getMyBytes_asU8(): Uint8Array; + getMyBytes_asB64(): string; + setMyBytes(value: Uint8Array | string): void; + + hasOptDouble(): boolean; + clearOptDouble(): void; + getOptDouble(): number | undefined; + setOptDouble(value: number): void; + + hasOptFloat(): boolean; + clearOptFloat(): void; + getOptFloat(): number | undefined; + setOptFloat(value: number): void; + + hasOptInt32(): boolean; + clearOptInt32(): void; + getOptInt32(): number | undefined; + setOptInt32(value: number): void; + + hasOptInt64(): boolean; + clearOptInt64(): void; + getOptInt64(): number | undefined; + setOptInt64(value: number): void; + + hasOptUint32(): boolean; + clearOptUint32(): void; + getOptUint32(): number | undefined; + setOptUint32(value: number): void; + + hasOptUint64(): boolean; + clearOptUint64(): void; + getOptUint64(): number | undefined; + setOptUint64(value: number): void; + + hasOptSint32(): boolean; + clearOptSint32(): void; + getOptSint32(): number | undefined; + setOptSint32(value: number): void; + + hasOptSint64(): boolean; + clearOptSint64(): void; + getOptSint64(): number | undefined; + setOptSint64(value: number): void; + + hasOptFixed32(): boolean; + clearOptFixed32(): void; + getOptFixed32(): number | undefined; + setOptFixed32(value: number): void; + + hasOptFixed64(): boolean; + clearOptFixed64(): void; + getOptFixed64(): number | undefined; + setOptFixed64(value: number): void; + + hasOptSfixed32(): boolean; + clearOptSfixed32(): void; + getOptSfixed32(): number | undefined; + setOptSfixed32(value: number): void; + + hasOptSfixed64(): boolean; + clearOptSfixed64(): void; + getOptSfixed64(): number | undefined; + setOptSfixed64(value: number): void; + + hasOptBool(): boolean; + clearOptBool(): void; + getOptBool(): boolean | undefined; + setOptBool(value: boolean): void; + + hasOptString(): boolean; + clearOptString(): void; + getOptString(): string | undefined; + setOptString(value: string): void; + + hasOptBytes(): boolean; + clearOptBytes(): void; + getOptBytes(): Uint8Array | string; + getOptBytes_asU8(): Uint8Array; + getOptBytes_asB64(): string; + setOptBytes(value: Uint8Array | string): void; + + hasOptNumber(): boolean; + clearOptNumber(): void; + getOptNumber(): number | undefined; + setOptNumber(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PrimitiveMessageV2.AsObject; + static toObject(includeInstance: boolean, msg: PrimitiveMessageV2): PrimitiveMessageV2.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PrimitiveMessageV2, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PrimitiveMessageV2; + static deserializeBinaryFromReader(message: PrimitiveMessageV2, reader: jspb.BinaryReader): PrimitiveMessageV2; +} + +export namespace PrimitiveMessageV2 { + export type AsObject = { + myDouble?: number, + myFloat?: number, + myInt32?: number, + myInt64?: number, + myUint32?: number, + myUint64?: number, + mySint32?: number, + mySint64?: number, + myFixed32?: number, + myFixed64?: number, + mySfixed32?: number, + mySfixed64?: number, + myBool?: boolean, + myString?: string, + myBytes: Uint8Array | string, + optDouble?: number, + optFloat?: number, + optInt32?: number, + optInt64?: number, + optUint32?: number, + optUint64?: number, + optSint32?: number, + optSint64?: number, + optFixed32?: number, + optFixed64?: number, + optSfixed32?: number, + optSfixed64?: number, + optBool?: boolean, + optString?: string, + optBytes: Uint8Array | string, + optNumber?: number, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb.js b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb.js new file mode 100644 index 0000000..6f4fa34 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb.js @@ -0,0 +1,1676 @@ +// source: proto/examplecom/primitive_message_v2.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.PrimitiveMessageV2', 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.examplecom.PrimitiveMessageV2 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.PrimitiveMessageV2, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.PrimitiveMessageV2.displayName = 'proto.examplecom.PrimitiveMessageV2'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.PrimitiveMessageV2.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.PrimitiveMessageV2.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.PrimitiveMessageV2} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.PrimitiveMessageV2.toObject = function(includeInstance, msg) { + var f, obj = { + myDouble: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, + myFloat: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, + myInt32: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, + myInt64: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, + myUint32: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, + myUint64: (f = jspb.Message.getField(msg, 6)) == null ? undefined : f, + mySint32: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, + mySint64: (f = jspb.Message.getField(msg, 8)) == null ? undefined : f, + myFixed32: (f = jspb.Message.getField(msg, 9)) == null ? undefined : f, + myFixed64: (f = jspb.Message.getField(msg, 10)) == null ? undefined : f, + mySfixed32: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, + mySfixed64: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f, + myBool: (f = jspb.Message.getBooleanField(msg, 13)) == null ? undefined : f, + myString: (f = jspb.Message.getField(msg, 14)) == null ? undefined : f, + myBytes: msg.getMyBytes_asB64(), + optDouble: (f = jspb.Message.getOptionalFloatingPointField(msg, 16)) == null ? undefined : f, + optFloat: (f = jspb.Message.getOptionalFloatingPointField(msg, 17)) == null ? undefined : f, + optInt32: (f = jspb.Message.getField(msg, 18)) == null ? undefined : f, + optInt64: (f = jspb.Message.getField(msg, 19)) == null ? undefined : f, + optUint32: (f = jspb.Message.getField(msg, 20)) == null ? undefined : f, + optUint64: (f = jspb.Message.getField(msg, 21)) == null ? undefined : f, + optSint32: (f = jspb.Message.getField(msg, 22)) == null ? undefined : f, + optSint64: (f = jspb.Message.getField(msg, 23)) == null ? undefined : f, + optFixed32: (f = jspb.Message.getField(msg, 24)) == null ? undefined : f, + optFixed64: (f = jspb.Message.getField(msg, 25)) == null ? undefined : f, + optSfixed32: (f = jspb.Message.getField(msg, 26)) == null ? undefined : f, + optSfixed64: (f = jspb.Message.getField(msg, 27)) == null ? undefined : f, + optBool: (f = jspb.Message.getBooleanField(msg, 28)) == null ? undefined : f, + optString: (f = jspb.Message.getField(msg, 29)) == null ? undefined : f, + optBytes: msg.getOptBytes_asB64(), + optNumber: (f = jspb.Message.getField(msg, 31)) == null ? undefined : 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.examplecom.PrimitiveMessageV2} + */ +proto.examplecom.PrimitiveMessageV2.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.PrimitiveMessageV2; + return proto.examplecom.PrimitiveMessageV2.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.PrimitiveMessageV2} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.PrimitiveMessageV2} + */ +proto.examplecom.PrimitiveMessageV2.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readDouble()); + msg.setMyDouble(value); + break; + case 2: + var value = /** @type {number} */ (reader.readFloat()); + msg.setMyFloat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMyInt32(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMyInt64(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setMyUint32(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint64()); + msg.setMyUint64(value); + break; + case 7: + var value = /** @type {number} */ (reader.readSint32()); + msg.setMySint32(value); + break; + case 8: + var value = /** @type {number} */ (reader.readSint64()); + msg.setMySint64(value); + break; + case 9: + var value = /** @type {number} */ (reader.readFixed32()); + msg.setMyFixed32(value); + break; + case 10: + var value = /** @type {number} */ (reader.readFixed64()); + msg.setMyFixed64(value); + break; + case 11: + var value = /** @type {number} */ (reader.readSfixed32()); + msg.setMySfixed32(value); + break; + case 12: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setMySfixed64(value); + break; + case 13: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMyBool(value); + break; + case 14: + var value = /** @type {string} */ (reader.readString()); + msg.setMyString(value); + break; + case 15: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMyBytes(value); + break; + case 16: + var value = /** @type {number} */ (reader.readDouble()); + msg.setOptDouble(value); + break; + case 17: + var value = /** @type {number} */ (reader.readFloat()); + msg.setOptFloat(value); + break; + case 18: + var value = /** @type {number} */ (reader.readInt32()); + msg.setOptInt32(value); + break; + case 19: + var value = /** @type {number} */ (reader.readInt64()); + msg.setOptInt64(value); + break; + case 20: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOptUint32(value); + break; + case 21: + var value = /** @type {number} */ (reader.readUint64()); + msg.setOptUint64(value); + break; + case 22: + var value = /** @type {number} */ (reader.readSint32()); + msg.setOptSint32(value); + break; + case 23: + var value = /** @type {number} */ (reader.readSint64()); + msg.setOptSint64(value); + break; + case 24: + var value = /** @type {number} */ (reader.readFixed32()); + msg.setOptFixed32(value); + break; + case 25: + var value = /** @type {number} */ (reader.readFixed64()); + msg.setOptFixed64(value); + break; + case 26: + var value = /** @type {number} */ (reader.readSfixed32()); + msg.setOptSfixed32(value); + break; + case 27: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setOptSfixed64(value); + break; + case 28: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOptBool(value); + break; + case 29: + var value = /** @type {string} */ (reader.readString()); + msg.setOptString(value); + break; + case 30: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOptBytes(value); + break; + case 31: + var value = /** @type {number} */ (reader.readInt32()); + msg.setOptNumber(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.PrimitiveMessageV2.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.PrimitiveMessageV2.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.PrimitiveMessageV2} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.PrimitiveMessageV2.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeDouble( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeFloat( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt32( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeInt64( + 4, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeUint32( + 5, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeUint64( + 6, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeSint32( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeSint64( + 8, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeFixed32( + 9, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeFixed64( + 10, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeSfixed32( + 11, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 12)); + if (f != null) { + writer.writeSfixed64( + 12, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 13)); + if (f != null) { + writer.writeBool( + 13, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 14)); + if (f != null) { + writer.writeString( + 14, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 15)); + if (f != null) { + writer.writeBytes( + 15, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 16)); + if (f != null) { + writer.writeDouble( + 16, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 17)); + if (f != null) { + writer.writeFloat( + 17, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 18)); + if (f != null) { + writer.writeInt32( + 18, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 19)); + if (f != null) { + writer.writeInt64( + 19, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 20)); + if (f != null) { + writer.writeUint32( + 20, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 21)); + if (f != null) { + writer.writeUint64( + 21, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 22)); + if (f != null) { + writer.writeSint32( + 22, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 23)); + if (f != null) { + writer.writeSint64( + 23, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 24)); + if (f != null) { + writer.writeFixed32( + 24, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 25)); + if (f != null) { + writer.writeFixed64( + 25, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 26)); + if (f != null) { + writer.writeSfixed32( + 26, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 27)); + if (f != null) { + writer.writeSfixed64( + 27, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 28)); + if (f != null) { + writer.writeBool( + 28, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 29)); + if (f != null) { + writer.writeString( + 29, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 30)); + if (f != null) { + writer.writeBytes( + 30, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 31)); + if (f != null) { + writer.writeInt32( + 31, + f + ); + } +}; + + +/** + * required double my_double = 1; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyDouble = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyDouble = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyDouble = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyDouble = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required float my_float = 2; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyFloat = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyFloat = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyFloat = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyFloat = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required int32 my_int32 = 3; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyInt32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyInt32 = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyInt32 = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyInt32 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * required int64 my_int64 = 4; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyInt64 = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyInt64 = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyInt64 = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * required uint32 my_uint32 = 5; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyUint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyUint32 = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyUint32 = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyUint32 = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * required uint64 my_uint64 = 6; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyUint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyUint64 = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyUint64 = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyUint64 = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * required sint32 my_sint32 = 7; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMySint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMySint32 = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMySint32 = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMySint32 = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * required sint64 my_sint64 = 8; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMySint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMySint64 = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMySint64 = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMySint64 = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * required fixed32 my_fixed32 = 9; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyFixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyFixed32 = function(value) { + return jspb.Message.setField(this, 9, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyFixed32 = function() { + return jspb.Message.setField(this, 9, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyFixed32 = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * required fixed64 my_fixed64 = 10; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyFixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyFixed64 = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyFixed64 = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyFixed64 = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * required sfixed32 my_sfixed32 = 11; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMySfixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMySfixed32 = function(value) { + return jspb.Message.setField(this, 11, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMySfixed32 = function() { + return jspb.Message.setField(this, 11, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMySfixed32 = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * required sfixed64 my_sfixed64 = 12; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMySfixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMySfixed64 = function(value) { + return jspb.Message.setField(this, 12, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMySfixed64 = function() { + return jspb.Message.setField(this, 12, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMySfixed64 = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * required bool my_bool = 13; + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 13, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyBool = function(value) { + return jspb.Message.setField(this, 13, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyBool = function() { + return jspb.Message.setField(this, 13, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyBool = function() { + return jspb.Message.getField(this, 13) != null; +}; + + +/** + * required string my_string = 14; + * @return {string} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyString = function(value) { + return jspb.Message.setField(this, 14, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyString = function() { + return jspb.Message.setField(this, 14, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyString = function() { + return jspb.Message.getField(this, 14) != null; +}; + + +/** + * required bytes my_bytes = 15; + * @return {!(string|Uint8Array)} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +}; + + +/** + * required bytes my_bytes = 15; + * This is a type-conversion wrapper around `getMyBytes()` + * @return {string} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMyBytes())); +}; + + +/** + * required bytes my_bytes = 15; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMyBytes()` + * @return {!Uint8Array} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getMyBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMyBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setMyBytes = function(value) { + return jspb.Message.setField(this, 15, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearMyBytes = function() { + return jspb.Message.setField(this, 15, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasMyBytes = function() { + return jspb.Message.getField(this, 15) != null; +}; + + +/** + * optional double opt_double = 16; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptDouble = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 16, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptDouble = function(value) { + return jspb.Message.setField(this, 16, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptDouble = function() { + return jspb.Message.setField(this, 16, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptDouble = function() { + return jspb.Message.getField(this, 16) != null; +}; + + +/** + * optional float opt_float = 17; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptFloat = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 17, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptFloat = function(value) { + return jspb.Message.setField(this, 17, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptFloat = function() { + return jspb.Message.setField(this, 17, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptFloat = function() { + return jspb.Message.getField(this, 17) != null; +}; + + +/** + * optional int32 opt_int32 = 18; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptInt32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 18, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptInt32 = function(value) { + return jspb.Message.setField(this, 18, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptInt32 = function() { + return jspb.Message.setField(this, 18, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptInt32 = function() { + return jspb.Message.getField(this, 18) != null; +}; + + +/** + * optional int64 opt_int64 = 19; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 19, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptInt64 = function(value) { + return jspb.Message.setField(this, 19, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptInt64 = function() { + return jspb.Message.setField(this, 19, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptInt64 = function() { + return jspb.Message.getField(this, 19) != null; +}; + + +/** + * optional uint32 opt_uint32 = 20; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptUint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 20, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptUint32 = function(value) { + return jspb.Message.setField(this, 20, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptUint32 = function() { + return jspb.Message.setField(this, 20, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptUint32 = function() { + return jspb.Message.getField(this, 20) != null; +}; + + +/** + * optional uint64 opt_uint64 = 21; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptUint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 21, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptUint64 = function(value) { + return jspb.Message.setField(this, 21, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptUint64 = function() { + return jspb.Message.setField(this, 21, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptUint64 = function() { + return jspb.Message.getField(this, 21) != null; +}; + + +/** + * optional sint32 opt_sint32 = 22; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptSint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 22, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptSint32 = function(value) { + return jspb.Message.setField(this, 22, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptSint32 = function() { + return jspb.Message.setField(this, 22, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptSint32 = function() { + return jspb.Message.getField(this, 22) != null; +}; + + +/** + * optional sint64 opt_sint64 = 23; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptSint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 23, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptSint64 = function(value) { + return jspb.Message.setField(this, 23, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptSint64 = function() { + return jspb.Message.setField(this, 23, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptSint64 = function() { + return jspb.Message.getField(this, 23) != null; +}; + + +/** + * optional fixed32 opt_fixed32 = 24; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptFixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 24, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptFixed32 = function(value) { + return jspb.Message.setField(this, 24, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptFixed32 = function() { + return jspb.Message.setField(this, 24, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptFixed32 = function() { + return jspb.Message.getField(this, 24) != null; +}; + + +/** + * optional fixed64 opt_fixed64 = 25; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptFixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 25, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptFixed64 = function(value) { + return jspb.Message.setField(this, 25, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptFixed64 = function() { + return jspb.Message.setField(this, 25, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptFixed64 = function() { + return jspb.Message.getField(this, 25) != null; +}; + + +/** + * optional sfixed32 opt_sfixed32 = 26; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptSfixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 26, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptSfixed32 = function(value) { + return jspb.Message.setField(this, 26, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptSfixed32 = function() { + return jspb.Message.setField(this, 26, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptSfixed32 = function() { + return jspb.Message.getField(this, 26) != null; +}; + + +/** + * optional sfixed64 opt_sfixed64 = 27; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptSfixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 27, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptSfixed64 = function(value) { + return jspb.Message.setField(this, 27, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptSfixed64 = function() { + return jspb.Message.setField(this, 27, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptSfixed64 = function() { + return jspb.Message.getField(this, 27) != null; +}; + + +/** + * optional bool opt_bool = 28; + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 28, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptBool = function(value) { + return jspb.Message.setField(this, 28, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptBool = function() { + return jspb.Message.setField(this, 28, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptBool = function() { + return jspb.Message.getField(this, 28) != null; +}; + + +/** + * optional string opt_string = 29; + * @return {string} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 29, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptString = function(value) { + return jspb.Message.setField(this, 29, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptString = function() { + return jspb.Message.setField(this, 29, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptString = function() { + return jspb.Message.getField(this, 29) != null; +}; + + +/** + * optional bytes opt_bytes = 30; + * @return {!(string|Uint8Array)} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 30, "")); +}; + + +/** + * optional bytes opt_bytes = 30; + * This is a type-conversion wrapper around `getOptBytes()` + * @return {string} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOptBytes())); +}; + + +/** + * optional bytes opt_bytes = 30; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOptBytes()` + * @return {!Uint8Array} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOptBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptBytes = function(value) { + return jspb.Message.setField(this, 30, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptBytes = function() { + return jspb.Message.setField(this, 30, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptBytes = function() { + return jspb.Message.getField(this, 30) != null; +}; + + +/** + * optional int32 opt_NUMBER = 31; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV2.prototype.getOptNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 31, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.setOptNumber = function(value) { + return jspb.Message.setField(this, 31, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV2} returns this + */ +proto.examplecom.PrimitiveMessageV2.prototype.clearOptNumber = function() { + return jspb.Message.setField(this, 31, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV2.prototype.hasOptNumber = function() { + return jspb.Message.getField(this, 31) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb_service.d.ts new file mode 100644 index 0000000..cd56593 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/primitive_message_v2.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb_service.js b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb_service.js new file mode 100644 index 0000000..cd56593 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v2_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/primitive_message_v2.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb.d.ts new file mode 100644 index 0000000..ae506c7 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb.d.ts @@ -0,0 +1,185 @@ +// package: examplecom +// file: proto/examplecom/primitive_message_v3.proto + +import * as jspb from "google-protobuf"; + +export class PrimitiveMessageV3 extends jspb.Message { + getMyDouble(): number; + setMyDouble(value: number): void; + + getMyFloat(): number; + setMyFloat(value: number): void; + + getMyInt32(): number; + setMyInt32(value: number): void; + + getMyInt64(): number; + setMyInt64(value: number): void; + + getMyUint32(): number; + setMyUint32(value: number): void; + + getMyUint64(): number; + setMyUint64(value: number): void; + + getMySint32(): number; + setMySint32(value: number): void; + + getMySint64(): number; + setMySint64(value: number): void; + + getMyFixed32(): number; + setMyFixed32(value: number): void; + + getMyFixed64(): number; + setMyFixed64(value: number): void; + + getMySfixed32(): number; + setMySfixed32(value: number): void; + + getMySfixed64(): number; + setMySfixed64(value: number): void; + + getMyBool(): boolean; + setMyBool(value: boolean): void; + + getMyString(): string; + setMyString(value: string): void; + + getMyBytes(): Uint8Array | string; + getMyBytes_asU8(): Uint8Array; + getMyBytes_asB64(): string; + setMyBytes(value: Uint8Array | string): void; + + getMyNumber(): number; + setMyNumber(value: number): void; + + hasOptDouble(): boolean; + clearOptDouble(): void; + getOptDouble(): number; + setOptDouble(value: number): void; + + hasOptFloat(): boolean; + clearOptFloat(): void; + getOptFloat(): number; + setOptFloat(value: number): void; + + hasOptInt32(): boolean; + clearOptInt32(): void; + getOptInt32(): number; + setOptInt32(value: number): void; + + hasOptInt64(): boolean; + clearOptInt64(): void; + getOptInt64(): number; + setOptInt64(value: number): void; + + hasOptUint32(): boolean; + clearOptUint32(): void; + getOptUint32(): number; + setOptUint32(value: number): void; + + hasOptUint64(): boolean; + clearOptUint64(): void; + getOptUint64(): number; + setOptUint64(value: number): void; + + hasOptSint32(): boolean; + clearOptSint32(): void; + getOptSint32(): number; + setOptSint32(value: number): void; + + hasOptSint64(): boolean; + clearOptSint64(): void; + getOptSint64(): number; + setOptSint64(value: number): void; + + hasOptFixed32(): boolean; + clearOptFixed32(): void; + getOptFixed32(): number; + setOptFixed32(value: number): void; + + hasOptFixed64(): boolean; + clearOptFixed64(): void; + getOptFixed64(): number; + setOptFixed64(value: number): void; + + hasOptSfixed32(): boolean; + clearOptSfixed32(): void; + getOptSfixed32(): number; + setOptSfixed32(value: number): void; + + hasOptSfixed64(): boolean; + clearOptSfixed64(): void; + getOptSfixed64(): number; + setOptSfixed64(value: number): void; + + hasOptBool(): boolean; + clearOptBool(): void; + getOptBool(): boolean; + setOptBool(value: boolean): void; + + hasOptString(): boolean; + clearOptString(): void; + getOptString(): string; + setOptString(value: string): void; + + hasOptBytes(): boolean; + clearOptBytes(): void; + getOptBytes(): Uint8Array | string; + getOptBytes_asU8(): Uint8Array; + getOptBytes_asB64(): string; + setOptBytes(value: Uint8Array | string): void; + + hasOptNumber(): boolean; + clearOptNumber(): void; + getOptNumber(): number; + setOptNumber(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PrimitiveMessageV3.AsObject; + static toObject(includeInstance: boolean, msg: PrimitiveMessageV3): PrimitiveMessageV3.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: PrimitiveMessageV3, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PrimitiveMessageV3; + static deserializeBinaryFromReader(message: PrimitiveMessageV3, reader: jspb.BinaryReader): PrimitiveMessageV3; +} + +export namespace PrimitiveMessageV3 { + export type AsObject = { + myDouble: number, + myFloat: number, + myInt32: number, + myInt64: number, + myUint32: number, + myUint64: number, + mySint32: number, + mySint64: number, + myFixed32: number, + myFixed64: number, + mySfixed32: number, + mySfixed64: number, + myBool: boolean, + myString: string, + myBytes: Uint8Array | string, + myNumber: number, + optDouble: number, + optFloat: number, + optInt32: number, + optInt64: number, + optUint32: number, + optUint64: number, + optSint32: number, + optSint64: number, + optFixed32: number, + optFixed64: number, + optSfixed32: number, + optSfixed64: number, + optBool: boolean, + optString: string, + optBytes: Uint8Array | string, + optNumber: number, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb.js b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb.js new file mode 100644 index 0000000..ec0e8d1 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb.js @@ -0,0 +1,1436 @@ +// source: proto/examplecom/primitive_message_v3.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.PrimitiveMessageV3', 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.examplecom.PrimitiveMessageV3 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.PrimitiveMessageV3, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.PrimitiveMessageV3.displayName = 'proto.examplecom.PrimitiveMessageV3'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.PrimitiveMessageV3.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.PrimitiveMessageV3.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.PrimitiveMessageV3} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.PrimitiveMessageV3.toObject = function(includeInstance, msg) { + var f, obj = { + myDouble: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0), + myFloat: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0), + myInt32: jspb.Message.getFieldWithDefault(msg, 3, 0), + myInt64: jspb.Message.getFieldWithDefault(msg, 4, 0), + myUint32: jspb.Message.getFieldWithDefault(msg, 5, 0), + myUint64: jspb.Message.getFieldWithDefault(msg, 6, 0), + mySint32: jspb.Message.getFieldWithDefault(msg, 7, 0), + mySint64: jspb.Message.getFieldWithDefault(msg, 8, 0), + myFixed32: jspb.Message.getFieldWithDefault(msg, 9, 0), + myFixed64: jspb.Message.getFieldWithDefault(msg, 10, 0), + mySfixed32: jspb.Message.getFieldWithDefault(msg, 11, 0), + mySfixed64: jspb.Message.getFieldWithDefault(msg, 12, 0), + myBool: jspb.Message.getBooleanFieldWithDefault(msg, 13, false), + myString: jspb.Message.getFieldWithDefault(msg, 14, ""), + myBytes: msg.getMyBytes_asB64(), + myNumber: jspb.Message.getFieldWithDefault(msg, 16, 0), + optDouble: jspb.Message.getFloatingPointFieldWithDefault(msg, 17, 0.0), + optFloat: jspb.Message.getFloatingPointFieldWithDefault(msg, 18, 0.0), + optInt32: jspb.Message.getFieldWithDefault(msg, 19, 0), + optInt64: jspb.Message.getFieldWithDefault(msg, 20, 0), + optUint32: jspb.Message.getFieldWithDefault(msg, 21, 0), + optUint64: jspb.Message.getFieldWithDefault(msg, 22, 0), + optSint32: jspb.Message.getFieldWithDefault(msg, 23, 0), + optSint64: jspb.Message.getFieldWithDefault(msg, 24, 0), + optFixed32: jspb.Message.getFieldWithDefault(msg, 25, 0), + optFixed64: jspb.Message.getFieldWithDefault(msg, 26, 0), + optSfixed32: jspb.Message.getFieldWithDefault(msg, 27, 0), + optSfixed64: jspb.Message.getFieldWithDefault(msg, 28, 0), + optBool: jspb.Message.getBooleanFieldWithDefault(msg, 29, false), + optString: jspb.Message.getFieldWithDefault(msg, 30, ""), + optBytes: msg.getOptBytes_asB64(), + optNumber: jspb.Message.getFieldWithDefault(msg, 32, 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.examplecom.PrimitiveMessageV3} + */ +proto.examplecom.PrimitiveMessageV3.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.PrimitiveMessageV3; + return proto.examplecom.PrimitiveMessageV3.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.PrimitiveMessageV3} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.PrimitiveMessageV3} + */ +proto.examplecom.PrimitiveMessageV3.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readDouble()); + msg.setMyDouble(value); + break; + case 2: + var value = /** @type {number} */ (reader.readFloat()); + msg.setMyFloat(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMyInt32(value); + break; + case 4: + var value = /** @type {number} */ (reader.readInt64()); + msg.setMyInt64(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setMyUint32(value); + break; + case 6: + var value = /** @type {number} */ (reader.readUint64()); + msg.setMyUint64(value); + break; + case 7: + var value = /** @type {number} */ (reader.readSint32()); + msg.setMySint32(value); + break; + case 8: + var value = /** @type {number} */ (reader.readSint64()); + msg.setMySint64(value); + break; + case 9: + var value = /** @type {number} */ (reader.readFixed32()); + msg.setMyFixed32(value); + break; + case 10: + var value = /** @type {number} */ (reader.readFixed64()); + msg.setMyFixed64(value); + break; + case 11: + var value = /** @type {number} */ (reader.readSfixed32()); + msg.setMySfixed32(value); + break; + case 12: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setMySfixed64(value); + break; + case 13: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMyBool(value); + break; + case 14: + var value = /** @type {string} */ (reader.readString()); + msg.setMyString(value); + break; + case 15: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setMyBytes(value); + break; + case 16: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMyNumber(value); + break; + case 17: + var value = /** @type {number} */ (reader.readDouble()); + msg.setOptDouble(value); + break; + case 18: + var value = /** @type {number} */ (reader.readFloat()); + msg.setOptFloat(value); + break; + case 19: + var value = /** @type {number} */ (reader.readInt32()); + msg.setOptInt32(value); + break; + case 20: + var value = /** @type {number} */ (reader.readInt64()); + msg.setOptInt64(value); + break; + case 21: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOptUint32(value); + break; + case 22: + var value = /** @type {number} */ (reader.readUint64()); + msg.setOptUint64(value); + break; + case 23: + var value = /** @type {number} */ (reader.readSint32()); + msg.setOptSint32(value); + break; + case 24: + var value = /** @type {number} */ (reader.readSint64()); + msg.setOptSint64(value); + break; + case 25: + var value = /** @type {number} */ (reader.readFixed32()); + msg.setOptFixed32(value); + break; + case 26: + var value = /** @type {number} */ (reader.readFixed64()); + msg.setOptFixed64(value); + break; + case 27: + var value = /** @type {number} */ (reader.readSfixed32()); + msg.setOptSfixed32(value); + break; + case 28: + var value = /** @type {number} */ (reader.readSfixed64()); + msg.setOptSfixed64(value); + break; + case 29: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOptBool(value); + break; + case 30: + var value = /** @type {string} */ (reader.readString()); + msg.setOptString(value); + break; + case 31: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOptBytes(value); + break; + case 32: + var value = /** @type {number} */ (reader.readInt32()); + msg.setOptNumber(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.PrimitiveMessageV3.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.PrimitiveMessageV3.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.PrimitiveMessageV3} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.PrimitiveMessageV3.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyDouble(); + if (f !== 0.0) { + writer.writeDouble( + 1, + f + ); + } + f = message.getMyFloat(); + if (f !== 0.0) { + writer.writeFloat( + 2, + f + ); + } + f = message.getMyInt32(); + if (f !== 0) { + writer.writeInt32( + 3, + f + ); + } + f = message.getMyInt64(); + if (f !== 0) { + writer.writeInt64( + 4, + f + ); + } + f = message.getMyUint32(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = message.getMyUint64(); + if (f !== 0) { + writer.writeUint64( + 6, + f + ); + } + f = message.getMySint32(); + if (f !== 0) { + writer.writeSint32( + 7, + f + ); + } + f = message.getMySint64(); + if (f !== 0) { + writer.writeSint64( + 8, + f + ); + } + f = message.getMyFixed32(); + if (f !== 0) { + writer.writeFixed32( + 9, + f + ); + } + f = message.getMyFixed64(); + if (f !== 0) { + writer.writeFixed64( + 10, + f + ); + } + f = message.getMySfixed32(); + if (f !== 0) { + writer.writeSfixed32( + 11, + f + ); + } + f = message.getMySfixed64(); + if (f !== 0) { + writer.writeSfixed64( + 12, + f + ); + } + f = message.getMyBool(); + if (f) { + writer.writeBool( + 13, + f + ); + } + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 14, + f + ); + } + f = message.getMyBytes_asU8(); + if (f.length > 0) { + writer.writeBytes( + 15, + f + ); + } + f = message.getMyNumber(); + if (f !== 0) { + writer.writeInt32( + 16, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 17)); + if (f != null) { + writer.writeDouble( + 17, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 18)); + if (f != null) { + writer.writeFloat( + 18, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 19)); + if (f != null) { + writer.writeInt32( + 19, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 20)); + if (f != null) { + writer.writeInt64( + 20, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 21)); + if (f != null) { + writer.writeUint32( + 21, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 22)); + if (f != null) { + writer.writeUint64( + 22, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 23)); + if (f != null) { + writer.writeSint32( + 23, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 24)); + if (f != null) { + writer.writeSint64( + 24, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 25)); + if (f != null) { + writer.writeFixed32( + 25, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 26)); + if (f != null) { + writer.writeFixed64( + 26, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 27)); + if (f != null) { + writer.writeSfixed32( + 27, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 28)); + if (f != null) { + writer.writeSfixed64( + 28, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 29)); + if (f != null) { + writer.writeBool( + 29, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 30)); + if (f != null) { + writer.writeString( + 30, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 31)); + if (f != null) { + writer.writeBytes( + 31, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 32)); + if (f != null) { + writer.writeInt32( + 32, + f + ); + } +}; + + +/** + * optional double my_double = 1; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyDouble = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyDouble = function(value) { + return jspb.Message.setProto3FloatField(this, 1, value); +}; + + +/** + * optional float my_float = 2; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyFloat = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyFloat = function(value) { + return jspb.Message.setProto3FloatField(this, 2, value); +}; + + +/** + * optional int32 my_int32 = 3; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyInt32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyInt32 = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * optional int64 my_int64 = 4; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyInt64 = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); +}; + + +/** + * optional uint32 my_uint32 = 5; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyUint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyUint32 = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional uint64 my_uint64 = 6; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyUint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyUint64 = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * optional sint32 my_sint32 = 7; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMySint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMySint32 = function(value) { + return jspb.Message.setProto3IntField(this, 7, value); +}; + + +/** + * optional sint64 my_sint64 = 8; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMySint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMySint64 = function(value) { + return jspb.Message.setProto3IntField(this, 8, value); +}; + + +/** + * optional fixed32 my_fixed32 = 9; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyFixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyFixed32 = function(value) { + return jspb.Message.setProto3IntField(this, 9, value); +}; + + +/** + * optional fixed64 my_fixed64 = 10; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyFixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyFixed64 = function(value) { + return jspb.Message.setProto3IntField(this, 10, value); +}; + + +/** + * optional sfixed32 my_sfixed32 = 11; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMySfixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMySfixed32 = function(value) { + return jspb.Message.setProto3IntField(this, 11, value); +}; + + +/** + * optional sfixed64 my_sfixed64 = 12; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMySfixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMySfixed64 = function(value) { + return jspb.Message.setProto3IntField(this, 12, value); +}; + + +/** + * optional bool my_bool = 13; + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 13, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyBool = function(value) { + return jspb.Message.setProto3BooleanField(this, 13, value); +}; + + +/** + * optional string my_string = 14; + * @return {string} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 14, value); +}; + + +/** + * optional bytes my_bytes = 15; + * @return {!(string|Uint8Array)} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +}; + + +/** + * optional bytes my_bytes = 15; + * This is a type-conversion wrapper around `getMyBytes()` + * @return {string} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getMyBytes())); +}; + + +/** + * optional bytes my_bytes = 15; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMyBytes()` + * @return {!Uint8Array} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getMyBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyBytes = function(value) { + return jspb.Message.setProto3BytesField(this, 15, value); +}; + + +/** + * optional int32 my_NUMBER = 16; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getMyNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 16, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setMyNumber = function(value) { + return jspb.Message.setProto3IntField(this, 16, value); +}; + + +/** + * optional double opt_double = 17; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptDouble = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 17, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptDouble = function(value) { + return jspb.Message.setField(this, 17, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptDouble = function() { + return jspb.Message.setField(this, 17, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptDouble = function() { + return jspb.Message.getField(this, 17) != null; +}; + + +/** + * optional float opt_float = 18; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptFloat = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 18, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptFloat = function(value) { + return jspb.Message.setField(this, 18, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptFloat = function() { + return jspb.Message.setField(this, 18, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptFloat = function() { + return jspb.Message.getField(this, 18) != null; +}; + + +/** + * optional int32 opt_int32 = 19; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptInt32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 19, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptInt32 = function(value) { + return jspb.Message.setField(this, 19, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptInt32 = function() { + return jspb.Message.setField(this, 19, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptInt32 = function() { + return jspb.Message.getField(this, 19) != null; +}; + + +/** + * optional int64 opt_int64 = 20; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 20, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptInt64 = function(value) { + return jspb.Message.setField(this, 20, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptInt64 = function() { + return jspb.Message.setField(this, 20, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptInt64 = function() { + return jspb.Message.getField(this, 20) != null; +}; + + +/** + * optional uint32 opt_uint32 = 21; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptUint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 21, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptUint32 = function(value) { + return jspb.Message.setField(this, 21, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptUint32 = function() { + return jspb.Message.setField(this, 21, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptUint32 = function() { + return jspb.Message.getField(this, 21) != null; +}; + + +/** + * optional uint64 opt_uint64 = 22; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptUint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 22, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptUint64 = function(value) { + return jspb.Message.setField(this, 22, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptUint64 = function() { + return jspb.Message.setField(this, 22, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptUint64 = function() { + return jspb.Message.getField(this, 22) != null; +}; + + +/** + * optional sint32 opt_sint32 = 23; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptSint32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 23, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptSint32 = function(value) { + return jspb.Message.setField(this, 23, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptSint32 = function() { + return jspb.Message.setField(this, 23, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptSint32 = function() { + return jspb.Message.getField(this, 23) != null; +}; + + +/** + * optional sint64 opt_sint64 = 24; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptSint64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 24, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptSint64 = function(value) { + return jspb.Message.setField(this, 24, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptSint64 = function() { + return jspb.Message.setField(this, 24, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptSint64 = function() { + return jspb.Message.getField(this, 24) != null; +}; + + +/** + * optional fixed32 opt_fixed32 = 25; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptFixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 25, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptFixed32 = function(value) { + return jspb.Message.setField(this, 25, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptFixed32 = function() { + return jspb.Message.setField(this, 25, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptFixed32 = function() { + return jspb.Message.getField(this, 25) != null; +}; + + +/** + * optional fixed64 opt_fixed64 = 26; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptFixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 26, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptFixed64 = function(value) { + return jspb.Message.setField(this, 26, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptFixed64 = function() { + return jspb.Message.setField(this, 26, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptFixed64 = function() { + return jspb.Message.getField(this, 26) != null; +}; + + +/** + * optional sfixed32 opt_sfixed32 = 27; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptSfixed32 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 27, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptSfixed32 = function(value) { + return jspb.Message.setField(this, 27, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptSfixed32 = function() { + return jspb.Message.setField(this, 27, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptSfixed32 = function() { + return jspb.Message.getField(this, 27) != null; +}; + + +/** + * optional sfixed64 opt_sfixed64 = 28; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptSfixed64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 28, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptSfixed64 = function(value) { + return jspb.Message.setField(this, 28, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptSfixed64 = function() { + return jspb.Message.setField(this, 28, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptSfixed64 = function() { + return jspb.Message.getField(this, 28) != null; +}; + + +/** + * optional bool opt_bool = 29; + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 29, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptBool = function(value) { + return jspb.Message.setField(this, 29, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptBool = function() { + return jspb.Message.setField(this, 29, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptBool = function() { + return jspb.Message.getField(this, 29) != null; +}; + + +/** + * optional string opt_string = 30; + * @return {string} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 30, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptString = function(value) { + return jspb.Message.setField(this, 30, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptString = function() { + return jspb.Message.setField(this, 30, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptString = function() { + return jspb.Message.getField(this, 30) != null; +}; + + +/** + * optional bytes opt_bytes = 31; + * @return {!(string|Uint8Array)} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 31, "")); +}; + + +/** + * optional bytes opt_bytes = 31; + * This is a type-conversion wrapper around `getOptBytes()` + * @return {string} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOptBytes())); +}; + + +/** + * optional bytes opt_bytes = 31; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOptBytes()` + * @return {!Uint8Array} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOptBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptBytes = function(value) { + return jspb.Message.setField(this, 31, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptBytes = function() { + return jspb.Message.setField(this, 31, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptBytes = function() { + return jspb.Message.getField(this, 31) != null; +}; + + +/** + * optional int32 opt_NUMBER = 32; + * @return {number} + */ +proto.examplecom.PrimitiveMessageV3.prototype.getOptNumber = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 32, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.setOptNumber = function(value) { + return jspb.Message.setField(this, 32, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.PrimitiveMessageV3} returns this + */ +proto.examplecom.PrimitiveMessageV3.prototype.clearOptNumber = function() { + return jspb.Message.setField(this, 32, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.PrimitiveMessageV3.prototype.hasOptNumber = function() { + return jspb.Message.getField(this, 32) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb_service.d.ts new file mode 100644 index 0000000..e091f3a --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/primitive_message_v3.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb_service.js b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb_service.js new file mode 100644 index 0000000..e091f3a --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/primitive_message_v3_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/primitive_message_v3.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb.d.ts new file mode 100644 index 0000000..2492a87 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb.d.ts @@ -0,0 +1,113 @@ +// package: examplecom +// file: proto/examplecom/repeated_primitive_message.proto + +import * as jspb from "google-protobuf"; + +export class RepeatedPrimitiveMessage extends jspb.Message { + clearMyDoubleList(): void; + getMyDoubleList(): Array; + setMyDoubleList(value: Array): void; + addMyDouble(value: number, index?: number): number; + + clearMyFloatList(): void; + getMyFloatList(): Array; + setMyFloatList(value: Array): void; + addMyFloat(value: number, index?: number): number; + + clearMyInt32List(): void; + getMyInt32List(): Array; + setMyInt32List(value: Array): void; + addMyInt32(value: number, index?: number): number; + + clearMyInt64List(): void; + getMyInt64List(): Array; + setMyInt64List(value: Array): void; + addMyInt64(value: number, index?: number): number; + + clearMyUint32List(): void; + getMyUint32List(): Array; + setMyUint32List(value: Array): void; + addMyUint32(value: number, index?: number): number; + + clearMyUint64List(): void; + getMyUint64List(): Array; + setMyUint64List(value: Array): void; + addMyUint64(value: number, index?: number): number; + + clearMySint32List(): void; + getMySint32List(): Array; + setMySint32List(value: Array): void; + addMySint32(value: number, index?: number): number; + + clearMySint64List(): void; + getMySint64List(): Array; + setMySint64List(value: Array): void; + addMySint64(value: number, index?: number): number; + + clearMyFixed32List(): void; + getMyFixed32List(): Array; + setMyFixed32List(value: Array): void; + addMyFixed32(value: number, index?: number): number; + + clearMyFixed64List(): void; + getMyFixed64List(): Array; + setMyFixed64List(value: Array): void; + addMyFixed64(value: number, index?: number): number; + + clearMySfixed32List(): void; + getMySfixed32List(): Array; + setMySfixed32List(value: Array): void; + addMySfixed32(value: number, index?: number): number; + + clearMySfixed64List(): void; + getMySfixed64List(): Array; + setMySfixed64List(value: Array): void; + addMySfixed64(value: number, index?: number): number; + + clearMyBoolList(): void; + getMyBoolList(): Array; + setMyBoolList(value: Array): void; + addMyBool(value: boolean, index?: number): boolean; + + clearMyStringList(): void; + getMyStringList(): Array; + setMyStringList(value: Array): void; + addMyString(value: string, index?: number): string; + + clearMyBytesList(): void; + getMyBytesList(): Array; + getMyBytesList_asU8(): Array; + getMyBytesList_asB64(): Array; + setMyBytesList(value: Array): void; + addMyBytes(value: Uint8Array | string, index?: number): Uint8Array | string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): RepeatedPrimitiveMessage.AsObject; + static toObject(includeInstance: boolean, msg: RepeatedPrimitiveMessage): RepeatedPrimitiveMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: RepeatedPrimitiveMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): RepeatedPrimitiveMessage; + static deserializeBinaryFromReader(message: RepeatedPrimitiveMessage, reader: jspb.BinaryReader): RepeatedPrimitiveMessage; +} + +export namespace RepeatedPrimitiveMessage { + export type AsObject = { + myDoubleList: Array, + myFloatList: Array, + myInt32List: Array, + myInt64List: Array, + myUint32List: Array, + myUint64List: Array, + mySint32List: Array, + mySint64List: Array, + myFixed32List: Array, + myFixed64List: Array, + mySfixed32List: Array, + mySfixed64List: Array, + myBoolList: Array, + myStringList: Array, + myBytesList: Array, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb.js b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb.js new file mode 100644 index 0000000..9751691 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb.js @@ -0,0 +1,932 @@ +// source: proto/examplecom/repeated_primitive_message.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.RepeatedPrimitiveMessage', 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.examplecom.RepeatedPrimitiveMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.examplecom.RepeatedPrimitiveMessage.repeatedFields_, null); +}; +goog.inherits(proto.examplecom.RepeatedPrimitiveMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.RepeatedPrimitiveMessage.displayName = 'proto.examplecom.RepeatedPrimitiveMessage'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.examplecom.RepeatedPrimitiveMessage.repeatedFields_ = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.RepeatedPrimitiveMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.RepeatedPrimitiveMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.RepeatedPrimitiveMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myDoubleList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 1)) == null ? undefined : f, + myFloatList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 2)) == null ? undefined : f, + myInt32List: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, + myInt64List: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, + myUint32List: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f, + myUint64List: (f = jspb.Message.getRepeatedField(msg, 6)) == null ? undefined : f, + mySint32List: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, + mySint64List: (f = jspb.Message.getRepeatedField(msg, 8)) == null ? undefined : f, + myFixed32List: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, + myFixed64List: (f = jspb.Message.getRepeatedField(msg, 10)) == null ? undefined : f, + mySfixed32List: (f = jspb.Message.getRepeatedField(msg, 11)) == null ? undefined : f, + mySfixed64List: (f = jspb.Message.getRepeatedField(msg, 12)) == null ? undefined : f, + myBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 13)) == null ? undefined : f, + myStringList: (f = jspb.Message.getRepeatedField(msg, 14)) == null ? undefined : f, + myBytesList: msg.getMyBytesList_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.examplecom.RepeatedPrimitiveMessage} + */ +proto.examplecom.RepeatedPrimitiveMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.RepeatedPrimitiveMessage; + return proto.examplecom.RepeatedPrimitiveMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.RepeatedPrimitiveMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} + */ +proto.examplecom.RepeatedPrimitiveMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedDouble() : [reader.readDouble()]); + for (var i = 0; i < values.length; i++) { + msg.addMyDouble(values[i]); + } + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedFloat() : [reader.readFloat()]); + for (var i = 0; i < values.length; i++) { + msg.addMyFloat(values[i]); + } + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt32() : [reader.readInt32()]); + for (var i = 0; i < values.length; i++) { + msg.addMyInt32(values[i]); + } + break; + case 4: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedInt64() : [reader.readInt64()]); + for (var i = 0; i < values.length; i++) { + msg.addMyInt64(values[i]); + } + break; + case 5: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint32() : [reader.readUint32()]); + for (var i = 0; i < values.length; i++) { + msg.addMyUint32(values[i]); + } + break; + case 6: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64() : [reader.readUint64()]); + for (var i = 0; i < values.length; i++) { + msg.addMyUint64(values[i]); + } + break; + case 7: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedSint32() : [reader.readSint32()]); + for (var i = 0; i < values.length; i++) { + msg.addMySint32(values[i]); + } + break; + case 8: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedSint64() : [reader.readSint64()]); + for (var i = 0; i < values.length; i++) { + msg.addMySint64(values[i]); + } + break; + case 9: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedFixed32() : [reader.readFixed32()]); + for (var i = 0; i < values.length; i++) { + msg.addMyFixed32(values[i]); + } + break; + case 10: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedFixed64() : [reader.readFixed64()]); + for (var i = 0; i < values.length; i++) { + msg.addMyFixed64(values[i]); + } + break; + case 11: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedSfixed32() : [reader.readSfixed32()]); + for (var i = 0; i < values.length; i++) { + msg.addMySfixed32(values[i]); + } + break; + case 12: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedSfixed64() : [reader.readSfixed64()]); + for (var i = 0; i < values.length; i++) { + msg.addMySfixed64(values[i]); + } + break; + case 13: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addMyBool(values[i]); + } + break; + case 14: + var value = /** @type {string} */ (reader.readString()); + msg.addMyString(value); + break; + case 15: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addMyBytes(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.RepeatedPrimitiveMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.RepeatedPrimitiveMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.RepeatedPrimitiveMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyDoubleList(); + if (f.length > 0) { + writer.writePackedDouble( + 1, + f + ); + } + f = message.getMyFloatList(); + if (f.length > 0) { + writer.writePackedFloat( + 2, + f + ); + } + f = message.getMyInt32List(); + if (f.length > 0) { + writer.writePackedInt32( + 3, + f + ); + } + f = message.getMyInt64List(); + if (f.length > 0) { + writer.writePackedInt64( + 4, + f + ); + } + f = message.getMyUint32List(); + if (f.length > 0) { + writer.writePackedUint32( + 5, + f + ); + } + f = message.getMyUint64List(); + if (f.length > 0) { + writer.writePackedUint64( + 6, + f + ); + } + f = message.getMySint32List(); + if (f.length > 0) { + writer.writePackedSint32( + 7, + f + ); + } + f = message.getMySint64List(); + if (f.length > 0) { + writer.writePackedSint64( + 8, + f + ); + } + f = message.getMyFixed32List(); + if (f.length > 0) { + writer.writePackedFixed32( + 9, + f + ); + } + f = message.getMyFixed64List(); + if (f.length > 0) { + writer.writePackedFixed64( + 10, + f + ); + } + f = message.getMySfixed32List(); + if (f.length > 0) { + writer.writePackedSfixed32( + 11, + f + ); + } + f = message.getMySfixed64List(); + if (f.length > 0) { + writer.writePackedSfixed64( + 12, + f + ); + } + f = message.getMyBoolList(); + if (f.length > 0) { + writer.writePackedBool( + 13, + f + ); + } + f = message.getMyStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 14, + f + ); + } + f = message.getMyBytesList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 15, + f + ); + } +}; + + +/** + * repeated double my_double = 1; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyDoubleList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyDoubleList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyDouble = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyDoubleList = function() { + return this.setMyDoubleList([]); +}; + + +/** + * repeated float my_float = 2; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyFloatList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyFloatList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyFloat = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyFloatList = function() { + return this.setMyFloatList([]); +}; + + +/** + * repeated int32 my_int32 = 3; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyInt32List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyInt32List = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyInt32 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyInt32List = function() { + return this.setMyInt32List([]); +}; + + +/** + * repeated int64 my_int64 = 4; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyInt64List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyInt64List = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyInt64 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyInt64List = function() { + return this.setMyInt64List([]); +}; + + +/** + * repeated uint32 my_uint32 = 5; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyUint32List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyUint32List = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyUint32 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyUint32List = function() { + return this.setMyUint32List([]); +}; + + +/** + * repeated uint64 my_uint64 = 6; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyUint64List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyUint64List = function(value) { + return jspb.Message.setField(this, 6, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyUint64 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 6, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyUint64List = function() { + return this.setMyUint64List([]); +}; + + +/** + * repeated sint32 my_sint32 = 7; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMySint32List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMySint32List = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMySint32 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMySint32List = function() { + return this.setMySint32List([]); +}; + + +/** + * repeated sint64 my_sint64 = 8; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMySint64List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 8)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMySint64List = function(value) { + return jspb.Message.setField(this, 8, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMySint64 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 8, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMySint64List = function() { + return this.setMySint64List([]); +}; + + +/** + * repeated fixed32 my_fixed32 = 9; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyFixed32List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyFixed32List = function(value) { + return jspb.Message.setField(this, 9, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyFixed32 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 9, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyFixed32List = function() { + return this.setMyFixed32List([]); +}; + + +/** + * repeated fixed64 my_fixed64 = 10; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyFixed64List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 10)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyFixed64List = function(value) { + return jspb.Message.setField(this, 10, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyFixed64 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 10, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyFixed64List = function() { + return this.setMyFixed64List([]); +}; + + +/** + * repeated sfixed32 my_sfixed32 = 11; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMySfixed32List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 11)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMySfixed32List = function(value) { + return jspb.Message.setField(this, 11, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMySfixed32 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 11, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMySfixed32List = function() { + return this.setMySfixed32List([]); +}; + + +/** + * repeated sfixed64 my_sfixed64 = 12; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMySfixed64List = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 12)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMySfixed64List = function(value) { + return jspb.Message.setField(this, 12, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMySfixed64 = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 12, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMySfixed64List = function() { + return this.setMySfixed64List([]); +}; + + +/** + * repeated bool my_bool = 13; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyBoolList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 13)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyBoolList = function(value) { + return jspb.Message.setField(this, 13, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyBool = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 13, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyBoolList = function() { + return this.setMyBoolList([]); +}; + + +/** + * repeated string my_string = 14; + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 14)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyStringList = function(value) { + return jspb.Message.setField(this, 14, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 14, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyStringList = function() { + return this.setMyStringList([]); +}; + + +/** + * repeated bytes my_bytes = 15; + * @return {!(Array|Array)} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyBytesList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 15)); +}; + + +/** + * repeated bytes my_bytes = 15; + * This is a type-conversion wrapper around `getMyBytesList()` + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyBytesList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getMyBytesList())); +}; + + +/** + * repeated bytes my_bytes = 15; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getMyBytesList()` + * @return {!Array} + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.getMyBytesList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getMyBytesList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.setMyBytesList = function(value) { + return jspb.Message.setField(this, 15, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.addMyBytes = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 15, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.RepeatedPrimitiveMessage} returns this + */ +proto.examplecom.RepeatedPrimitiveMessage.prototype.clearMyBytesList = function() { + return this.setMyBytesList([]); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb_service.d.ts new file mode 100644 index 0000000..b7dbeb7 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/repeated_primitive_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb_service.js b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb_service.js new file mode 100644 index 0000000..b7dbeb7 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/repeated_primitive_message_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/repeated_primitive_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/reserved_words_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb.d.ts new file mode 100644 index 0000000..b6b1161 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb.d.ts @@ -0,0 +1,253 @@ +// package: examplecom +// file: proto/examplecom/reserved_words.proto + +import * as jspb from "google-protobuf"; + +export class ReservedWordsMessage extends jspb.Message { + getAbstract(): string; + setAbstract(value: string): void; + + getBoolean(): string; + setBoolean(value: string): void; + + getBreak(): string; + setBreak(value: string): void; + + getByte(): string; + setByte(value: string): void; + + getCase(): string; + setCase(value: string): void; + + getCatch(): string; + setCatch(value: string): void; + + getChar(): string; + setChar(value: string): void; + + getClass(): string; + setClass(value: string): void; + + getConst(): string; + setConst(value: string): void; + + getContinue(): string; + setContinue(value: string): void; + + getDebugger(): string; + setDebugger(value: string): void; + + getDefault(): string; + setDefault(value: string): void; + + getDelete(): string; + setDelete(value: string): void; + + getDo(): string; + setDo(value: string): void; + + getDouble(): string; + setDouble(value: string): void; + + getElse(): string; + setElse(value: string): void; + + getEnum(): string; + setEnum(value: string): void; + + getExport(): string; + setExport(value: string): void; + + getExtends(): string; + setExtends(value: string): void; + + getFalse(): string; + setFalse(value: string): void; + + getFinal(): string; + setFinal(value: string): void; + + getFinally(): string; + setFinally(value: string): void; + + getFloat(): string; + setFloat(value: string): void; + + getFor(): string; + setFor(value: string): void; + + getFunction(): string; + setFunction(value: string): void; + + getGoto(): string; + setGoto(value: string): void; + + getIf(): string; + setIf(value: string): void; + + getImplements(): string; + setImplements(value: string): void; + + getImport(): string; + setImport(value: string): void; + + getIn(): string; + setIn(value: string): void; + + getInstanceof(): string; + setInstanceof(value: string): void; + + getInt(): string; + setInt(value: string): void; + + getInterface(): string; + setInterface(value: string): void; + + getLong(): string; + setLong(value: string): void; + + getNative(): string; + setNative(value: string): void; + + getNew(): string; + setNew(value: string): void; + + getNull(): string; + setNull(value: string): void; + + getPackage(): string; + setPackage(value: string): void; + + getPrivate(): string; + setPrivate(value: string): void; + + getProtected(): string; + setProtected(value: string): void; + + getPublic(): string; + setPublic(value: string): void; + + getReturn(): string; + setReturn(value: string): void; + + getShort(): string; + setShort(value: string): void; + + getStatic(): string; + setStatic(value: string): void; + + getSuper(): string; + setSuper(value: string): void; + + getSwitch(): string; + setSwitch(value: string): void; + + getSynchronized(): string; + setSynchronized(value: string): void; + + getThis(): string; + setThis(value: string): void; + + getThrow(): string; + setThrow(value: string): void; + + getThrows(): string; + setThrows(value: string): void; + + getTransient(): string; + setTransient(value: string): void; + + getTry(): string; + setTry(value: string): void; + + getTypeof(): string; + setTypeof(value: string): void; + + getVar(): string; + setVar(value: string): void; + + getVoid(): string; + setVoid(value: string): void; + + getVolatile(): string; + setVolatile(value: string): void; + + getWhile(): string; + setWhile(value: string): void; + + getWith(): string; + setWith(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ReservedWordsMessage.AsObject; + static toObject(includeInstance: boolean, msg: ReservedWordsMessage): ReservedWordsMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ReservedWordsMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ReservedWordsMessage; + static deserializeBinaryFromReader(message: ReservedWordsMessage, reader: jspb.BinaryReader): ReservedWordsMessage; +} + +export namespace ReservedWordsMessage { + export type AsObject = { + pb_abstract: string, + pb_boolean: string, + pb_break: string, + pb_byte: string, + pb_case: string, + pb_catch: string, + pb_char: string, + pb_class: string, + pb_const: string, + pb_continue: string, + pb_debugger: string, + pb_default: string, + pb_delete: string, + pb_do: string, + pb_double: string, + pb_else: string, + pb_enum: string, + pb_export: string, + pb_extends: string, + pb_false: string, + pb_final: string, + pb_finally: string, + pb_float: string, + pb_for: string, + pb_function: string, + pb_goto: string, + pb_if: string, + pb_implements: string, + pb_import: string, + pb_in: string, + pb_instanceof: string, + pb_int: string, + pb_interface: string, + pb_long: string, + pb_native: string, + pb_new: string, + pb_null: string, + pb_package: string, + pb_private: string, + pb_protected: string, + pb_public: string, + pb_return: string, + pb_short: string, + pb_static: string, + pb_super: string, + pb_switch: string, + pb_synchronized: string, + pb_this: string, + pb_throw: string, + pb_throws: string, + pb_transient: string, + pb_try: string, + pb_typeof: string, + pb_var: string, + pb_void: string, + pb_volatile: string, + pb_while: string, + pb_with: string, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/reserved_words_pb.js b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb.js new file mode 100644 index 0000000..1116768 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb.js @@ -0,0 +1,1880 @@ +// source: proto/examplecom/reserved_words.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.ReservedWordsMessage', 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.examplecom.ReservedWordsMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.ReservedWordsMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.ReservedWordsMessage.displayName = 'proto.examplecom.ReservedWordsMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.ReservedWordsMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.ReservedWordsMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.ReservedWordsMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ReservedWordsMessage.toObject = function(includeInstance, msg) { + var f, obj = { + pb_abstract: jspb.Message.getFieldWithDefault(msg, 1, ""), + pb_boolean: jspb.Message.getFieldWithDefault(msg, 2, ""), + pb_break: jspb.Message.getFieldWithDefault(msg, 3, ""), + pb_byte: jspb.Message.getFieldWithDefault(msg, 4, ""), + pb_case: jspb.Message.getFieldWithDefault(msg, 5, ""), + pb_catch: jspb.Message.getFieldWithDefault(msg, 6, ""), + pb_char: jspb.Message.getFieldWithDefault(msg, 7, ""), + pb_class: jspb.Message.getFieldWithDefault(msg, 8, ""), + pb_const: jspb.Message.getFieldWithDefault(msg, 9, ""), + pb_continue: jspb.Message.getFieldWithDefault(msg, 10, ""), + pb_debugger: jspb.Message.getFieldWithDefault(msg, 11, ""), + pb_default: jspb.Message.getFieldWithDefault(msg, 12, ""), + pb_delete: jspb.Message.getFieldWithDefault(msg, 13, ""), + pb_do: jspb.Message.getFieldWithDefault(msg, 14, ""), + pb_double: jspb.Message.getFieldWithDefault(msg, 15, ""), + pb_else: jspb.Message.getFieldWithDefault(msg, 16, ""), + pb_enum: jspb.Message.getFieldWithDefault(msg, 17, ""), + pb_export: jspb.Message.getFieldWithDefault(msg, 18, ""), + pb_extends: jspb.Message.getFieldWithDefault(msg, 19, ""), + pb_false: jspb.Message.getFieldWithDefault(msg, 20, ""), + pb_final: jspb.Message.getFieldWithDefault(msg, 21, ""), + pb_finally: jspb.Message.getFieldWithDefault(msg, 22, ""), + pb_float: jspb.Message.getFieldWithDefault(msg, 23, ""), + pb_for: jspb.Message.getFieldWithDefault(msg, 24, ""), + pb_function: jspb.Message.getFieldWithDefault(msg, 25, ""), + pb_goto: jspb.Message.getFieldWithDefault(msg, 26, ""), + pb_if: jspb.Message.getFieldWithDefault(msg, 27, ""), + pb_implements: jspb.Message.getFieldWithDefault(msg, 28, ""), + pb_import: jspb.Message.getFieldWithDefault(msg, 29, ""), + pb_in: jspb.Message.getFieldWithDefault(msg, 30, ""), + pb_instanceof: jspb.Message.getFieldWithDefault(msg, 31, ""), + pb_int: jspb.Message.getFieldWithDefault(msg, 32, ""), + pb_interface: jspb.Message.getFieldWithDefault(msg, 33, ""), + pb_long: jspb.Message.getFieldWithDefault(msg, 34, ""), + pb_native: jspb.Message.getFieldWithDefault(msg, 35, ""), + pb_new: jspb.Message.getFieldWithDefault(msg, 36, ""), + pb_null: jspb.Message.getFieldWithDefault(msg, 37, ""), + pb_package: jspb.Message.getFieldWithDefault(msg, 38, ""), + pb_private: jspb.Message.getFieldWithDefault(msg, 39, ""), + pb_protected: jspb.Message.getFieldWithDefault(msg, 40, ""), + pb_public: jspb.Message.getFieldWithDefault(msg, 41, ""), + pb_return: jspb.Message.getFieldWithDefault(msg, 42, ""), + pb_short: jspb.Message.getFieldWithDefault(msg, 43, ""), + pb_static: jspb.Message.getFieldWithDefault(msg, 44, ""), + pb_super: jspb.Message.getFieldWithDefault(msg, 45, ""), + pb_switch: jspb.Message.getFieldWithDefault(msg, 46, ""), + pb_synchronized: jspb.Message.getFieldWithDefault(msg, 47, ""), + pb_this: jspb.Message.getFieldWithDefault(msg, 48, ""), + pb_throw: jspb.Message.getFieldWithDefault(msg, 49, ""), + pb_throws: jspb.Message.getFieldWithDefault(msg, 50, ""), + pb_transient: jspb.Message.getFieldWithDefault(msg, 51, ""), + pb_try: jspb.Message.getFieldWithDefault(msg, 52, ""), + pb_typeof: jspb.Message.getFieldWithDefault(msg, 53, ""), + pb_var: jspb.Message.getFieldWithDefault(msg, 54, ""), + pb_void: jspb.Message.getFieldWithDefault(msg, 55, ""), + pb_volatile: jspb.Message.getFieldWithDefault(msg, 56, ""), + pb_while: jspb.Message.getFieldWithDefault(msg, 57, ""), + pb_with: jspb.Message.getFieldWithDefault(msg, 58, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.examplecom.ReservedWordsMessage} + */ +proto.examplecom.ReservedWordsMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.ReservedWordsMessage; + return proto.examplecom.ReservedWordsMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.ReservedWordsMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.ReservedWordsMessage} + */ +proto.examplecom.ReservedWordsMessage.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.setAbstract(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setBoolean(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setBreak(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setByte(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setCase(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setCatch(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setChar(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setClass(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.setConst(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.setContinue(value); + break; + case 11: + var value = /** @type {string} */ (reader.readString()); + msg.setDebugger(value); + break; + case 12: + var value = /** @type {string} */ (reader.readString()); + msg.setDefault(value); + break; + case 13: + var value = /** @type {string} */ (reader.readString()); + msg.setDelete(value); + break; + case 14: + var value = /** @type {string} */ (reader.readString()); + msg.setDo(value); + break; + case 15: + var value = /** @type {string} */ (reader.readString()); + msg.setDouble(value); + break; + case 16: + var value = /** @type {string} */ (reader.readString()); + msg.setElse(value); + break; + case 17: + var value = /** @type {string} */ (reader.readString()); + msg.setEnum(value); + break; + case 18: + var value = /** @type {string} */ (reader.readString()); + msg.setExport(value); + break; + case 19: + var value = /** @type {string} */ (reader.readString()); + msg.setExtends(value); + break; + case 20: + var value = /** @type {string} */ (reader.readString()); + msg.setFalse(value); + break; + case 21: + var value = /** @type {string} */ (reader.readString()); + msg.setFinal(value); + break; + case 22: + var value = /** @type {string} */ (reader.readString()); + msg.setFinally(value); + break; + case 23: + var value = /** @type {string} */ (reader.readString()); + msg.setFloat(value); + break; + case 24: + var value = /** @type {string} */ (reader.readString()); + msg.setFor(value); + break; + case 25: + var value = /** @type {string} */ (reader.readString()); + msg.setFunction(value); + break; + case 26: + var value = /** @type {string} */ (reader.readString()); + msg.setGoto(value); + break; + case 27: + var value = /** @type {string} */ (reader.readString()); + msg.setIf(value); + break; + case 28: + var value = /** @type {string} */ (reader.readString()); + msg.setImplements(value); + break; + case 29: + var value = /** @type {string} */ (reader.readString()); + msg.setImport(value); + break; + case 30: + var value = /** @type {string} */ (reader.readString()); + msg.setIn(value); + break; + case 31: + var value = /** @type {string} */ (reader.readString()); + msg.setInstanceof(value); + break; + case 32: + var value = /** @type {string} */ (reader.readString()); + msg.setInt(value); + break; + case 33: + var value = /** @type {string} */ (reader.readString()); + msg.setInterface(value); + break; + case 34: + var value = /** @type {string} */ (reader.readString()); + msg.setLong(value); + break; + case 35: + var value = /** @type {string} */ (reader.readString()); + msg.setNative(value); + break; + case 36: + var value = /** @type {string} */ (reader.readString()); + msg.setNew(value); + break; + case 37: + var value = /** @type {string} */ (reader.readString()); + msg.setNull(value); + break; + case 38: + var value = /** @type {string} */ (reader.readString()); + msg.setPackage(value); + break; + case 39: + var value = /** @type {string} */ (reader.readString()); + msg.setPrivate(value); + break; + case 40: + var value = /** @type {string} */ (reader.readString()); + msg.setProtected(value); + break; + case 41: + var value = /** @type {string} */ (reader.readString()); + msg.setPublic(value); + break; + case 42: + var value = /** @type {string} */ (reader.readString()); + msg.setReturn(value); + break; + case 43: + var value = /** @type {string} */ (reader.readString()); + msg.setShort(value); + break; + case 44: + var value = /** @type {string} */ (reader.readString()); + msg.setStatic(value); + break; + case 45: + var value = /** @type {string} */ (reader.readString()); + msg.setSuper(value); + break; + case 46: + var value = /** @type {string} */ (reader.readString()); + msg.setSwitch(value); + break; + case 47: + var value = /** @type {string} */ (reader.readString()); + msg.setSynchronized(value); + break; + case 48: + var value = /** @type {string} */ (reader.readString()); + msg.setThis(value); + break; + case 49: + var value = /** @type {string} */ (reader.readString()); + msg.setThrow(value); + break; + case 50: + var value = /** @type {string} */ (reader.readString()); + msg.setThrows(value); + break; + case 51: + var value = /** @type {string} */ (reader.readString()); + msg.setTransient(value); + break; + case 52: + var value = /** @type {string} */ (reader.readString()); + msg.setTry(value); + break; + case 53: + var value = /** @type {string} */ (reader.readString()); + msg.setTypeof(value); + break; + case 54: + var value = /** @type {string} */ (reader.readString()); + msg.setVar(value); + break; + case 55: + var value = /** @type {string} */ (reader.readString()); + msg.setVoid(value); + break; + case 56: + var value = /** @type {string} */ (reader.readString()); + msg.setVolatile(value); + break; + case 57: + var value = /** @type {string} */ (reader.readString()); + msg.setWhile(value); + break; + case 58: + var value = /** @type {string} */ (reader.readString()); + msg.setWith(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.ReservedWordsMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.ReservedWordsMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.ReservedWordsMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.ReservedWordsMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAbstract(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getBoolean(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getBreak(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getByte(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getCase(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getCatch(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = message.getChar(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getClass(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } + f = message.getConst(); + if (f.length > 0) { + writer.writeString( + 9, + f + ); + } + f = message.getContinue(); + if (f.length > 0) { + writer.writeString( + 10, + f + ); + } + f = message.getDebugger(); + if (f.length > 0) { + writer.writeString( + 11, + f + ); + } + f = message.getDefault(); + if (f.length > 0) { + writer.writeString( + 12, + f + ); + } + f = message.getDelete(); + if (f.length > 0) { + writer.writeString( + 13, + f + ); + } + f = message.getDo(); + if (f.length > 0) { + writer.writeString( + 14, + f + ); + } + f = message.getDouble(); + if (f.length > 0) { + writer.writeString( + 15, + f + ); + } + f = message.getElse(); + if (f.length > 0) { + writer.writeString( + 16, + f + ); + } + f = message.getEnum(); + if (f.length > 0) { + writer.writeString( + 17, + f + ); + } + f = message.getExport(); + if (f.length > 0) { + writer.writeString( + 18, + f + ); + } + f = message.getExtends(); + if (f.length > 0) { + writer.writeString( + 19, + f + ); + } + f = message.getFalse(); + if (f.length > 0) { + writer.writeString( + 20, + f + ); + } + f = message.getFinal(); + if (f.length > 0) { + writer.writeString( + 21, + f + ); + } + f = message.getFinally(); + if (f.length > 0) { + writer.writeString( + 22, + f + ); + } + f = message.getFloat(); + if (f.length > 0) { + writer.writeString( + 23, + f + ); + } + f = message.getFor(); + if (f.length > 0) { + writer.writeString( + 24, + f + ); + } + f = message.getFunction(); + if (f.length > 0) { + writer.writeString( + 25, + f + ); + } + f = message.getGoto(); + if (f.length > 0) { + writer.writeString( + 26, + f + ); + } + f = message.getIf(); + if (f.length > 0) { + writer.writeString( + 27, + f + ); + } + f = message.getImplements(); + if (f.length > 0) { + writer.writeString( + 28, + f + ); + } + f = message.getImport(); + if (f.length > 0) { + writer.writeString( + 29, + f + ); + } + f = message.getIn(); + if (f.length > 0) { + writer.writeString( + 30, + f + ); + } + f = message.getInstanceof(); + if (f.length > 0) { + writer.writeString( + 31, + f + ); + } + f = message.getInt(); + if (f.length > 0) { + writer.writeString( + 32, + f + ); + } + f = message.getInterface(); + if (f.length > 0) { + writer.writeString( + 33, + f + ); + } + f = message.getLong(); + if (f.length > 0) { + writer.writeString( + 34, + f + ); + } + f = message.getNative(); + if (f.length > 0) { + writer.writeString( + 35, + f + ); + } + f = message.getNew(); + if (f.length > 0) { + writer.writeString( + 36, + f + ); + } + f = message.getNull(); + if (f.length > 0) { + writer.writeString( + 37, + f + ); + } + f = message.getPackage(); + if (f.length > 0) { + writer.writeString( + 38, + f + ); + } + f = message.getPrivate(); + if (f.length > 0) { + writer.writeString( + 39, + f + ); + } + f = message.getProtected(); + if (f.length > 0) { + writer.writeString( + 40, + f + ); + } + f = message.getPublic(); + if (f.length > 0) { + writer.writeString( + 41, + f + ); + } + f = message.getReturn(); + if (f.length > 0) { + writer.writeString( + 42, + f + ); + } + f = message.getShort(); + if (f.length > 0) { + writer.writeString( + 43, + f + ); + } + f = message.getStatic(); + if (f.length > 0) { + writer.writeString( + 44, + f + ); + } + f = message.getSuper(); + if (f.length > 0) { + writer.writeString( + 45, + f + ); + } + f = message.getSwitch(); + if (f.length > 0) { + writer.writeString( + 46, + f + ); + } + f = message.getSynchronized(); + if (f.length > 0) { + writer.writeString( + 47, + f + ); + } + f = message.getThis(); + if (f.length > 0) { + writer.writeString( + 48, + f + ); + } + f = message.getThrow(); + if (f.length > 0) { + writer.writeString( + 49, + f + ); + } + f = message.getThrows(); + if (f.length > 0) { + writer.writeString( + 50, + f + ); + } + f = message.getTransient(); + if (f.length > 0) { + writer.writeString( + 51, + f + ); + } + f = message.getTry(); + if (f.length > 0) { + writer.writeString( + 52, + f + ); + } + f = message.getTypeof(); + if (f.length > 0) { + writer.writeString( + 53, + f + ); + } + f = message.getVar(); + if (f.length > 0) { + writer.writeString( + 54, + f + ); + } + f = message.getVoid(); + if (f.length > 0) { + writer.writeString( + 55, + f + ); + } + f = message.getVolatile(); + if (f.length > 0) { + writer.writeString( + 56, + f + ); + } + f = message.getWhile(); + if (f.length > 0) { + writer.writeString( + 57, + f + ); + } + f = message.getWith(); + if (f.length > 0) { + writer.writeString( + 58, + f + ); + } +}; + + +/** + * optional string abstract = 1; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getAbstract = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setAbstract = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string boolean = 2; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getBoolean = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setBoolean = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string break = 3; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getBreak = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setBreak = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string byte = 4; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getByte = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setByte = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string case = 5; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getCase = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setCase = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string catch = 6; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getCatch = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setCatch = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional string char = 7; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getChar = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setChar = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional string class = 8; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getClass = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setClass = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + +/** + * optional string const = 9; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getConst = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setConst = function(value) { + return jspb.Message.setProto3StringField(this, 9, value); +}; + + +/** + * optional string continue = 10; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getContinue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setContinue = function(value) { + return jspb.Message.setProto3StringField(this, 10, value); +}; + + +/** + * optional string debugger = 11; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getDebugger = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setDebugger = function(value) { + return jspb.Message.setProto3StringField(this, 11, value); +}; + + +/** + * optional string default = 12; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getDefault = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setDefault = function(value) { + return jspb.Message.setProto3StringField(this, 12, value); +}; + + +/** + * optional string delete = 13; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getDelete = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setDelete = function(value) { + return jspb.Message.setProto3StringField(this, 13, value); +}; + + +/** + * optional string do = 14; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getDo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setDo = function(value) { + return jspb.Message.setProto3StringField(this, 14, value); +}; + + +/** + * optional string double = 15; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getDouble = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setDouble = function(value) { + return jspb.Message.setProto3StringField(this, 15, value); +}; + + +/** + * optional string else = 16; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getElse = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 16, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setElse = function(value) { + return jspb.Message.setProto3StringField(this, 16, value); +}; + + +/** + * optional string enum = 17; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getEnum = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 17, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setEnum = function(value) { + return jspb.Message.setProto3StringField(this, 17, value); +}; + + +/** + * optional string export = 18; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getExport = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 18, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setExport = function(value) { + return jspb.Message.setProto3StringField(this, 18, value); +}; + + +/** + * optional string extends = 19; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getExtends = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 19, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setExtends = function(value) { + return jspb.Message.setProto3StringField(this, 19, value); +}; + + +/** + * optional string false = 20; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getFalse = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 20, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setFalse = function(value) { + return jspb.Message.setProto3StringField(this, 20, value); +}; + + +/** + * optional string final = 21; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getFinal = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 21, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setFinal = function(value) { + return jspb.Message.setProto3StringField(this, 21, value); +}; + + +/** + * optional string finally = 22; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getFinally = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 22, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setFinally = function(value) { + return jspb.Message.setProto3StringField(this, 22, value); +}; + + +/** + * optional string float = 23; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getFloat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 23, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setFloat = function(value) { + return jspb.Message.setProto3StringField(this, 23, value); +}; + + +/** + * optional string for = 24; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getFor = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 24, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setFor = function(value) { + return jspb.Message.setProto3StringField(this, 24, value); +}; + + +/** + * optional string function = 25; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getFunction = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 25, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setFunction = function(value) { + return jspb.Message.setProto3StringField(this, 25, value); +}; + + +/** + * optional string goto = 26; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getGoto = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 26, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setGoto = function(value) { + return jspb.Message.setProto3StringField(this, 26, value); +}; + + +/** + * optional string if = 27; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getIf = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 27, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setIf = function(value) { + return jspb.Message.setProto3StringField(this, 27, value); +}; + + +/** + * optional string implements = 28; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getImplements = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 28, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setImplements = function(value) { + return jspb.Message.setProto3StringField(this, 28, value); +}; + + +/** + * optional string import = 29; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getImport = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 29, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setImport = function(value) { + return jspb.Message.setProto3StringField(this, 29, value); +}; + + +/** + * optional string in = 30; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getIn = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 30, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setIn = function(value) { + return jspb.Message.setProto3StringField(this, 30, value); +}; + + +/** + * optional string instanceof = 31; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getInstanceof = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 31, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setInstanceof = function(value) { + return jspb.Message.setProto3StringField(this, 31, value); +}; + + +/** + * optional string int = 32; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getInt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 32, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setInt = function(value) { + return jspb.Message.setProto3StringField(this, 32, value); +}; + + +/** + * optional string interface = 33; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getInterface = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 33, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setInterface = function(value) { + return jspb.Message.setProto3StringField(this, 33, value); +}; + + +/** + * optional string long = 34; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getLong = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 34, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setLong = function(value) { + return jspb.Message.setProto3StringField(this, 34, value); +}; + + +/** + * optional string native = 35; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getNative = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 35, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setNative = function(value) { + return jspb.Message.setProto3StringField(this, 35, value); +}; + + +/** + * optional string new = 36; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getNew = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 36, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setNew = function(value) { + return jspb.Message.setProto3StringField(this, 36, value); +}; + + +/** + * optional string null = 37; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getNull = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 37, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setNull = function(value) { + return jspb.Message.setProto3StringField(this, 37, value); +}; + + +/** + * optional string package = 38; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getPackage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 38, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setPackage = function(value) { + return jspb.Message.setProto3StringField(this, 38, value); +}; + + +/** + * optional string private = 39; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getPrivate = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 39, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setPrivate = function(value) { + return jspb.Message.setProto3StringField(this, 39, value); +}; + + +/** + * optional string protected = 40; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getProtected = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 40, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setProtected = function(value) { + return jspb.Message.setProto3StringField(this, 40, value); +}; + + +/** + * optional string public = 41; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getPublic = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 41, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setPublic = function(value) { + return jspb.Message.setProto3StringField(this, 41, value); +}; + + +/** + * optional string return = 42; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getReturn = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 42, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setReturn = function(value) { + return jspb.Message.setProto3StringField(this, 42, value); +}; + + +/** + * optional string short = 43; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getShort = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 43, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setShort = function(value) { + return jspb.Message.setProto3StringField(this, 43, value); +}; + + +/** + * optional string static = 44; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getStatic = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 44, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setStatic = function(value) { + return jspb.Message.setProto3StringField(this, 44, value); +}; + + +/** + * optional string super = 45; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getSuper = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 45, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setSuper = function(value) { + return jspb.Message.setProto3StringField(this, 45, value); +}; + + +/** + * optional string switch = 46; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getSwitch = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 46, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setSwitch = function(value) { + return jspb.Message.setProto3StringField(this, 46, value); +}; + + +/** + * optional string synchronized = 47; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getSynchronized = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 47, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setSynchronized = function(value) { + return jspb.Message.setProto3StringField(this, 47, value); +}; + + +/** + * optional string this = 48; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getThis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 48, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setThis = function(value) { + return jspb.Message.setProto3StringField(this, 48, value); +}; + + +/** + * optional string throw = 49; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getThrow = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 49, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setThrow = function(value) { + return jspb.Message.setProto3StringField(this, 49, value); +}; + + +/** + * optional string throws = 50; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getThrows = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 50, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setThrows = function(value) { + return jspb.Message.setProto3StringField(this, 50, value); +}; + + +/** + * optional string transient = 51; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getTransient = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 51, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setTransient = function(value) { + return jspb.Message.setProto3StringField(this, 51, value); +}; + + +/** + * optional string try = 52; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getTry = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 52, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setTry = function(value) { + return jspb.Message.setProto3StringField(this, 52, value); +}; + + +/** + * optional string typeof = 53; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getTypeof = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 53, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setTypeof = function(value) { + return jspb.Message.setProto3StringField(this, 53, value); +}; + + +/** + * optional string var = 54; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getVar = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 54, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setVar = function(value) { + return jspb.Message.setProto3StringField(this, 54, value); +}; + + +/** + * optional string void = 55; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getVoid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 55, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setVoid = function(value) { + return jspb.Message.setProto3StringField(this, 55, value); +}; + + +/** + * optional string volatile = 56; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getVolatile = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 56, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setVolatile = function(value) { + return jspb.Message.setProto3StringField(this, 56, value); +}; + + +/** + * optional string while = 57; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getWhile = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 57, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setWhile = function(value) { + return jspb.Message.setProto3StringField(this, 57, value); +}; + + +/** + * optional string with = 58; + * @return {string} + */ +proto.examplecom.ReservedWordsMessage.prototype.getWith = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 58, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.ReservedWordsMessage} returns this + */ +proto.examplecom.ReservedWordsMessage.prototype.setWith = function(value) { + return jspb.Message.setProto3StringField(this, 58, value); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/reserved_words_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb_service.d.ts new file mode 100644 index 0000000..951d1a1 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/reserved_words.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/reserved_words_pb_service.js b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb_service.js new file mode 100644 index 0000000..951d1a1 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/reserved_words_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/reserved_words.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/simple_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/simple_pb.d.ts new file mode 100644 index 0000000..9384ef6 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_pb.d.ts @@ -0,0 +1,119 @@ +// package: examplecom +// file: proto/examplecom/simple.proto + +import * as jspb from "google-protobuf"; +import * as google_protobuf_compiler_plugin_pb from "google-protobuf/google/protobuf/compiler/plugin_pb"; +import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb"; +import * as google_protobuf_api_pb from "google-protobuf/google/protobuf/api_pb"; +import * as google_protobuf_descriptor_pb from "google-protobuf/google/protobuf/descriptor_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; +import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb"; +import * as google_protobuf_field_mask_pb from "google-protobuf/google/protobuf/field_mask_pb"; +import * as google_protobuf_source_context_pb from "google-protobuf/google/protobuf/source_context_pb"; +import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as google_protobuf_type_pb from "google-protobuf/google/protobuf/type_pb"; +import * as google_protobuf_wrappers_pb from "google-protobuf/google/protobuf/wrappers_pb"; + +export class MySimple extends jspb.Message { + getMyString(): string; + setMyString(value: string): void; + + getMyBool(): boolean; + setMyBool(value: boolean): void; + + clearSomeLabelsList(): void; + getSomeLabelsList(): Array; + setSomeLabelsList(value: Array): void; + addSomeLabels(value: string, index?: number): string; + + hasSomeCodeGeneratorRequest(): boolean; + clearSomeCodeGeneratorRequest(): void; + getSomeCodeGeneratorRequest(): google_protobuf_compiler_plugin_pb.CodeGeneratorRequest | undefined; + setSomeCodeGeneratorRequest(value?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest): void; + + hasSomeAny(): boolean; + clearSomeAny(): void; + getSomeAny(): google_protobuf_any_pb.Any | undefined; + setSomeAny(value?: google_protobuf_any_pb.Any): void; + + hasSomeMethod(): boolean; + clearSomeMethod(): void; + getSomeMethod(): google_protobuf_api_pb.Method | undefined; + setSomeMethod(value?: google_protobuf_api_pb.Method): void; + + hasSomeGeneratedCodeInfo(): boolean; + clearSomeGeneratedCodeInfo(): void; + getSomeGeneratedCodeInfo(): google_protobuf_descriptor_pb.GeneratedCodeInfo | undefined; + setSomeGeneratedCodeInfo(value?: google_protobuf_descriptor_pb.GeneratedCodeInfo): void; + + hasSomeDuration(): boolean; + clearSomeDuration(): void; + getSomeDuration(): google_protobuf_duration_pb.Duration | undefined; + setSomeDuration(value?: google_protobuf_duration_pb.Duration): void; + + hasSomeEmpty(): boolean; + clearSomeEmpty(): void; + getSomeEmpty(): google_protobuf_empty_pb.Empty | undefined; + setSomeEmpty(value?: google_protobuf_empty_pb.Empty): void; + + hasSomeFieldMask(): boolean; + clearSomeFieldMask(): void; + getSomeFieldMask(): google_protobuf_field_mask_pb.FieldMask | undefined; + setSomeFieldMask(value?: google_protobuf_field_mask_pb.FieldMask): void; + + hasSomeSourceContext(): boolean; + clearSomeSourceContext(): void; + getSomeSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; + setSomeSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; + + hasSomeStruct(): boolean; + clearSomeStruct(): void; + getSomeStruct(): google_protobuf_struct_pb.Struct | undefined; + setSomeStruct(value?: google_protobuf_struct_pb.Struct): void; + + hasSomeTimestamp(): boolean; + clearSomeTimestamp(): void; + getSomeTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setSomeTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): void; + + hasSomeType(): boolean; + clearSomeType(): void; + getSomeType(): google_protobuf_type_pb.Type | undefined; + setSomeType(value?: google_protobuf_type_pb.Type): void; + + hasSomeDoubleValue(): boolean; + clearSomeDoubleValue(): void; + getSomeDoubleValue(): google_protobuf_wrappers_pb.DoubleValue | undefined; + setSomeDoubleValue(value?: google_protobuf_wrappers_pb.DoubleValue): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): MySimple.AsObject; + static toObject(includeInstance: boolean, msg: MySimple): MySimple.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MySimple, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MySimple; + static deserializeBinaryFromReader(message: MySimple, reader: jspb.BinaryReader): MySimple; +} + +export namespace MySimple { + export type AsObject = { + myString: string, + myBool: boolean, + someLabelsList: Array, + someCodeGeneratorRequest?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.AsObject, + someAny?: google_protobuf_any_pb.Any.AsObject, + someMethod?: google_protobuf_api_pb.Method.AsObject, + someGeneratedCodeInfo?: google_protobuf_descriptor_pb.GeneratedCodeInfo.AsObject, + someDuration?: google_protobuf_duration_pb.Duration.AsObject, + someEmpty?: google_protobuf_empty_pb.Empty.AsObject, + someFieldMask?: google_protobuf_field_mask_pb.FieldMask.AsObject, + someSourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, + someStruct?: google_protobuf_struct_pb.Struct.AsObject, + someTimestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + someType?: google_protobuf_type_pb.Type.AsObject, + someDoubleValue?: google_protobuf_wrappers_pb.DoubleValue.AsObject, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/simple_pb.js b/examples/generated-grpc-native/proto/examplecom/simple_pb.js new file mode 100644 index 0000000..3d14b59 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_pb.js @@ -0,0 +1,892 @@ +// source: proto/examplecom/simple.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var google_protobuf_compiler_plugin_pb = require('google-protobuf/google/protobuf/compiler/plugin_pb.js'); +goog.object.extend(proto, google_protobuf_compiler_plugin_pb); +var google_protobuf_any_pb = require('google-protobuf/google/protobuf/any_pb.js'); +goog.object.extend(proto, google_protobuf_any_pb); +var google_protobuf_api_pb = require('google-protobuf/google/protobuf/api_pb.js'); +goog.object.extend(proto, google_protobuf_api_pb); +var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js'); +goog.object.extend(proto, google_protobuf_descriptor_pb); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +goog.object.extend(proto, google_protobuf_duration_pb); +var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); +goog.object.extend(proto, google_protobuf_empty_pb); +var google_protobuf_field_mask_pb = require('google-protobuf/google/protobuf/field_mask_pb.js'); +goog.object.extend(proto, google_protobuf_field_mask_pb); +var google_protobuf_source_context_pb = require('google-protobuf/google/protobuf/source_context_pb.js'); +goog.object.extend(proto, google_protobuf_source_context_pb); +var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); +goog.object.extend(proto, google_protobuf_struct_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var google_protobuf_type_pb = require('google-protobuf/google/protobuf/type_pb.js'); +goog.object.extend(proto, google_protobuf_type_pb); +var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js'); +goog.object.extend(proto, google_protobuf_wrappers_pb); +goog.exportSymbol('proto.examplecom.MySimple', 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.examplecom.MySimple = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.examplecom.MySimple.repeatedFields_, null); +}; +goog.inherits(proto.examplecom.MySimple, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.MySimple.displayName = 'proto.examplecom.MySimple'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.examplecom.MySimple.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.MySimple.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.MySimple.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.MySimple} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MySimple.toObject = function(includeInstance, msg) { + var f, obj = { + myString: jspb.Message.getFieldWithDefault(msg, 1, ""), + myBool: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + someLabelsList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, + someCodeGeneratorRequest: (f = msg.getSomeCodeGeneratorRequest()) && google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.toObject(includeInstance, f), + someAny: (f = msg.getSomeAny()) && google_protobuf_any_pb.Any.toObject(includeInstance, f), + someMethod: (f = msg.getSomeMethod()) && google_protobuf_api_pb.Method.toObject(includeInstance, f), + someGeneratedCodeInfo: (f = msg.getSomeGeneratedCodeInfo()) && google_protobuf_descriptor_pb.GeneratedCodeInfo.toObject(includeInstance, f), + someDuration: (f = msg.getSomeDuration()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f), + someEmpty: (f = msg.getSomeEmpty()) && google_protobuf_empty_pb.Empty.toObject(includeInstance, f), + someFieldMask: (f = msg.getSomeFieldMask()) && google_protobuf_field_mask_pb.FieldMask.toObject(includeInstance, f), + someSourceContext: (f = msg.getSomeSourceContext()) && google_protobuf_source_context_pb.SourceContext.toObject(includeInstance, f), + someStruct: (f = msg.getSomeStruct()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f), + someTimestamp: (f = msg.getSomeTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + someType: (f = msg.getSomeType()) && google_protobuf_type_pb.Type.toObject(includeInstance, f), + someDoubleValue: (f = msg.getSomeDoubleValue()) && google_protobuf_wrappers_pb.DoubleValue.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.examplecom.MySimple} + */ +proto.examplecom.MySimple.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.MySimple; + return proto.examplecom.MySimple.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.MySimple} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.MySimple} + */ +proto.examplecom.MySimple.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.setMyString(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMyBool(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.addSomeLabels(value); + break; + case 4: + var value = new google_protobuf_compiler_plugin_pb.CodeGeneratorRequest; + reader.readMessage(value,google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.deserializeBinaryFromReader); + msg.setSomeCodeGeneratorRequest(value); + break; + case 5: + var value = new google_protobuf_any_pb.Any; + reader.readMessage(value,google_protobuf_any_pb.Any.deserializeBinaryFromReader); + msg.setSomeAny(value); + break; + case 6: + var value = new google_protobuf_api_pb.Method; + reader.readMessage(value,google_protobuf_api_pb.Method.deserializeBinaryFromReader); + msg.setSomeMethod(value); + break; + case 7: + var value = new google_protobuf_descriptor_pb.GeneratedCodeInfo; + reader.readMessage(value,google_protobuf_descriptor_pb.GeneratedCodeInfo.deserializeBinaryFromReader); + msg.setSomeGeneratedCodeInfo(value); + break; + case 8: + var value = new google_protobuf_duration_pb.Duration; + reader.readMessage(value,google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setSomeDuration(value); + break; + case 9: + var value = new google_protobuf_empty_pb.Empty; + reader.readMessage(value,google_protobuf_empty_pb.Empty.deserializeBinaryFromReader); + msg.setSomeEmpty(value); + break; + case 10: + var value = new google_protobuf_field_mask_pb.FieldMask; + reader.readMessage(value,google_protobuf_field_mask_pb.FieldMask.deserializeBinaryFromReader); + msg.setSomeFieldMask(value); + break; + case 11: + var value = new google_protobuf_source_context_pb.SourceContext; + reader.readMessage(value,google_protobuf_source_context_pb.SourceContext.deserializeBinaryFromReader); + msg.setSomeSourceContext(value); + break; + case 12: + var value = new google_protobuf_struct_pb.Struct; + reader.readMessage(value,google_protobuf_struct_pb.Struct.deserializeBinaryFromReader); + msg.setSomeStruct(value); + break; + case 13: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setSomeTimestamp(value); + break; + case 14: + var value = new google_protobuf_type_pb.Type; + reader.readMessage(value,google_protobuf_type_pb.Type.deserializeBinaryFromReader); + msg.setSomeType(value); + break; + case 15: + var value = new google_protobuf_wrappers_pb.DoubleValue; + reader.readMessage(value,google_protobuf_wrappers_pb.DoubleValue.deserializeBinaryFromReader); + msg.setSomeDoubleValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.MySimple.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.MySimple.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.MySimple} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.MySimple.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getMyBool(); + if (f) { + writer.writeBool( + 2, + f + ); + } + f = message.getSomeLabelsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 3, + f + ); + } + f = message.getSomeCodeGeneratorRequest(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.serializeBinaryToWriter + ); + } + f = message.getSomeAny(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_any_pb.Any.serializeBinaryToWriter + ); + } + f = message.getSomeMethod(); + if (f != null) { + writer.writeMessage( + 6, + f, + google_protobuf_api_pb.Method.serializeBinaryToWriter + ); + } + f = message.getSomeGeneratedCodeInfo(); + if (f != null) { + writer.writeMessage( + 7, + f, + google_protobuf_descriptor_pb.GeneratedCodeInfo.serializeBinaryToWriter + ); + } + f = message.getSomeDuration(); + if (f != null) { + writer.writeMessage( + 8, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } + f = message.getSomeEmpty(); + if (f != null) { + writer.writeMessage( + 9, + f, + google_protobuf_empty_pb.Empty.serializeBinaryToWriter + ); + } + f = message.getSomeFieldMask(); + if (f != null) { + writer.writeMessage( + 10, + f, + google_protobuf_field_mask_pb.FieldMask.serializeBinaryToWriter + ); + } + f = message.getSomeSourceContext(); + if (f != null) { + writer.writeMessage( + 11, + f, + google_protobuf_source_context_pb.SourceContext.serializeBinaryToWriter + ); + } + f = message.getSomeStruct(); + if (f != null) { + writer.writeMessage( + 12, + f, + google_protobuf_struct_pb.Struct.serializeBinaryToWriter + ); + } + f = message.getSomeTimestamp(); + if (f != null) { + writer.writeMessage( + 13, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getSomeType(); + if (f != null) { + writer.writeMessage( + 14, + f, + google_protobuf_type_pb.Type.serializeBinaryToWriter + ); + } + f = message.getSomeDoubleValue(); + if (f != null) { + writer.writeMessage( + 15, + f, + google_protobuf_wrappers_pb.DoubleValue.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string my_string = 1; + * @return {string} + */ +proto.examplecom.MySimple.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bool my_bool = 2; + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.getMyBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.setMyBool = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * repeated string some_labels = 3; + * @return {!Array} + */ +proto.examplecom.MySimple.prototype.getSomeLabelsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.setSomeLabelsList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.addSomeLabels = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeLabelsList = function() { + return this.setSomeLabelsList([]); +}; + + +/** + * optional google.protobuf.compiler.CodeGeneratorRequest some_code_generator_request = 4; + * @return {?proto.google.protobuf.compiler.CodeGeneratorRequest} + */ +proto.examplecom.MySimple.prototype.getSomeCodeGeneratorRequest = function() { + return /** @type{?proto.google.protobuf.compiler.CodeGeneratorRequest} */ ( + jspb.Message.getWrapperField(this, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest, 4)); +}; + + +/** + * @param {?proto.google.protobuf.compiler.CodeGeneratorRequest|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeCodeGeneratorRequest = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeCodeGeneratorRequest = function() { + return this.setSomeCodeGeneratorRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeCodeGeneratorRequest = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional google.protobuf.Any some_any = 5; + * @return {?proto.google.protobuf.Any} + */ +proto.examplecom.MySimple.prototype.getSomeAny = function() { + return /** @type{?proto.google.protobuf.Any} */ ( + jspb.Message.getWrapperField(this, google_protobuf_any_pb.Any, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Any|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeAny = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeAny = function() { + return this.setSomeAny(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeAny = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional google.protobuf.Method some_method = 6; + * @return {?proto.google.protobuf.Method} + */ +proto.examplecom.MySimple.prototype.getSomeMethod = function() { + return /** @type{?proto.google.protobuf.Method} */ ( + jspb.Message.getWrapperField(this, google_protobuf_api_pb.Method, 6)); +}; + + +/** + * @param {?proto.google.protobuf.Method|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeMethod = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeMethod = function() { + return this.setSomeMethod(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeMethod = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional google.protobuf.GeneratedCodeInfo some_generated_code_info = 7; + * @return {?proto.google.protobuf.GeneratedCodeInfo} + */ +proto.examplecom.MySimple.prototype.getSomeGeneratedCodeInfo = function() { + return /** @type{?proto.google.protobuf.GeneratedCodeInfo} */ ( + jspb.Message.getWrapperField(this, google_protobuf_descriptor_pb.GeneratedCodeInfo, 7)); +}; + + +/** + * @param {?proto.google.protobuf.GeneratedCodeInfo|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeGeneratedCodeInfo = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeGeneratedCodeInfo = function() { + return this.setSomeGeneratedCodeInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeGeneratedCodeInfo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional google.protobuf.Duration some_duration = 8; + * @return {?proto.google.protobuf.Duration} + */ +proto.examplecom.MySimple.prototype.getSomeDuration = function() { + return /** @type{?proto.google.protobuf.Duration} */ ( + jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 8)); +}; + + +/** + * @param {?proto.google.protobuf.Duration|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeDuration = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeDuration = function() { + return this.setSomeDuration(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeDuration = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional google.protobuf.Empty some_empty = 9; + * @return {?proto.google.protobuf.Empty} + */ +proto.examplecom.MySimple.prototype.getSomeEmpty = function() { + return /** @type{?proto.google.protobuf.Empty} */ ( + jspb.Message.getWrapperField(this, google_protobuf_empty_pb.Empty, 9)); +}; + + +/** + * @param {?proto.google.protobuf.Empty|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeEmpty = function(value) { + return jspb.Message.setWrapperField(this, 9, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeEmpty = function() { + return this.setSomeEmpty(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeEmpty = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional google.protobuf.FieldMask some_field_mask = 10; + * @return {?proto.google.protobuf.FieldMask} + */ +proto.examplecom.MySimple.prototype.getSomeFieldMask = function() { + return /** @type{?proto.google.protobuf.FieldMask} */ ( + jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 10)); +}; + + +/** + * @param {?proto.google.protobuf.FieldMask|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeFieldMask = function(value) { + return jspb.Message.setWrapperField(this, 10, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeFieldMask = function() { + return this.setSomeFieldMask(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeFieldMask = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional google.protobuf.SourceContext some_source_context = 11; + * @return {?proto.google.protobuf.SourceContext} + */ +proto.examplecom.MySimple.prototype.getSomeSourceContext = function() { + return /** @type{?proto.google.protobuf.SourceContext} */ ( + jspb.Message.getWrapperField(this, google_protobuf_source_context_pb.SourceContext, 11)); +}; + + +/** + * @param {?proto.google.protobuf.SourceContext|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeSourceContext = function(value) { + return jspb.Message.setWrapperField(this, 11, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeSourceContext = function() { + return this.setSomeSourceContext(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeSourceContext = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional google.protobuf.Struct some_struct = 12; + * @return {?proto.google.protobuf.Struct} + */ +proto.examplecom.MySimple.prototype.getSomeStruct = function() { + return /** @type{?proto.google.protobuf.Struct} */ ( + jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 12)); +}; + + +/** + * @param {?proto.google.protobuf.Struct|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeStruct = function(value) { + return jspb.Message.setWrapperField(this, 12, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeStruct = function() { + return this.setSomeStruct(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeStruct = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * optional google.protobuf.Timestamp some_timestamp = 13; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.examplecom.MySimple.prototype.getSomeTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 13)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 13, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeTimestamp = function() { + return this.setSomeTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeTimestamp = function() { + return jspb.Message.getField(this, 13) != null; +}; + + +/** + * optional google.protobuf.Type some_type = 14; + * @return {?proto.google.protobuf.Type} + */ +proto.examplecom.MySimple.prototype.getSomeType = function() { + return /** @type{?proto.google.protobuf.Type} */ ( + jspb.Message.getWrapperField(this, google_protobuf_type_pb.Type, 14)); +}; + + +/** + * @param {?proto.google.protobuf.Type|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeType = function(value) { + return jspb.Message.setWrapperField(this, 14, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeType = function() { + return this.setSomeType(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeType = function() { + return jspb.Message.getField(this, 14) != null; +}; + + +/** + * optional google.protobuf.DoubleValue some_double_value = 15; + * @return {?proto.google.protobuf.DoubleValue} + */ +proto.examplecom.MySimple.prototype.getSomeDoubleValue = function() { + return /** @type{?proto.google.protobuf.DoubleValue} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.DoubleValue, 15)); +}; + + +/** + * @param {?proto.google.protobuf.DoubleValue|undefined} value + * @return {!proto.examplecom.MySimple} returns this +*/ +proto.examplecom.MySimple.prototype.setSomeDoubleValue = function(value) { + return jspb.Message.setWrapperField(this, 15, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.MySimple} returns this + */ +proto.examplecom.MySimple.prototype.clearSomeDoubleValue = function() { + return this.setSomeDoubleValue(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.MySimple.prototype.hasSomeDoubleValue = function() { + return jspb.Message.getField(this, 15) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/simple_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/simple_pb_service.d.ts new file mode 100644 index 0000000..82de7c0 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/simple.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/simple_pb_service.js b/examples/generated-grpc-native/proto/examplecom/simple_pb_service.js new file mode 100644 index 0000000..82de7c0 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/simple.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/simple_service_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/simple_service_pb.d.ts new file mode 100644 index 0000000..3f35e95 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_service_pb.d.ts @@ -0,0 +1,70 @@ +// package: examplecom +// file: proto/examplecom/simple_service.proto + +import * as jspb from "google-protobuf"; +import * as proto_othercom_external_child_message_pb from "../../proto/othercom/external_child_message_pb"; +import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +export class UnaryRequest extends jspb.Message { + getSomeInt64(): number; + setSomeInt64(value: number): void; + + hasSomeTimestamp(): boolean; + clearSomeTimestamp(): void; + getSomeTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setSomeTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UnaryRequest.AsObject; + static toObject(includeInstance: boolean, msg: UnaryRequest): UnaryRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UnaryRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UnaryRequest; + static deserializeBinaryFromReader(message: UnaryRequest, reader: jspb.BinaryReader): UnaryRequest; +} + +export namespace UnaryRequest { + export type AsObject = { + someInt64: number, + someTimestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + } +} + +export class UnaryResponse extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UnaryResponse.AsObject; + static toObject(includeInstance: boolean, msg: UnaryResponse): UnaryResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UnaryResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UnaryResponse; + static deserializeBinaryFromReader(message: UnaryResponse, reader: jspb.BinaryReader): UnaryResponse; +} + +export namespace UnaryResponse { + export type AsObject = { + } +} + +export class StreamRequest extends jspb.Message { + getSomeString(): string; + setSomeString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StreamRequest.AsObject; + static toObject(includeInstance: boolean, msg: StreamRequest): StreamRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StreamRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StreamRequest; + static deserializeBinaryFromReader(message: StreamRequest, reader: jspb.BinaryReader): StreamRequest; +} + +export namespace StreamRequest { + export type AsObject = { + someString: string, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/simple_service_pb.js b/examples/generated-grpc-native/proto/examplecom/simple_service_pb.js new file mode 100644 index 0000000..4189c98 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_service_pb.js @@ -0,0 +1,502 @@ +// source: proto/examplecom/simple_service.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var proto_othercom_external_child_message_pb = require('../../proto/othercom/external_child_message_pb.js'); +goog.object.extend(proto, proto_othercom_external_child_message_pb); +var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); +goog.object.extend(proto, google_protobuf_empty_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +goog.exportSymbol('proto.examplecom.StreamRequest', null, global); +goog.exportSymbol('proto.examplecom.UnaryRequest', null, global); +goog.exportSymbol('proto.examplecom.UnaryResponse', 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.examplecom.UnaryRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.UnaryRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.UnaryRequest.displayName = 'proto.examplecom.UnaryRequest'; +} +/** + * 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.examplecom.UnaryResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.UnaryResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.UnaryResponse.displayName = 'proto.examplecom.UnaryResponse'; +} +/** + * 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.examplecom.StreamRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.StreamRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.StreamRequest.displayName = 'proto.examplecom.StreamRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.UnaryRequest.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.UnaryRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.UnaryRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.UnaryRequest.toObject = function(includeInstance, msg) { + var f, obj = { + someInt64: jspb.Message.getFieldWithDefault(msg, 1, 0), + someTimestamp: (f = msg.getSomeTimestamp()) && google_protobuf_timestamp_pb.Timestamp.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.examplecom.UnaryRequest} + */ +proto.examplecom.UnaryRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.UnaryRequest; + return proto.examplecom.UnaryRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.UnaryRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.UnaryRequest} + */ +proto.examplecom.UnaryRequest.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.setSomeInt64(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setSomeTimestamp(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.UnaryRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.UnaryRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.UnaryRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.UnaryRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSomeInt64(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getSomeTimestamp(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * optional int64 some_int64 = 1; + * @return {number} + */ +proto.examplecom.UnaryRequest.prototype.getSomeInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.UnaryRequest} returns this + */ +proto.examplecom.UnaryRequest.prototype.setSomeInt64 = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional google.protobuf.Timestamp some_timestamp = 2; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.examplecom.UnaryRequest.prototype.getSomeTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.examplecom.UnaryRequest} returns this +*/ +proto.examplecom.UnaryRequest.prototype.setSomeTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.UnaryRequest} returns this + */ +proto.examplecom.UnaryRequest.prototype.clearSomeTimestamp = function() { + return this.setSomeTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.UnaryRequest.prototype.hasSomeTimestamp = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.UnaryResponse.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.UnaryResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.UnaryResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.UnaryResponse.toObject = function(includeInstance, msg) { + var f, 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.examplecom.UnaryResponse} + */ +proto.examplecom.UnaryResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.UnaryResponse; + return proto.examplecom.UnaryResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.UnaryResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.UnaryResponse} + */ +proto.examplecom.UnaryResponse.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.examplecom.UnaryResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.UnaryResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.UnaryResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.UnaryResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.StreamRequest.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.StreamRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.StreamRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.StreamRequest.toObject = function(includeInstance, msg) { + var f, obj = { + someString: 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.examplecom.StreamRequest} + */ +proto.examplecom.StreamRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.StreamRequest; + return proto.examplecom.StreamRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.StreamRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.StreamRequest} + */ +proto.examplecom.StreamRequest.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.setSomeString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.StreamRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.StreamRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.StreamRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.StreamRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSomeString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string some_string = 1; + * @return {string} + */ +proto.examplecom.StreamRequest.prototype.getSomeString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.StreamRequest} returns this + */ +proto.examplecom.StreamRequest.prototype.setSomeString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/simple_service_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/simple_service_pb_service.d.ts new file mode 100644 index 0000000..4153a03 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_service_pb_service.d.ts @@ -0,0 +1,121 @@ +// package: examplecom +// file: proto/examplecom/simple_service.proto + +import * as proto_examplecom_simple_service_pb from "../../proto/examplecom/simple_service_pb"; +import * as proto_othercom_external_child_message_pb from "../../proto/othercom/external_child_message_pb"; +import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb"; +import {grpc} from "@improbable-eng/grpc-web"; +import {ReactNativeTransport} from "@improbable-eng/grpc-web-react-native-transport"; + +// @ts-ignore +grpc.setDefaultTransport(ReactNativeTransport(false)); + +type SimpleServiceDoUnary = { + readonly methodName: string; + readonly service: typeof SimpleService; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof proto_examplecom_simple_service_pb.UnaryRequest; + readonly responseType: typeof proto_othercom_external_child_message_pb.ExternalChildMessage; +}; + +type SimpleServiceDoServerStream = { + readonly methodName: string; + readonly service: typeof SimpleService; + readonly requestStream: false; + readonly responseStream: true; + readonly requestType: typeof proto_examplecom_simple_service_pb.StreamRequest; + readonly responseType: typeof proto_othercom_external_child_message_pb.ExternalChildMessage; +}; + +type SimpleServiceDoClientStream = { + readonly methodName: string; + readonly service: typeof SimpleService; + readonly requestStream: true; + readonly responseStream: false; + readonly requestType: typeof proto_examplecom_simple_service_pb.StreamRequest; + readonly responseType: typeof google_protobuf_empty_pb.Empty; +}; + +type SimpleServiceDoBidiStream = { + readonly methodName: string; + readonly service: typeof SimpleService; + readonly requestStream: true; + readonly responseStream: true; + readonly requestType: typeof proto_examplecom_simple_service_pb.StreamRequest; + readonly responseType: typeof proto_othercom_external_child_message_pb.ExternalChildMessage; +}; + +type SimpleServiceDelete = { + readonly methodName: string; + readonly service: typeof SimpleService; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof proto_examplecom_simple_service_pb.UnaryRequest; + readonly responseType: typeof proto_examplecom_simple_service_pb.UnaryResponse; +}; + +export class SimpleService { + static readonly serviceName: string; + static readonly DoUnary: SimpleServiceDoUnary; + static readonly DoServerStream: SimpleServiceDoServerStream; + static readonly DoClientStream: SimpleServiceDoClientStream; + static readonly DoBidiStream: SimpleServiceDoBidiStream; + static readonly Delete: SimpleServiceDelete; +} + +export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } +export type Status = { details: string, code: number; metadata: grpc.Metadata } + +interface UnaryResponse { + cancel(): void; +} +interface ResponseStream { + cancel(): void; + on(type: 'data', handler: (message: T) => void): ResponseStream; + on(type: 'end', handler: (status?: Status) => void): ResponseStream; + on(type: 'status', handler: (status: Status) => void): ResponseStream; +} +interface RequestStream { + write(message: T): RequestStream; + end(): void; + cancel(): void; + on(type: 'end', handler: (status?: Status) => void): RequestStream; + on(type: 'status', handler: (status: Status) => void): RequestStream; +} +interface BidirectionalStream { + write(message: ReqT): BidirectionalStream; + end(): void; + cancel(): void; + on(type: 'data', handler: (message: ResT) => void): BidirectionalStream; + on(type: 'end', handler: (status?: Status) => void): BidirectionalStream; + on(type: 'status', handler: (status: Status) => void): BidirectionalStream; +} + +export class SimpleServiceClient { + readonly serviceHost: string; + + constructor(serviceHost: string, options?: grpc.RpcOptions); + doUnary( + requestMessage: proto_examplecom_simple_service_pb.UnaryRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: proto_othercom_external_child_message_pb.ExternalChildMessage|null) => void + ): UnaryResponse; + doUnary( + requestMessage: proto_examplecom_simple_service_pb.UnaryRequest, + callback: (error: ServiceError|null, responseMessage: proto_othercom_external_child_message_pb.ExternalChildMessage|null) => void + ): UnaryResponse; + doServerStream(requestMessage: proto_examplecom_simple_service_pb.StreamRequest, metadata?: grpc.Metadata): ResponseStream; + doClientStream(metadata?: grpc.Metadata): RequestStream; + doBidiStream(metadata?: grpc.Metadata): BidirectionalStream; + delete( + requestMessage: proto_examplecom_simple_service_pb.UnaryRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: proto_examplecom_simple_service_pb.UnaryResponse|null) => void + ): UnaryResponse; + delete( + requestMessage: proto_examplecom_simple_service_pb.UnaryRequest, + callback: (error: ServiceError|null, responseMessage: proto_examplecom_simple_service_pb.UnaryResponse|null) => void + ): UnaryResponse; +} + diff --git a/examples/generated-grpc-native/proto/examplecom/simple_service_pb_service.js b/examples/generated-grpc-native/proto/examplecom/simple_service_pb_service.js new file mode 100644 index 0000000..4915b72 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simple_service_pb_service.js @@ -0,0 +1,258 @@ +// package: examplecom +// file: proto/examplecom/simple_service.proto + +var proto_examplecom_simple_service_pb = require("../../proto/examplecom/simple_service_pb"); +var proto_othercom_external_child_message_pb = require("../../proto/othercom/external_child_message_pb"); +var google_protobuf_empty_pb = require("google-protobuf/google/protobuf/empty_pb"); +var grpc = require("@improbable-eng/grpc-web").grpc; +var ReactNativeTransport = require("@improbable-eng/grpc-web-react-native-transport").ReactNativeTransport + +grpc.setDefaultTransport(ReactNativeTransport(false)); + +var SimpleService = (function () { + function SimpleService() {} + SimpleService.serviceName = "examplecom.SimpleService"; + return SimpleService; +}()); + +SimpleService.DoUnary = { + methodName: "DoUnary", + service: SimpleService, + requestStream: false, + responseStream: false, + requestType: proto_examplecom_simple_service_pb.UnaryRequest, + responseType: proto_othercom_external_child_message_pb.ExternalChildMessage +}; + +SimpleService.DoServerStream = { + methodName: "DoServerStream", + service: SimpleService, + requestStream: false, + responseStream: true, + requestType: proto_examplecom_simple_service_pb.StreamRequest, + responseType: proto_othercom_external_child_message_pb.ExternalChildMessage +}; + +SimpleService.DoClientStream = { + methodName: "DoClientStream", + service: SimpleService, + requestStream: true, + responseStream: false, + requestType: proto_examplecom_simple_service_pb.StreamRequest, + responseType: google_protobuf_empty_pb.Empty +}; + +SimpleService.DoBidiStream = { + methodName: "DoBidiStream", + service: SimpleService, + requestStream: true, + responseStream: true, + requestType: proto_examplecom_simple_service_pb.StreamRequest, + responseType: proto_othercom_external_child_message_pb.ExternalChildMessage +}; + +SimpleService.Delete = { + methodName: "Delete", + service: SimpleService, + requestStream: false, + responseStream: false, + requestType: proto_examplecom_simple_service_pb.UnaryRequest, + responseType: proto_examplecom_simple_service_pb.UnaryResponse +}; + +exports.SimpleService = SimpleService; + +function SimpleServiceClient(serviceHost, options) { + this.serviceHost = serviceHost; + this.options = options || {}; +} + +SimpleServiceClient.prototype.doUnary = function doUnary(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SimpleService.DoUnary, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SimpleServiceClient.prototype.doServerStream = function doServerStream(requestMessage, metadata) { + var listeners = { + data: [], + end: [], + status: [] + }; + var client = grpc.invoke(SimpleService.DoServerStream, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onMessage: function (responseMessage) { + listeners.data.forEach(function (handler) { + handler(responseMessage); + }); + }, + onEnd: function (status, statusMessage, trailers) { + listeners.status.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners.end.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners = null; + } + }); + return { + on: function (type, handler) { + listeners[type].push(handler); + return this; + }, + cancel: function () { + listeners = null; + client.close(); + } + }; +}; + +SimpleServiceClient.prototype.doClientStream = function doClientStream(metadata) { + var listeners = { + end: [], + status: [] + }; + var client = grpc.client(SimpleService.DoClientStream, { + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport + }); + client.onEnd(function (status, statusMessage, trailers) { + listeners.status.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners.end.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners = null; + }); + return { + on: function (type, handler) { + listeners[type].push(handler); + return this; + }, + write: function (requestMessage) { + if (!client.started) { + client.start(metadata); + } + client.send(requestMessage); + return this; + }, + end: function () { + client.finishSend(); + }, + cancel: function () { + listeners = null; + client.close(); + } + }; +}; + +SimpleServiceClient.prototype.doBidiStream = function doBidiStream(metadata) { + var listeners = { + data: [], + end: [], + status: [] + }; + var client = grpc.client(SimpleService.DoBidiStream, { + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport + }); + client.onEnd(function (status, statusMessage, trailers) { + listeners.status.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners.end.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners = null; + }); + client.onMessage(function (message) { + listeners.data.forEach(function (handler) { + handler(message); + }) + }); + client.start(metadata); + return { + on: function (type, handler) { + listeners[type].push(handler); + return this; + }, + write: function (requestMessage) { + client.send(requestMessage); + return this; + }, + end: function () { + client.finishSend(); + }, + cancel: function () { + listeners = null; + client.close(); + } + }; +}; + +SimpleServiceClient.prototype.delete = function pb_delete(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SimpleService.Delete, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +exports.SimpleServiceClient = SimpleServiceClient; + diff --git a/examples/generated-grpc-native/proto/examplecom/simplevalue_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb.d.ts new file mode 100644 index 0000000..79da301 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb.d.ts @@ -0,0 +1,81 @@ +// package: examplecom +// file: proto/examplecom/simplevalue.proto + +import * as jspb from "google-protobuf"; + +export class SimpleValue extends jspb.Message { + getFirstField(): string; + setFirstField(value: string): void; + + getSecondField(): number; + setSecondField(value: number): void; + + hasNumberValue(): boolean; + clearNumberValue(): void; + getNumberValue(): number; + setNumberValue(value: number): void; + + hasStringValue(): boolean; + clearStringValue(): void; + getStringValue(): string; + setStringValue(value: string): void; + + hasBoolValue(): boolean; + clearBoolValue(): void; + getBoolValue(): boolean; + setBoolValue(value: boolean): void; + + hasNumber2Value(): boolean; + clearNumber2Value(): void; + getNumber2Value(): number; + setNumber2Value(value: number): void; + + hasString2Value(): boolean; + clearString2Value(): void; + getString2Value(): string; + setString2Value(value: string): void; + + hasBool2Value(): boolean; + clearBool2Value(): void; + getBool2Value(): boolean; + setBool2Value(value: boolean): void; + + getKindCase(): SimpleValue.KindCase; + getAnotherCase(): SimpleValue.AnotherCase; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SimpleValue.AsObject; + static toObject(includeInstance: boolean, msg: SimpleValue): SimpleValue.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SimpleValue, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SimpleValue; + static deserializeBinaryFromReader(message: SimpleValue, reader: jspb.BinaryReader): SimpleValue; +} + +export namespace SimpleValue { + export type AsObject = { + firstField: string, + secondField: number, + numberValue: number, + stringValue: string, + boolValue: boolean, + number2Value: number, + string2Value: string, + bool2Value: boolean, + } + + export enum KindCase { + KIND_NOT_SET = 0, + NUMBER_VALUE = 3, + STRING_VALUE = 6, + BOOL_VALUE = 8, + } + + export enum AnotherCase { + ANOTHER_NOT_SET = 0, + NUMBER2_VALUE = 4, + STRING2_VALUE = 5, + BOOL2_VALUE = 7, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/simplevalue_pb.js b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb.js new file mode 100644 index 0000000..9a48a0c --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb.js @@ -0,0 +1,534 @@ +// source: proto/examplecom/simplevalue.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.examplecom.SimpleValue', null, global); +goog.exportSymbol('proto.examplecom.SimpleValue.AnotherCase', null, global); +goog.exportSymbol('proto.examplecom.SimpleValue.KindCase', 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.examplecom.SimpleValue = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, proto.examplecom.SimpleValue.oneofGroups_); +}; +goog.inherits(proto.examplecom.SimpleValue, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.SimpleValue.displayName = 'proto.examplecom.SimpleValue'; +} + +/** + * 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.examplecom.SimpleValue.oneofGroups_ = [[3,6,8],[4,5,7]]; + +/** + * @enum {number} + */ +proto.examplecom.SimpleValue.KindCase = { + KIND_NOT_SET: 0, + NUMBER_VALUE: 3, + STRING_VALUE: 6, + BOOL_VALUE: 8 +}; + +/** + * @return {proto.examplecom.SimpleValue.KindCase} + */ +proto.examplecom.SimpleValue.prototype.getKindCase = function() { + return /** @type {proto.examplecom.SimpleValue.KindCase} */(jspb.Message.computeOneofCase(this, proto.examplecom.SimpleValue.oneofGroups_[0])); +}; + +/** + * @enum {number} + */ +proto.examplecom.SimpleValue.AnotherCase = { + ANOTHER_NOT_SET: 0, + NUMBER2_VALUE: 4, + STRING2_VALUE: 5, + BOOL2_VALUE: 7 +}; + +/** + * @return {proto.examplecom.SimpleValue.AnotherCase} + */ +proto.examplecom.SimpleValue.prototype.getAnotherCase = function() { + return /** @type {proto.examplecom.SimpleValue.AnotherCase} */(jspb.Message.computeOneofCase(this, proto.examplecom.SimpleValue.oneofGroups_[1])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.SimpleValue.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.SimpleValue.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.SimpleValue} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.SimpleValue.toObject = function(includeInstance, msg) { + var f, obj = { + firstField: jspb.Message.getFieldWithDefault(msg, 1, ""), + secondField: jspb.Message.getFieldWithDefault(msg, 2, 0), + numberValue: jspb.Message.getFloatingPointFieldWithDefault(msg, 3, 0.0), + stringValue: jspb.Message.getFieldWithDefault(msg, 6, ""), + boolValue: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + number2Value: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 0.0), + string2Value: jspb.Message.getFieldWithDefault(msg, 5, ""), + bool2Value: jspb.Message.getBooleanFieldWithDefault(msg, 7, 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.examplecom.SimpleValue} + */ +proto.examplecom.SimpleValue.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.SimpleValue; + return proto.examplecom.SimpleValue.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.SimpleValue} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.SimpleValue} + */ +proto.examplecom.SimpleValue.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.setFirstField(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setSecondField(value); + break; + case 3: + var value = /** @type {number} */ (reader.readDouble()); + msg.setNumberValue(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setStringValue(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBoolValue(value); + break; + case 4: + var value = /** @type {number} */ (reader.readDouble()); + msg.setNumber2Value(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setString2Value(value); + break; + case 7: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBool2Value(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.SimpleValue.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.SimpleValue.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.SimpleValue} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.SimpleValue.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFirstField(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getSecondField(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeDouble( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeString( + 6, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBool( + 8, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeDouble( + 4, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeString( + 5, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeBool( + 7, + f + ); + } +}; + + +/** + * optional string first_field = 1; + * @return {string} + */ +proto.examplecom.SimpleValue.prototype.getFirstField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setFirstField = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional int64 second_field = 2; + * @return {number} + */ +proto.examplecom.SimpleValue.prototype.getSecondField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setSecondField = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional double number_value = 3; + * @return {number} + */ +proto.examplecom.SimpleValue.prototype.getNumberValue = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 3, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setNumberValue = function(value) { + return jspb.Message.setOneofField(this, 3, proto.examplecom.SimpleValue.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.clearNumberValue = function() { + return jspb.Message.setOneofField(this, 3, proto.examplecom.SimpleValue.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.hasNumberValue = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string string_value = 6; + * @return {string} + */ +proto.examplecom.SimpleValue.prototype.getStringValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setStringValue = function(value) { + return jspb.Message.setOneofField(this, 6, proto.examplecom.SimpleValue.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.clearStringValue = function() { + return jspb.Message.setOneofField(this, 6, proto.examplecom.SimpleValue.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.hasStringValue = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bool bool_value = 8; + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.getBoolValue = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setBoolValue = function(value) { + return jspb.Message.setOneofField(this, 8, proto.examplecom.SimpleValue.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.clearBoolValue = function() { + return jspb.Message.setOneofField(this, 8, proto.examplecom.SimpleValue.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.hasBoolValue = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional double number2_value = 4; + * @return {number} + */ +proto.examplecom.SimpleValue.prototype.getNumber2Value = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setNumber2Value = function(value) { + return jspb.Message.setOneofField(this, 4, proto.examplecom.SimpleValue.oneofGroups_[1], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.clearNumber2Value = function() { + return jspb.Message.setOneofField(this, 4, proto.examplecom.SimpleValue.oneofGroups_[1], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.hasNumber2Value = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional string string2_value = 5; + * @return {string} + */ +proto.examplecom.SimpleValue.prototype.getString2Value = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setString2Value = function(value) { + return jspb.Message.setOneofField(this, 5, proto.examplecom.SimpleValue.oneofGroups_[1], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.clearString2Value = function() { + return jspb.Message.setOneofField(this, 5, proto.examplecom.SimpleValue.oneofGroups_[1], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.hasString2Value = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional bool bool2_value = 7; + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.getBool2Value = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.setBool2Value = function(value) { + return jspb.Message.setOneofField(this, 7, proto.examplecom.SimpleValue.oneofGroups_[1], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.examplecom.SimpleValue} returns this + */ +proto.examplecom.SimpleValue.prototype.clearBool2Value = function() { + return jspb.Message.setOneofField(this, 7, proto.examplecom.SimpleValue.oneofGroups_[1], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.SimpleValue.prototype.hasBool2Value = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/simplevalue_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb_service.d.ts new file mode 100644 index 0000000..5d3f2d5 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/simplevalue.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/simplevalue_pb_service.js b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb_service.js new file mode 100644 index 0000000..5d3f2d5 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/simplevalue_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/simplevalue.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/well_known_message_pb.d.ts b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb.d.ts new file mode 100644 index 0000000..a970a7e --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb.d.ts @@ -0,0 +1,105 @@ +// package: examplecom +// file: proto/examplecom/well_known_message.proto + +import * as jspb from "google-protobuf"; +import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb"; +import * as google_protobuf_api_pb from "google-protobuf/google/protobuf/api_pb"; +import * as google_protobuf_compiler_plugin_pb from "google-protobuf/google/protobuf/compiler/plugin_pb"; +import * as google_protobuf_descriptor_pb from "google-protobuf/google/protobuf/descriptor_pb"; +import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb"; +import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb"; +import * as google_protobuf_field_mask_pb from "google-protobuf/google/protobuf/field_mask_pb"; +import * as google_protobuf_source_context_pb from "google-protobuf/google/protobuf/source_context_pb"; +import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; +import * as google_protobuf_type_pb from "google-protobuf/google/protobuf/type_pb"; +import * as google_protobuf_wrappers_pb from "google-protobuf/google/protobuf/wrappers_pb"; + +export class WellKnownMessage extends jspb.Message { + hasMyCodeGeneratorRequest(): boolean; + clearMyCodeGeneratorRequest(): void; + getMyCodeGeneratorRequest(): google_protobuf_compiler_plugin_pb.CodeGeneratorRequest | undefined; + setMyCodeGeneratorRequest(value?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest): void; + + hasMyAny(): boolean; + clearMyAny(): void; + getMyAny(): google_protobuf_any_pb.Any | undefined; + setMyAny(value?: google_protobuf_any_pb.Any): void; + + hasMyMethod(): boolean; + clearMyMethod(): void; + getMyMethod(): google_protobuf_api_pb.Method | undefined; + setMyMethod(value?: google_protobuf_api_pb.Method): void; + + hasMyGeneratedCodeInfo(): boolean; + clearMyGeneratedCodeInfo(): void; + getMyGeneratedCodeInfo(): google_protobuf_descriptor_pb.GeneratedCodeInfo | undefined; + setMyGeneratedCodeInfo(value?: google_protobuf_descriptor_pb.GeneratedCodeInfo): void; + + hasMyDuration(): boolean; + clearMyDuration(): void; + getMyDuration(): google_protobuf_duration_pb.Duration | undefined; + setMyDuration(value?: google_protobuf_duration_pb.Duration): void; + + hasMyEmpty(): boolean; + clearMyEmpty(): void; + getMyEmpty(): google_protobuf_empty_pb.Empty | undefined; + setMyEmpty(value?: google_protobuf_empty_pb.Empty): void; + + hasMyFieldMask(): boolean; + clearMyFieldMask(): void; + getMyFieldMask(): google_protobuf_field_mask_pb.FieldMask | undefined; + setMyFieldMask(value?: google_protobuf_field_mask_pb.FieldMask): void; + + hasMySourceContext(): boolean; + clearMySourceContext(): void; + getMySourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; + setMySourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; + + hasMyStruct(): boolean; + clearMyStruct(): void; + getMyStruct(): google_protobuf_struct_pb.Struct | undefined; + setMyStruct(value?: google_protobuf_struct_pb.Struct): void; + + hasMyTimestamp(): boolean; + clearMyTimestamp(): void; + getMyTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined; + setMyTimestamp(value?: google_protobuf_timestamp_pb.Timestamp): void; + + hasMyType(): boolean; + clearMyType(): void; + getMyType(): google_protobuf_type_pb.Type | undefined; + setMyType(value?: google_protobuf_type_pb.Type): void; + + hasMyDoubleValue(): boolean; + clearMyDoubleValue(): void; + getMyDoubleValue(): google_protobuf_wrappers_pb.DoubleValue | undefined; + setMyDoubleValue(value?: google_protobuf_wrappers_pb.DoubleValue): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WellKnownMessage.AsObject; + static toObject(includeInstance: boolean, msg: WellKnownMessage): WellKnownMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WellKnownMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WellKnownMessage; + static deserializeBinaryFromReader(message: WellKnownMessage, reader: jspb.BinaryReader): WellKnownMessage; +} + +export namespace WellKnownMessage { + export type AsObject = { + myCodeGeneratorRequest?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.AsObject, + myAny?: google_protobuf_any_pb.Any.AsObject, + myMethod?: google_protobuf_api_pb.Method.AsObject, + myGeneratedCodeInfo?: google_protobuf_descriptor_pb.GeneratedCodeInfo.AsObject, + myDuration?: google_protobuf_duration_pb.Duration.AsObject, + myEmpty?: google_protobuf_empty_pb.Empty.AsObject, + myFieldMask?: google_protobuf_field_mask_pb.FieldMask.AsObject, + mySourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, + myStruct?: google_protobuf_struct_pb.Struct.AsObject, + myTimestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject, + myType?: google_protobuf_type_pb.Type.AsObject, + myDoubleValue?: google_protobuf_wrappers_pb.DoubleValue.AsObject, + } +} + diff --git a/examples/generated-grpc-native/proto/examplecom/well_known_message_pb.js b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb.js new file mode 100644 index 0000000..4c80ad0 --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb.js @@ -0,0 +1,776 @@ +// source: proto/examplecom/well_known_message.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var google_protobuf_any_pb = require('google-protobuf/google/protobuf/any_pb.js'); +goog.object.extend(proto, google_protobuf_any_pb); +var google_protobuf_api_pb = require('google-protobuf/google/protobuf/api_pb.js'); +goog.object.extend(proto, google_protobuf_api_pb); +var google_protobuf_compiler_plugin_pb = require('google-protobuf/google/protobuf/compiler/plugin_pb.js'); +goog.object.extend(proto, google_protobuf_compiler_plugin_pb); +var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js'); +goog.object.extend(proto, google_protobuf_descriptor_pb); +var google_protobuf_duration_pb = require('google-protobuf/google/protobuf/duration_pb.js'); +goog.object.extend(proto, google_protobuf_duration_pb); +var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); +goog.object.extend(proto, google_protobuf_empty_pb); +var google_protobuf_field_mask_pb = require('google-protobuf/google/protobuf/field_mask_pb.js'); +goog.object.extend(proto, google_protobuf_field_mask_pb); +var google_protobuf_source_context_pb = require('google-protobuf/google/protobuf/source_context_pb.js'); +goog.object.extend(proto, google_protobuf_source_context_pb); +var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); +goog.object.extend(proto, google_protobuf_struct_pb); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +var google_protobuf_type_pb = require('google-protobuf/google/protobuf/type_pb.js'); +goog.object.extend(proto, google_protobuf_type_pb); +var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js'); +goog.object.extend(proto, google_protobuf_wrappers_pb); +goog.exportSymbol('proto.examplecom.WellKnownMessage', 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.examplecom.WellKnownMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.examplecom.WellKnownMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.examplecom.WellKnownMessage.displayName = 'proto.examplecom.WellKnownMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.examplecom.WellKnownMessage.prototype.toObject = function(opt_includeInstance) { + return proto.examplecom.WellKnownMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.examplecom.WellKnownMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.WellKnownMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myCodeGeneratorRequest: (f = msg.getMyCodeGeneratorRequest()) && google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.toObject(includeInstance, f), + myAny: (f = msg.getMyAny()) && google_protobuf_any_pb.Any.toObject(includeInstance, f), + myMethod: (f = msg.getMyMethod()) && google_protobuf_api_pb.Method.toObject(includeInstance, f), + myGeneratedCodeInfo: (f = msg.getMyGeneratedCodeInfo()) && google_protobuf_descriptor_pb.GeneratedCodeInfo.toObject(includeInstance, f), + myDuration: (f = msg.getMyDuration()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f), + myEmpty: (f = msg.getMyEmpty()) && google_protobuf_empty_pb.Empty.toObject(includeInstance, f), + myFieldMask: (f = msg.getMyFieldMask()) && google_protobuf_field_mask_pb.FieldMask.toObject(includeInstance, f), + mySourceContext: (f = msg.getMySourceContext()) && google_protobuf_source_context_pb.SourceContext.toObject(includeInstance, f), + myStruct: (f = msg.getMyStruct()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f), + myTimestamp: (f = msg.getMyTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + myType: (f = msg.getMyType()) && google_protobuf_type_pb.Type.toObject(includeInstance, f), + myDoubleValue: (f = msg.getMyDoubleValue()) && google_protobuf_wrappers_pb.DoubleValue.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.examplecom.WellKnownMessage} + */ +proto.examplecom.WellKnownMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.examplecom.WellKnownMessage; + return proto.examplecom.WellKnownMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.examplecom.WellKnownMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.examplecom.WellKnownMessage} + */ +proto.examplecom.WellKnownMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new google_protobuf_compiler_plugin_pb.CodeGeneratorRequest; + reader.readMessage(value,google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.deserializeBinaryFromReader); + msg.setMyCodeGeneratorRequest(value); + break; + case 2: + var value = new google_protobuf_any_pb.Any; + reader.readMessage(value,google_protobuf_any_pb.Any.deserializeBinaryFromReader); + msg.setMyAny(value); + break; + case 3: + var value = new google_protobuf_api_pb.Method; + reader.readMessage(value,google_protobuf_api_pb.Method.deserializeBinaryFromReader); + msg.setMyMethod(value); + break; + case 4: + var value = new google_protobuf_descriptor_pb.GeneratedCodeInfo; + reader.readMessage(value,google_protobuf_descriptor_pb.GeneratedCodeInfo.deserializeBinaryFromReader); + msg.setMyGeneratedCodeInfo(value); + break; + case 5: + var value = new google_protobuf_duration_pb.Duration; + reader.readMessage(value,google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setMyDuration(value); + break; + case 6: + var value = new google_protobuf_empty_pb.Empty; + reader.readMessage(value,google_protobuf_empty_pb.Empty.deserializeBinaryFromReader); + msg.setMyEmpty(value); + break; + case 7: + var value = new google_protobuf_field_mask_pb.FieldMask; + reader.readMessage(value,google_protobuf_field_mask_pb.FieldMask.deserializeBinaryFromReader); + msg.setMyFieldMask(value); + break; + case 8: + var value = new google_protobuf_source_context_pb.SourceContext; + reader.readMessage(value,google_protobuf_source_context_pb.SourceContext.deserializeBinaryFromReader); + msg.setMySourceContext(value); + break; + case 9: + var value = new google_protobuf_struct_pb.Struct; + reader.readMessage(value,google_protobuf_struct_pb.Struct.deserializeBinaryFromReader); + msg.setMyStruct(value); + break; + case 10: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setMyTimestamp(value); + break; + case 11: + var value = new google_protobuf_type_pb.Type; + reader.readMessage(value,google_protobuf_type_pb.Type.deserializeBinaryFromReader); + msg.setMyType(value); + break; + case 12: + var value = new google_protobuf_wrappers_pb.DoubleValue; + reader.readMessage(value,google_protobuf_wrappers_pb.DoubleValue.deserializeBinaryFromReader); + msg.setMyDoubleValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.examplecom.WellKnownMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.examplecom.WellKnownMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.examplecom.WellKnownMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.examplecom.WellKnownMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyCodeGeneratorRequest(); + if (f != null) { + writer.writeMessage( + 1, + f, + google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.serializeBinaryToWriter + ); + } + f = message.getMyAny(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_any_pb.Any.serializeBinaryToWriter + ); + } + f = message.getMyMethod(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_api_pb.Method.serializeBinaryToWriter + ); + } + f = message.getMyGeneratedCodeInfo(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_descriptor_pb.GeneratedCodeInfo.serializeBinaryToWriter + ); + } + f = message.getMyDuration(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } + f = message.getMyEmpty(); + if (f != null) { + writer.writeMessage( + 6, + f, + google_protobuf_empty_pb.Empty.serializeBinaryToWriter + ); + } + f = message.getMyFieldMask(); + if (f != null) { + writer.writeMessage( + 7, + f, + google_protobuf_field_mask_pb.FieldMask.serializeBinaryToWriter + ); + } + f = message.getMySourceContext(); + if (f != null) { + writer.writeMessage( + 8, + f, + google_protobuf_source_context_pb.SourceContext.serializeBinaryToWriter + ); + } + f = message.getMyStruct(); + if (f != null) { + writer.writeMessage( + 9, + f, + google_protobuf_struct_pb.Struct.serializeBinaryToWriter + ); + } + f = message.getMyTimestamp(); + if (f != null) { + writer.writeMessage( + 10, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getMyType(); + if (f != null) { + writer.writeMessage( + 11, + f, + google_protobuf_type_pb.Type.serializeBinaryToWriter + ); + } + f = message.getMyDoubleValue(); + if (f != null) { + writer.writeMessage( + 12, + f, + google_protobuf_wrappers_pb.DoubleValue.serializeBinaryToWriter + ); + } +}; + + +/** + * optional google.protobuf.compiler.CodeGeneratorRequest my_code_generator_request = 1; + * @return {?proto.google.protobuf.compiler.CodeGeneratorRequest} + */ +proto.examplecom.WellKnownMessage.prototype.getMyCodeGeneratorRequest = function() { + return /** @type{?proto.google.protobuf.compiler.CodeGeneratorRequest} */ ( + jspb.Message.getWrapperField(this, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest, 1)); +}; + + +/** + * @param {?proto.google.protobuf.compiler.CodeGeneratorRequest|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyCodeGeneratorRequest = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyCodeGeneratorRequest = function() { + return this.setMyCodeGeneratorRequest(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyCodeGeneratorRequest = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional google.protobuf.Any my_any = 2; + * @return {?proto.google.protobuf.Any} + */ +proto.examplecom.WellKnownMessage.prototype.getMyAny = function() { + return /** @type{?proto.google.protobuf.Any} */ ( + jspb.Message.getWrapperField(this, google_protobuf_any_pb.Any, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Any|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyAny = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyAny = function() { + return this.setMyAny(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyAny = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.Method my_method = 3; + * @return {?proto.google.protobuf.Method} + */ +proto.examplecom.WellKnownMessage.prototype.getMyMethod = function() { + return /** @type{?proto.google.protobuf.Method} */ ( + jspb.Message.getWrapperField(this, google_protobuf_api_pb.Method, 3)); +}; + + +/** + * @param {?proto.google.protobuf.Method|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyMethod = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyMethod = function() { + return this.setMyMethod(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyMethod = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional google.protobuf.GeneratedCodeInfo my_generated_code_info = 4; + * @return {?proto.google.protobuf.GeneratedCodeInfo} + */ +proto.examplecom.WellKnownMessage.prototype.getMyGeneratedCodeInfo = function() { + return /** @type{?proto.google.protobuf.GeneratedCodeInfo} */ ( + jspb.Message.getWrapperField(this, google_protobuf_descriptor_pb.GeneratedCodeInfo, 4)); +}; + + +/** + * @param {?proto.google.protobuf.GeneratedCodeInfo|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyGeneratedCodeInfo = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyGeneratedCodeInfo = function() { + return this.setMyGeneratedCodeInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyGeneratedCodeInfo = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional google.protobuf.Duration my_duration = 5; + * @return {?proto.google.protobuf.Duration} + */ +proto.examplecom.WellKnownMessage.prototype.getMyDuration = function() { + return /** @type{?proto.google.protobuf.Duration} */ ( + jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 5)); +}; + + +/** + * @param {?proto.google.protobuf.Duration|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyDuration = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyDuration = function() { + return this.setMyDuration(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyDuration = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional google.protobuf.Empty my_empty = 6; + * @return {?proto.google.protobuf.Empty} + */ +proto.examplecom.WellKnownMessage.prototype.getMyEmpty = function() { + return /** @type{?proto.google.protobuf.Empty} */ ( + jspb.Message.getWrapperField(this, google_protobuf_empty_pb.Empty, 6)); +}; + + +/** + * @param {?proto.google.protobuf.Empty|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyEmpty = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyEmpty = function() { + return this.setMyEmpty(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyEmpty = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional google.protobuf.FieldMask my_field_mask = 7; + * @return {?proto.google.protobuf.FieldMask} + */ +proto.examplecom.WellKnownMessage.prototype.getMyFieldMask = function() { + return /** @type{?proto.google.protobuf.FieldMask} */ ( + jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 7)); +}; + + +/** + * @param {?proto.google.protobuf.FieldMask|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyFieldMask = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyFieldMask = function() { + return this.setMyFieldMask(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyFieldMask = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional google.protobuf.SourceContext my_source_context = 8; + * @return {?proto.google.protobuf.SourceContext} + */ +proto.examplecom.WellKnownMessage.prototype.getMySourceContext = function() { + return /** @type{?proto.google.protobuf.SourceContext} */ ( + jspb.Message.getWrapperField(this, google_protobuf_source_context_pb.SourceContext, 8)); +}; + + +/** + * @param {?proto.google.protobuf.SourceContext|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMySourceContext = function(value) { + return jspb.Message.setWrapperField(this, 8, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMySourceContext = function() { + return this.setMySourceContext(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMySourceContext = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * optional google.protobuf.Struct my_struct = 9; + * @return {?proto.google.protobuf.Struct} + */ +proto.examplecom.WellKnownMessage.prototype.getMyStruct = function() { + return /** @type{?proto.google.protobuf.Struct} */ ( + jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 9)); +}; + + +/** + * @param {?proto.google.protobuf.Struct|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyStruct = function(value) { + return jspb.Message.setWrapperField(this, 9, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyStruct = function() { + return this.setMyStruct(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyStruct = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional google.protobuf.Timestamp my_timestamp = 10; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.examplecom.WellKnownMessage.prototype.getMyTimestamp = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 10)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyTimestamp = function(value) { + return jspb.Message.setWrapperField(this, 10, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyTimestamp = function() { + return this.setMyTimestamp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyTimestamp = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional google.protobuf.Type my_type = 11; + * @return {?proto.google.protobuf.Type} + */ +proto.examplecom.WellKnownMessage.prototype.getMyType = function() { + return /** @type{?proto.google.protobuf.Type} */ ( + jspb.Message.getWrapperField(this, google_protobuf_type_pb.Type, 11)); +}; + + +/** + * @param {?proto.google.protobuf.Type|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyType = function(value) { + return jspb.Message.setWrapperField(this, 11, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyType = function() { + return this.setMyType(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyType = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional google.protobuf.DoubleValue my_double_value = 12; + * @return {?proto.google.protobuf.DoubleValue} + */ +proto.examplecom.WellKnownMessage.prototype.getMyDoubleValue = function() { + return /** @type{?proto.google.protobuf.DoubleValue} */ ( + jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.DoubleValue, 12)); +}; + + +/** + * @param {?proto.google.protobuf.DoubleValue|undefined} value + * @return {!proto.examplecom.WellKnownMessage} returns this +*/ +proto.examplecom.WellKnownMessage.prototype.setMyDoubleValue = function(value) { + return jspb.Message.setWrapperField(this, 12, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.examplecom.WellKnownMessage} returns this + */ +proto.examplecom.WellKnownMessage.prototype.clearMyDoubleValue = function() { + return this.setMyDoubleValue(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.examplecom.WellKnownMessage.prototype.hasMyDoubleValue = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +goog.object.extend(exports, proto.examplecom); diff --git a/examples/generated-grpc-native/proto/examplecom/well_known_message_pb_service.d.ts b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb_service.d.ts new file mode 100644 index 0000000..3251d3d --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/well_known_message.proto + diff --git a/examples/generated-grpc-native/proto/examplecom/well_known_message_pb_service.js b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb_service.js new file mode 100644 index 0000000..3251d3d --- /dev/null +++ b/examples/generated-grpc-native/proto/examplecom/well_known_message_pb_service.js @@ -0,0 +1,3 @@ +// package: examplecom +// file: proto/examplecom/well_known_message.proto + diff --git a/examples/generated-grpc-native/proto/orphan_pb.d.ts b/examples/generated-grpc-native/proto/orphan_pb.d.ts new file mode 100644 index 0000000..8db0ce1 --- /dev/null +++ b/examples/generated-grpc-native/proto/orphan_pb.d.ts @@ -0,0 +1,100 @@ +// package: +// file: proto/orphan.proto + +import * as jspb from "google-protobuf"; + +export class OrphanMapMessage extends jspb.Message { + getPrimitiveIntsMap(): jspb.Map; + clearPrimitiveIntsMap(): void; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OrphanMapMessage.AsObject; + static toObject(includeInstance: boolean, msg: OrphanMapMessage): OrphanMapMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OrphanMapMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OrphanMapMessage; + static deserializeBinaryFromReader(message: OrphanMapMessage, reader: jspb.BinaryReader): OrphanMapMessage; +} + +export namespace OrphanMapMessage { + export type AsObject = { + primitiveIntsMap: Array<[string, number]>, + } +} + +export class OrphanMessage extends jspb.Message { + getMyString(): string; + setMyString(value: string): void; + + getMyBool(): boolean; + setMyBool(value: boolean): void; + + getMyEnum(): OrphanEnumMap[keyof OrphanEnumMap]; + setMyEnum(value: OrphanEnumMap[keyof OrphanEnumMap]): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OrphanMessage.AsObject; + static toObject(includeInstance: boolean, msg: OrphanMessage): OrphanMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OrphanMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OrphanMessage; + static deserializeBinaryFromReader(message: OrphanMessage, reader: jspb.BinaryReader): OrphanMessage; +} + +export namespace OrphanMessage { + export type AsObject = { + myString: string, + myBool: boolean, + myEnum: OrphanEnumMap[keyof OrphanEnumMap], + } +} + +export class OrphanUnaryRequest extends jspb.Message { + getSomeInt64(): number; + setSomeInt64(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OrphanUnaryRequest.AsObject; + static toObject(includeInstance: boolean, msg: OrphanUnaryRequest): OrphanUnaryRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OrphanUnaryRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OrphanUnaryRequest; + static deserializeBinaryFromReader(message: OrphanUnaryRequest, reader: jspb.BinaryReader): OrphanUnaryRequest; +} + +export namespace OrphanUnaryRequest { + export type AsObject = { + someInt64: number, + } +} + +export class OrphanStreamRequest extends jspb.Message { + getSomeString(): string; + setSomeString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OrphanStreamRequest.AsObject; + static toObject(includeInstance: boolean, msg: OrphanStreamRequest): OrphanStreamRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OrphanStreamRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OrphanStreamRequest; + static deserializeBinaryFromReader(message: OrphanStreamRequest, reader: jspb.BinaryReader): OrphanStreamRequest; +} + +export namespace OrphanStreamRequest { + export type AsObject = { + someString: string, + } +} + +export interface OrphanEnumMap { + UNKNOWN: 0; + ONE: 1; + TWO: 2; +} + +export const OrphanEnum: OrphanEnumMap; + diff --git a/examples/generated-grpc-native/proto/orphan_pb.js b/examples/generated-grpc-native/proto/orphan_pb.js new file mode 100644 index 0000000..5ae594a --- /dev/null +++ b/examples/generated-grpc-native/proto/orphan_pb.js @@ -0,0 +1,699 @@ +// source: proto/orphan.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.OrphanEnum', null, global); +goog.exportSymbol('proto.OrphanMapMessage', null, global); +goog.exportSymbol('proto.OrphanMessage', null, global); +goog.exportSymbol('proto.OrphanStreamRequest', null, global); +goog.exportSymbol('proto.OrphanUnaryRequest', 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.OrphanMapMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.OrphanMapMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.OrphanMapMessage.displayName = 'proto.OrphanMapMessage'; +} +/** + * 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.OrphanMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.OrphanMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.OrphanMessage.displayName = 'proto.OrphanMessage'; +} +/** + * 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.OrphanUnaryRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.OrphanUnaryRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.OrphanUnaryRequest.displayName = 'proto.OrphanUnaryRequest'; +} +/** + * 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.OrphanStreamRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.OrphanStreamRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.OrphanStreamRequest.displayName = 'proto.OrphanStreamRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.OrphanMapMessage.prototype.toObject = function(opt_includeInstance) { + return proto.OrphanMapMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.OrphanMapMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanMapMessage.toObject = function(includeInstance, msg) { + var f, obj = { + primitiveIntsMap: (f = msg.getPrimitiveIntsMap()) ? 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.OrphanMapMessage} + */ +proto.OrphanMapMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.OrphanMapMessage; + return proto.OrphanMapMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.OrphanMapMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.OrphanMapMessage} + */ +proto.OrphanMapMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getPrimitiveIntsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.OrphanMapMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.OrphanMapMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.OrphanMapMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanMapMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPrimitiveIntsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); + } +}; + + +/** + * map primitive_ints = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.OrphanMapMessage.prototype.getPrimitiveIntsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.OrphanMapMessage} returns this + */ +proto.OrphanMapMessage.prototype.clearPrimitiveIntsMap = function() { + this.getPrimitiveIntsMap().clear(); + return this;}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.OrphanMessage.prototype.toObject = function(opt_includeInstance) { + return proto.OrphanMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.OrphanMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myString: jspb.Message.getFieldWithDefault(msg, 1, ""), + myBool: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + myEnum: jspb.Message.getFieldWithDefault(msg, 3, 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.OrphanMessage} + */ +proto.OrphanMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.OrphanMessage; + return proto.OrphanMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.OrphanMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.OrphanMessage} + */ +proto.OrphanMessage.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.setMyString(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setMyBool(value); + break; + case 3: + var value = /** @type {!proto.OrphanEnum} */ (reader.readEnum()); + msg.setMyEnum(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.OrphanMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.OrphanMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.OrphanMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getMyBool(); + if (f) { + writer.writeBool( + 2, + f + ); + } + f = message.getMyEnum(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } +}; + + +/** + * optional string my_string = 1; + * @return {string} + */ +proto.OrphanMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.OrphanMessage} returns this + */ +proto.OrphanMessage.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bool my_bool = 2; + * @return {boolean} + */ +proto.OrphanMessage.prototype.getMyBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.OrphanMessage} returns this + */ +proto.OrphanMessage.prototype.setMyBool = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional OrphanEnum my_enum = 3; + * @return {!proto.OrphanEnum} + */ +proto.OrphanMessage.prototype.getMyEnum = function() { + return /** @type {!proto.OrphanEnum} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.OrphanEnum} value + * @return {!proto.OrphanMessage} returns this + */ +proto.OrphanMessage.prototype.setMyEnum = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.OrphanUnaryRequest.prototype.toObject = function(opt_includeInstance) { + return proto.OrphanUnaryRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.OrphanUnaryRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanUnaryRequest.toObject = function(includeInstance, msg) { + var f, obj = { + someInt64: 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.OrphanUnaryRequest} + */ +proto.OrphanUnaryRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.OrphanUnaryRequest; + return proto.OrphanUnaryRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.OrphanUnaryRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.OrphanUnaryRequest} + */ +proto.OrphanUnaryRequest.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.setSomeInt64(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.OrphanUnaryRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.OrphanUnaryRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.OrphanUnaryRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanUnaryRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSomeInt64(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } +}; + + +/** + * optional int64 some_int64 = 1; + * @return {number} + */ +proto.OrphanUnaryRequest.prototype.getSomeInt64 = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.OrphanUnaryRequest} returns this + */ +proto.OrphanUnaryRequest.prototype.setSomeInt64 = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.OrphanStreamRequest.prototype.toObject = function(opt_includeInstance) { + return proto.OrphanStreamRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.OrphanStreamRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanStreamRequest.toObject = function(includeInstance, msg) { + var f, obj = { + someString: 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.OrphanStreamRequest} + */ +proto.OrphanStreamRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.OrphanStreamRequest; + return proto.OrphanStreamRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.OrphanStreamRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.OrphanStreamRequest} + */ +proto.OrphanStreamRequest.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.setSomeString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.OrphanStreamRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.OrphanStreamRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.OrphanStreamRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.OrphanStreamRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSomeString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string some_string = 1; + * @return {string} + */ +proto.OrphanStreamRequest.prototype.getSomeString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.OrphanStreamRequest} returns this + */ +proto.OrphanStreamRequest.prototype.setSomeString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * @enum {number} + */ +proto.OrphanEnum = { + UNKNOWN: 0, + ONE: 1, + TWO: 2 +}; + +goog.object.extend(exports, proto); diff --git a/examples/generated-grpc-native/proto/orphan_pb_service.d.ts b/examples/generated-grpc-native/proto/orphan_pb_service.d.ts new file mode 100644 index 0000000..25b7294 --- /dev/null +++ b/examples/generated-grpc-native/proto/orphan_pb_service.d.ts @@ -0,0 +1,78 @@ +// package: +// file: proto/orphan.proto + +import * as proto_orphan_pb from "../proto/orphan_pb"; +import {grpc} from "@improbable-eng/grpc-web"; +import {ReactNativeTransport} from "@improbable-eng/grpc-web-react-native-transport"; + +// @ts-ignore +grpc.setDefaultTransport(ReactNativeTransport(false)); + +type OrphanServiceDoUnary = { + readonly methodName: string; + readonly service: typeof OrphanService; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof proto_orphan_pb.OrphanUnaryRequest; + readonly responseType: typeof proto_orphan_pb.OrphanMessage; +}; + +type OrphanServiceDoStream = { + readonly methodName: string; + readonly service: typeof OrphanService; + readonly requestStream: false; + readonly responseStream: true; + readonly requestType: typeof proto_orphan_pb.OrphanStreamRequest; + readonly responseType: typeof proto_orphan_pb.OrphanMessage; +}; + +export class OrphanService { + static readonly serviceName: string; + static readonly DoUnary: OrphanServiceDoUnary; + static readonly DoStream: OrphanServiceDoStream; +} + +export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } +export type Status = { details: string, code: number; metadata: grpc.Metadata } + +interface UnaryResponse { + cancel(): void; +} +interface ResponseStream { + cancel(): void; + on(type: 'data', handler: (message: T) => void): ResponseStream; + on(type: 'end', handler: (status?: Status) => void): ResponseStream; + on(type: 'status', handler: (status: Status) => void): ResponseStream; +} +interface RequestStream { + write(message: T): RequestStream; + end(): void; + cancel(): void; + on(type: 'end', handler: (status?: Status) => void): RequestStream; + on(type: 'status', handler: (status: Status) => void): RequestStream; +} +interface BidirectionalStream { + write(message: ReqT): BidirectionalStream; + end(): void; + cancel(): void; + on(type: 'data', handler: (message: ResT) => void): BidirectionalStream; + on(type: 'end', handler: (status?: Status) => void): BidirectionalStream; + on(type: 'status', handler: (status: Status) => void): BidirectionalStream; +} + +export class OrphanServiceClient { + readonly serviceHost: string; + + constructor(serviceHost: string, options?: grpc.RpcOptions); + doUnary( + requestMessage: proto_orphan_pb.OrphanUnaryRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: proto_orphan_pb.OrphanMessage|null) => void + ): UnaryResponse; + doUnary( + requestMessage: proto_orphan_pb.OrphanUnaryRequest, + callback: (error: ServiceError|null, responseMessage: proto_orphan_pb.OrphanMessage|null) => void + ): UnaryResponse; + doStream(requestMessage: proto_orphan_pb.OrphanStreamRequest, metadata?: grpc.Metadata): ResponseStream; +} + diff --git a/examples/generated-grpc-native/proto/orphan_pb_service.js b/examples/generated-grpc-native/proto/orphan_pb_service.js new file mode 100644 index 0000000..ddac40c --- /dev/null +++ b/examples/generated-grpc-native/proto/orphan_pb_service.js @@ -0,0 +1,112 @@ +// package: +// file: proto/orphan.proto + +var proto_orphan_pb = require("../proto/orphan_pb"); +var grpc = require("@improbable-eng/grpc-web").grpc; +var ReactNativeTransport = require("@improbable-eng/grpc-web-react-native-transport").ReactNativeTransport + +grpc.setDefaultTransport(ReactNativeTransport(false)); + +var OrphanService = (function () { + function OrphanService() {} + OrphanService.serviceName = "OrphanService"; + return OrphanService; +}()); + +OrphanService.DoUnary = { + methodName: "DoUnary", + service: OrphanService, + requestStream: false, + responseStream: false, + requestType: proto_orphan_pb.OrphanUnaryRequest, + responseType: proto_orphan_pb.OrphanMessage +}; + +OrphanService.DoStream = { + methodName: "DoStream", + service: OrphanService, + requestStream: false, + responseStream: true, + requestType: proto_orphan_pb.OrphanStreamRequest, + responseType: proto_orphan_pb.OrphanMessage +}; + +exports.OrphanService = OrphanService; + +function OrphanServiceClient(serviceHost, options) { + this.serviceHost = serviceHost; + this.options = options || {}; +} + +OrphanServiceClient.prototype.doUnary = function doUnary(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(OrphanService.DoUnary, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +OrphanServiceClient.prototype.doStream = function doStream(requestMessage, metadata) { + var listeners = { + data: [], + end: [], + status: [] + }; + var client = grpc.invoke(OrphanService.DoStream, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onMessage: function (responseMessage) { + listeners.data.forEach(function (handler) { + handler(responseMessage); + }); + }, + onEnd: function (status, statusMessage, trailers) { + listeners.status.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners.end.forEach(function (handler) { + handler({ code: status, details: statusMessage, metadata: trailers }); + }); + listeners = null; + } + }); + return { + on: function (type, handler) { + listeners[type].push(handler); + return this; + }, + cancel: function () { + listeners = null; + client.close(); + } + }; +}; + +exports.OrphanServiceClient = OrphanServiceClient; + diff --git a/examples/generated-grpc-native/proto/othercom/external_child_message_pb.d.ts b/examples/generated-grpc-native/proto/othercom/external_child_message_pb.d.ts new file mode 100644 index 0000000..569e585 --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_child_message_pb.d.ts @@ -0,0 +1,25 @@ +// package: othercom +// file: proto/othercom/external_child_message.proto + +import * as jspb from "google-protobuf"; + +export class ExternalChildMessage extends jspb.Message { + getMyString(): string; + setMyString(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ExternalChildMessage.AsObject; + static toObject(includeInstance: boolean, msg: ExternalChildMessage): ExternalChildMessage.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExternalChildMessage, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExternalChildMessage; + static deserializeBinaryFromReader(message: ExternalChildMessage, reader: jspb.BinaryReader): ExternalChildMessage; +} + +export namespace ExternalChildMessage { + export type AsObject = { + myString: string, + } +} + diff --git a/examples/generated-grpc-native/proto/othercom/external_child_message_pb.js b/examples/generated-grpc-native/proto/othercom/external_child_message_pb.js new file mode 100644 index 0000000..d495540 --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_child_message_pb.js @@ -0,0 +1,170 @@ +// source: proto/othercom/external_child_message.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.othercom.ExternalChildMessage', 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.othercom.ExternalChildMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.othercom.ExternalChildMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.othercom.ExternalChildMessage.displayName = 'proto.othercom.ExternalChildMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.othercom.ExternalChildMessage.prototype.toObject = function(opt_includeInstance) { + return proto.othercom.ExternalChildMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.othercom.ExternalChildMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.othercom.ExternalChildMessage.toObject = function(includeInstance, msg) { + var f, obj = { + myString: 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.othercom.ExternalChildMessage} + */ +proto.othercom.ExternalChildMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.othercom.ExternalChildMessage; + return proto.othercom.ExternalChildMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.othercom.ExternalChildMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.othercom.ExternalChildMessage} + */ +proto.othercom.ExternalChildMessage.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.setMyString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.othercom.ExternalChildMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.othercom.ExternalChildMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.othercom.ExternalChildMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.othercom.ExternalChildMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string my_string = 1; + * @return {string} + */ +proto.othercom.ExternalChildMessage.prototype.getMyString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.othercom.ExternalChildMessage} returns this + */ +proto.othercom.ExternalChildMessage.prototype.setMyString = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +goog.object.extend(exports, proto.othercom); diff --git a/examples/generated-grpc-native/proto/othercom/external_child_message_pb_service.d.ts b/examples/generated-grpc-native/proto/othercom/external_child_message_pb_service.d.ts new file mode 100644 index 0000000..393230a --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_child_message_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: othercom +// file: proto/othercom/external_child_message.proto + diff --git a/examples/generated-grpc-native/proto/othercom/external_child_message_pb_service.js b/examples/generated-grpc-native/proto/othercom/external_child_message_pb_service.js new file mode 100644 index 0000000..393230a --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_child_message_pb_service.js @@ -0,0 +1,3 @@ +// package: othercom +// file: proto/othercom/external_child_message.proto + diff --git a/examples/generated-grpc-native/proto/othercom/external_enum_pb.d.ts b/examples/generated-grpc-native/proto/othercom/external_enum_pb.d.ts new file mode 100644 index 0000000..4c00f74 --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_enum_pb.d.ts @@ -0,0 +1,13 @@ +// package: othercom +// file: proto/othercom/external_enum.proto + +import * as jspb from "google-protobuf"; + +export interface ExternalEnumMap { + DEFAULT: 0; + FIRST: 1; + SECOND: 2; +} + +export const ExternalEnum: ExternalEnumMap; + diff --git a/examples/generated-grpc-native/proto/othercom/external_enum_pb.js b/examples/generated-grpc-native/proto/othercom/external_enum_pb.js new file mode 100644 index 0000000..fac5c93 --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_enum_pb.js @@ -0,0 +1,28 @@ +// source: proto/othercom/external_enum.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @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! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.othercom.ExternalEnum', null, global); +/** + * @enum {number} + */ +proto.othercom.ExternalEnum = { + DEFAULT: 0, + FIRST: 1, + SECOND: 2 +}; + +goog.object.extend(exports, proto.othercom); diff --git a/examples/generated-grpc-native/proto/othercom/external_enum_pb_service.d.ts b/examples/generated-grpc-native/proto/othercom/external_enum_pb_service.d.ts new file mode 100644 index 0000000..e24e3c2 --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_enum_pb_service.d.ts @@ -0,0 +1,3 @@ +// package: othercom +// file: proto/othercom/external_enum.proto + diff --git a/examples/generated-grpc-native/proto/othercom/external_enum_pb_service.js b/examples/generated-grpc-native/proto/othercom/external_enum_pb_service.js new file mode 100644 index 0000000..e24e3c2 --- /dev/null +++ b/examples/generated-grpc-native/proto/othercom/external_enum_pb_service.js @@ -0,0 +1,3 @@ +// package: othercom +// file: proto/othercom/external_enum.proto + diff --git a/generate.js b/generate.js index a62a264..1c5f060 100644 --- a/generate.js +++ b/generate.js @@ -9,6 +9,7 @@ const examplesGeneratedPath = resolve(__dirname, "examples", "generated"); const examplesGeneratedGrpcWebPath = resolve(__dirname, "examples", "generated-grpc-web"); const examplesGeneratedGrpcNodePath = resolve(__dirname, "examples", "generated-grpc-node"); const examplesGeneratedGrpcJsNodePath = resolve(__dirname, "examples", "generated-grpc-js-node"); +const examplesGeneratedGrpcNativePath = resolve(__dirname, "examples", "generated-grpc-native"); const binSuffix = process.platform === "win32" ? ".cmd" : ""; const nodeModulesBin = resolve(__dirname, "node_modules", ".bin"); @@ -51,6 +52,7 @@ requireProtoc(); requireDir(examplesGeneratedPath); requireDir(examplesGeneratedGrpcWebPath); +requireDir(examplesGeneratedGrpcNativePath); requireDir(examplesGeneratedGrpcNodePath); requireDir(examplesGeneratedGrpcJsNodePath); @@ -74,6 +76,16 @@ run(protocPath, ...glob.sync(resolve(__dirname, "proto", "**/*.proto")) ); +// Generate grpc-native services + +run(protocPath, + `--proto_path=${__dirname}`, + `--plugin=protoc-gen-ts=${protocPluginPath}`, + `--js_out=import_style=commonjs,binary:${examplesGeneratedGrpcNativePath}`, + `--ts_out=service=grpc-native:${examplesGeneratedGrpcNativePath}`, + ...glob.sync(resolve(__dirname, "proto", "**/*.proto")) +); + // Generate grpc-node services run(protocPath, diff --git a/package-lock.json b/package-lock.json index 9975b90..f0a9fdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,3356 @@ { "name": "ts-protoc-gen", "version": "0.15.1-pre", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "ts-protoc-gen", + "version": "0.15.1-pre", + "license": "Apache-2.0", + "dependencies": { + "@improbable-eng/grpc-web-react-native-transport": "^0.13.0", + "google-protobuf": "^3.15.5" + }, + "bin": { + "protoc-gen-ts": "bin/protoc-gen-ts" + }, + "devDependencies": { + "@improbable-eng/grpc-web": "^0.9.1", + "@types/chai": "^3.5.2", + "@types/google-protobuf": "^3.15.0", + "@types/lodash": "^4.14.106", + "@types/mocha": "^2.2.46", + "@types/node": "^7.0.52", + "babel": "^6.5.2", + "browser-headers": "^0.4.1", + "chai": "^3.5.0", + "download-cli": "^1.1.1", + "glob": "^7.1.4", + "grpc": "^1.24.6", + "grpc-tools": "^1.11.1", + "lodash": "^4.17.5", + "lodash.isequal": "^4.5.0", + "mocha": "^5.2.0", + "mocha-spec-json-output-reporter": "^1.1.6", + "npm-run-all": "^4.1.5", + "rimraf": "^2.6.3", + "source-map-support": "^0.4.18", + "ts-node": "^8.3.0", + "tslint": "^5.9.1", + "tsutils": "2.27.2", + "typescript": "~3.1.6" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.12.13" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "node_modules/@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@improbable-eng/grpc-web": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web/-/grpc-web-0.9.6.tgz", + "integrity": "sha512-Qs4++T+UvFmrgELd70VX9WbqiP22rk+a28fiwmerrCfrb2gt+mYAqO5xa5GxvHnL+geXcCbgZOeVWxQXrvXB4Q==", + "dependencies": { + "browser-headers": "^0.4.0" + }, + "peerDependencies": { + "google-protobuf": "^3.2.0" + } + }, + "node_modules/@improbable-eng/grpc-web-react-native-transport": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web-react-native-transport/-/grpc-web-react-native-transport-0.13.0.tgz", + "integrity": "sha512-icpskve0Zo5yZVDXRuUa14DDOzMN6mMBndWa99uuzxNuh25kqfSftAuOmKfvb56OYLLGM2eYpJw3M1y4elKLHQ==", + "peerDependencies": { + "@improbable-eng/grpc-web": ">=0.7.0" + } + }, + "node_modules/@types/bytebuffer": { + "version": "5.0.42", + "resolved": "https://registry.npmjs.org/@types/bytebuffer/-/bytebuffer-5.0.42.tgz", + "integrity": "sha512-lEgKojWUAc/MG2t649oZS5AfYFP2xRNPoDuwDBlBMjHXd8MaGPgFgtCXUK7inZdBOygmVf10qxc1Us8GXC96aw==", + "dev": true, + "dependencies": { + "@types/long": "*", + "@types/node": "*" + } + }, + "node_modules/@types/chai": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-3.5.2.tgz", + "integrity": "sha1-wRzSgX06QBt7oPWkIPNcVhObHB4=", + "dev": true + }, + "node_modules/@types/google-protobuf": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/@types/google-protobuf/-/google-protobuf-3.15.0.tgz", + "integrity": "sha512-IshlR1QWD9LYQRlYMfF8dG6PqxrZHddlWB8O5+HCGwH1nv2JQ887fMwRRlXOmUEFehvg+k1THx2h7RbqPUPkGA==", + "dev": true + }, + "node_modules/@types/lodash": { + "version": "4.14.168", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz", + "integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==", + "dev": true + }, + "node_modules/@types/long": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==", + "dev": true + }, + "node_modules/@types/mocha": { + "version": "2.2.48", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.48.tgz", + "integrity": "sha512-nlK/iyETgafGli8Zh9zJVCTicvU3iajSkRwOh3Hhiva598CMqNJ4NcVCGMTGKpGpTYj/9R8RLzS9NAykSSCqGw==", + "dev": true + }, + "node_modules/@types/node": { + "version": "7.10.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.14.tgz", + "integrity": "sha512-29GS75BE8asnTno3yB6ubOJOO0FboExEqNJy4bpz0GSmW/8wPTNL4h9h63c6s1uTrOopCmJYe/4yJLh5r92ZUA==", + "dev": true + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "node_modules/are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ascli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", + "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=", + "dev": true, + "dependencies": { + "colour": "~0.7.1", + "optjs": "~3.2.2" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/babel": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel/-/babel-6.23.0.tgz", + "integrity": "sha1-0NHn2APpdHZb7qMjLU4VPA77kPQ=", + "deprecated": "In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers", + "dev": true, + "bin": { + "babel": "lib/cli.js", + "babel-external-helpers": "lib/cli.js", + "babel-node": "lib/cli.js" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "dev": true, + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-headers": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/browser-headers/-/browser-headers-0.4.1.tgz", + "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg==" + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, + "node_modules/buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "node_modules/builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/bytebuffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", + "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", + "dev": true, + "dependencies": { + "long": "~3" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "dependencies": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/caw": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", + "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", + "dev": true, + "dependencies": { + "get-proxy": "^2.0.0", + "isurl": "^1.0.0-alpha5", + "tunnel-agent": "^0.6.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", + "dev": true, + "dependencies": { + "assertion-error": "^1.0.1", + "deep-eql": "^0.1.3", + "type-detect": "^1.0.0" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "node_modules/cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/colour": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz", + "integrity": "sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "dev": true, + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "node_modules/content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "dev": true, + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "dependencies": { + "array-find-index": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", + "dev": true, + "dependencies": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "dev": true, + "dependencies": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "dev": true, + "dependencies": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2/node_modules/file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "dev": true, + "dependencies": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "dev": true, + "dependencies": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip/node_modules/file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", + "dev": true, + "dependencies": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/deep-eql": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "dev": true, + "dependencies": { + "type-detect": "0.1.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/deep-eql/node_modules/type-detect": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", + "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "dev": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/download": { + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/download/-/download-6.2.5.tgz", + "integrity": "sha512-DpO9K1sXAST8Cpzb7kmEhogJxymyVUd5qz/vCOSyvwtp2Klj2XcDt5YUuasgxka44SxF0q5RriKIwJmQHG2AuA==", + "dev": true, + "dependencies": { + "caw": "^2.0.0", + "content-disposition": "^0.5.2", + "decompress": "^4.0.0", + "ext-name": "^5.0.0", + "file-type": "5.2.0", + "filenamify": "^2.0.0", + "get-stream": "^3.0.0", + "got": "^7.0.0", + "make-dir": "^1.0.0", + "p-event": "^1.0.0", + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download-cli": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/download-cli/-/download-cli-1.1.1.tgz", + "integrity": "sha512-Q8NPjnYKGYLKTzmS8QyrLz9QbDat17WKkIc21lzNxhUotsAweaSSjh1f/Lp50k1Tpc86/6ikFtGoHRrsuWFAfA==", + "dev": true, + "dependencies": { + "download": "^6.2.1", + "meow": "^3.3.0" + }, + "bin": { + "download": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.2", + "is-string": "^1.0.5", + "object-inspect": "^1.9.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ext-list": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", + "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", + "dev": true, + "dependencies": { + "mime-db": "^1.28.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ext-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", + "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", + "dev": true, + "dependencies": { + "ext-list": "^2.0.0", + "sort-keys-length": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz", + "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", + "dev": true, + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.0", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "dependencies": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "node_modules/fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dev": true, + "dependencies": { + "minipass": "^2.6.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proxy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", + "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", + "dev": true, + "dependencies": { + "npm-conf": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/google-protobuf": { + "version": "3.15.8", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.15.8.tgz", + "integrity": "sha512-2jtfdqTaSxk0cuBJBtTTWsot4WtR9RVr2rXg7x7OoqiuOKopPrwXpM1G4dXIkLcUNRh3RKzz76C8IOkksZSeOw==" + }, + "node_modules/got": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "dev": true, + "dependencies": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "dev": true + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/grpc": { + "version": "1.24.6", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.24.6.tgz", + "integrity": "sha512-BtifKdClMYU0ZEo0Pdr2WV9ZH54AoEdIcp2BfJkh87g2R3HoNPLYKHRYefw/ByxrCdVDTAy3hkraFISpqsRcrw==", + "deprecated": "This library will not receive further updates other than security fixes. We recommend using @grpc/grpc-js instead.", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@types/bytebuffer": "^5.0.40", + "lodash.camelcase": "^4.3.0", + "lodash.clone": "^4.5.0", + "nan": "^2.13.2", + "node-pre-gyp": "^0.16.0", + "protobufjs": "^5.0.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/grpc-tools": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/grpc-tools/-/grpc-tools-1.11.1.tgz", + "integrity": "sha512-QNz6xuiyBuHXKu78bv5PAOzv/EBKkH54OgeTkHyFkic8TrY8oiifs6hozRJQxJb+L7k+udWYmPvfK76Pgt4JhA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "node-pre-gyp": "^0.15.0" + }, + "bin": { + "grpc_tools_node_protoc": "bin/protoc.js", + "grpc_tools_node_protoc_plugin": "bin/protoc_plugin.js" + } + }, + "node_modules/grpc-tools/node_modules/node-pre-gyp": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.15.0.tgz", + "integrity": "sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA==", + "deprecated": "Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future", + "dev": true, + "dependencies": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.3", + "needle": "^2.5.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "dependencies": { + "has-symbol-support-x": "^1.4.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "node_modules/he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "dev": true, + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "dependencies": { + "repeating": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-bigint": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", + "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz", + "integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", + "dev": true, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=", + "dev": true + }, + "node_modules/is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", + "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", + "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", + "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "dev": true, + "dependencies": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "node_modules/lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "dependencies": { + "invert-kv": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/load-json-file/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", + "dev": true + }, + "node_modules/lodash.clone": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz", + "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=", + "dev": true + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "dev": true + }, + "node_modules/long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "dependencies": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", + "dev": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "dependencies": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mime-db": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", + "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "node_modules/minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dev": true, + "dependencies": { + "minipass": "^2.9.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "dependencies": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/mocha-spec-json-output-reporter": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/mocha-spec-json-output-reporter/-/mocha-spec-json-output-reporter-1.1.7.tgz", + "integrity": "sha512-Fn0GdoX0q/AWz3R5JJCccATzNJNHbM7CcAgeNg6YyTCtAurqXjohuNCZ+3SoA17fU/TBdKbIfcs34gUcrLye2Q==", + "dev": true, + "dependencies": { + "mocha": "^5.0.2", + "moment": "^2.21.0" + } + }, + "node_modules/mocha/node_modules/commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "node_modules/mocha/node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "node_modules/mocha/node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "dev": true, + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/moment": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "dev": true + }, + "node_modules/needle": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz", + "integrity": "sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg==", + "dev": true, + "dependencies": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node_modules/node-pre-gyp": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.16.0.tgz", + "integrity": "sha512-4efGA+X/YXAHLi1hN8KaPrILULaUn2nWecFrn1k2I+99HpoyvcOGEbtcOxpDiUwPF2ZANMJDh32qwOUPenuR1g==", + "deprecated": "Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future", + "dev": true, + "dependencies": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.3", + "needle": "^2.5.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dev": true, + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/npm-bundled": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", + "dev": true, + "dependencies": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npm-conf": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", + "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", + "dev": true, + "dependencies": { + "config-chain": "^1.1.11", + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "node_modules/npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", + "dev": true, + "dependencies": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" + }, + "bin": { + "npm-run-all": "bin/npm-run-all/index.js", + "run-p": "bin/run-p/index.js", + "run-s": "bin/run-s/index.js" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm-run-all/node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optjs": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz", + "integrity": "sha1-aabOicRCpEQDFBrS+bNwvVu29O4=", + "dev": true + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "dependencies": { + "lcid": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-event": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-1.3.0.tgz", + "integrity": "sha1-jmtPT2XHK8W2/ii3XtqHT5akoIU=", + "dev": true, + "dependencies": { + "p-timeout": "^1.1.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-timeout": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "dev": true, + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "dependencies": { + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-type/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "node_modules/pidtree": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", + "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", + "dev": true + }, + "node_modules/protobufjs": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", + "dev": true, + "dependencies": { + "ascli": "~1", + "bytebuffer": "~5", + "glob": "^7.0.5", + "yargs": "^3.10.0" + }, + "bin": { + "pbjs": "bin/pbjs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "dependencies": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "dependencies": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "dependencies": { + "is-finite": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "node_modules/seek-bzip": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", + "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", + "dev": true, + "dependencies": { + "commander": "^2.8.1" + }, + "bin": { + "seek-bunzip": "bin/seek-bunzip", + "seek-table": "bin/seek-bzip-table" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shell-quote": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", + "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "node_modules/sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sort-keys-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", + "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=", + "dev": true, + "dependencies": { + "sort-keys": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "dependencies": { + "source-map": "^0.5.6" + } + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", + "dev": true + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string.prototype.padend": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.2.tgz", + "integrity": "sha512-/AQFLdYvePENU3W5rgurfWSMU6n+Ww8n/3cUt7E+vPBB/D7YDG8x+qjoFs4M/alR2bW7Qg6xMjVwWUOvuQ0XpQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "dev": true, + "dependencies": { + "is-natural-number": "^4.0.1" + } + }, + "node_modules/strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "dependencies": { + "get-stdin": "^4.0.1" + }, + "bin": { + "strip-indent": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar": { + "version": "4.4.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", + "dev": true, + "dependencies": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "engines": { + "node": ">=4.5" + } + }, + "node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dev": true, + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "node_modules/timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", + "dev": true + }, + "node_modules/trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "dependencies": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=6.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/ts-node/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ts-node/node_modules/source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "bin": { + "tslint": "bin/tslint" + }, + "engines": { + "node": ">=4.8.0" + }, + "peerDependencies": { + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + } + }, + "node_modules/tslint/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tslint/node_modules/tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" + } + }, + "node_modules/tsutils": { + "version": "2.27.2", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.2.tgz", + "integrity": "sha512-qf6rmT84TFMuxAKez2pIfR8UCai49iQsfB7YWVjV1bKpy/d0PWT5rEOSM6La9PiHZ0k1RRZQiwVdVJfQ3BPHgg==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "peerDependencies": { + "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-detect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", + "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/typescript": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.8.tgz", + "integrity": "sha512-R97qglMfoKjfKD0N24o7W6bS+SwjN/eaQNIaxR8S5HdLRnt7rCk6LCmE3tve1KN8gXKgbJU51aZHRRMAQcIbMA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "dependencies": { + "prepend-http": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=", + "dev": true, + "bin": { + "window-size": "cli.js" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", + "dev": true, + "dependencies": { + "camelcase": "^2.0.1", + "cliui": "^3.0.3", + "decamelize": "^1.1.1", + "os-locale": "^1.4.0", + "string-width": "^1.0.1", + "window-size": "^0.1.4", + "y18n": "^3.2.0" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, "dependencies": { "@babel/code-frame": { "version": "7.12.13", @@ -34,11 +3382,16 @@ "version": "0.9.6", "resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web/-/grpc-web-0.9.6.tgz", "integrity": "sha512-Qs4++T+UvFmrgELd70VX9WbqiP22rk+a28fiwmerrCfrb2gt+mYAqO5xa5GxvHnL+geXcCbgZOeVWxQXrvXB4Q==", - "dev": true, "requires": { "browser-headers": "^0.4.0" } }, + "@improbable-eng/grpc-web-react-native-transport": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web-react-native-transport/-/grpc-web-react-native-transport-0.13.0.tgz", + "integrity": "sha512-icpskve0Zo5yZVDXRuUa14DDOzMN6mMBndWa99uuzxNuh25kqfSftAuOmKfvb56OYLLGM2eYpJw3M1y4elKLHQ==", + "requires": {} + }, "@types/bytebuffer": { "version": "5.0.42", "resolved": "https://registry.npmjs.org/@types/bytebuffer/-/bytebuffer-5.0.42.tgz", @@ -200,8 +3553,7 @@ "browser-headers": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/browser-headers/-/browser-headers-0.4.1.tgz", - "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg==", - "dev": true + "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg==" }, "browser-stdout": { "version": "1.3.1", @@ -2157,6 +5509,23 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -2199,23 +5568,6 @@ "define-properties": "^1.1.3" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } - } - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", diff --git a/package.json b/package.json index fa26445..08a4dfd 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "author": "Improbable", "license": "Apache-2.0", "dependencies": { + "@improbable-eng/grpc-web-react-native-transport": "^0.13.0", "google-protobuf": "^3.15.5" }, "devDependencies": { diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..161cda1 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/index.ts b/src/index.ts index da20bc7..28b313c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import {CodeGeneratorRequest, CodeGeneratorResponse} from "google-protobuf/googl import {FileDescriptorProto} from "google-protobuf/google/protobuf/descriptor_pb"; import {generateGrpcWebService} from "./service/grpcweb"; import {generateGrpcNodeService} from "./service/grpcnode"; +import {generateGrpcNativeService} from "./service/grpcnative"; import {ServiceParameter} from "./parameters"; /** @@ -32,6 +33,7 @@ withAllStdIn((inputBuff: Buffer) => { const generateGrpcWebServices = service === ServiceParameter.GrpcWeb; const generateGrpcNodeServices = service === ServiceParameter.GrpcNode; + const generateGrpcNativeServices = service === ServiceParameter.GrpcNative; codeGenRequest.getProtoFileList().forEach(protoFileDescriptor => { const fileDescriptorName = protoFileDescriptor.getName() || throwError("Missing file descriptor name"); @@ -52,6 +54,9 @@ withAllStdIn((inputBuff: Buffer) => { } else if (generateGrpcNodeServices) { const file = generateGrpcNodeService(outputFileName, fileNameToDescriptor[fileName], exportMap, mode); codeGenResponse.addFile(file); + } else if (generateGrpcNativeServices) { + generateGrpcNativeService(outputFileName, fileNameToDescriptor[fileName], exportMap) + .forEach(file => codeGenResponse.addFile(file)); } }); diff --git a/src/parameters.ts b/src/parameters.ts index c5d8e7d..3c72af9 100644 --- a/src/parameters.ts +++ b/src/parameters.ts @@ -1,7 +1,8 @@ export enum ServiceParameter { None, GrpcWeb, - GrpcNode + GrpcNode, + GrpcNative, } export enum ModeParameter { diff --git a/src/service/grpcnative.ts b/src/service/grpcnative.ts new file mode 100644 index 0000000..251bd11 --- /dev/null +++ b/src/service/grpcnative.ts @@ -0,0 +1,408 @@ +import {ExportMap} from "../ExportMap"; +import {Printer} from "../Printer"; +import {CodePrinter} from "../CodePrinter"; +import {FileDescriptorProto} from "google-protobuf/google/protobuf/descriptor_pb"; +import {CodeGeneratorResponse} from "google-protobuf/google/protobuf/compiler/plugin_pb"; +import {createFile, RPCMethodDescriptor, RPCDescriptor, GrpcServiceDescriptor} from "./common"; + +export function generateGrpcNativeService(filename: string, descriptor: FileDescriptorProto, exportMap: ExportMap): CodeGeneratorResponse.File[] { + return [ + createFile(generateTypeScriptDefinition(descriptor, exportMap), `${filename}_service.d.ts`), + createFile(generateJavaScript(descriptor, exportMap), `${filename}_service.js`), + ]; +} + +function generateTypeScriptDefinition(fileDescriptor: FileDescriptorProto, exportMap: ExportMap): string { + const serviceDescriptor = new GrpcServiceDescriptor(fileDescriptor, exportMap); + const printer = new Printer(0); + + // Header. + printer.printLn(`// package: ${serviceDescriptor.packageName}`); + printer.printLn(`// file: ${serviceDescriptor.filename}`); + printer.printEmptyLn(); + + if (serviceDescriptor.services.length === 0) { + return printer.getOutput(); + } + + // Import statements. + serviceDescriptor.imports + .forEach(importDescriptor => { + printer.printLn(`import * as ${importDescriptor.namespace} from "${importDescriptor.path}";`); + }); + printer.printLn(`import {grpc} from "@improbable-eng/grpc-web";`); + + // Where the native magic happens + printer.printLn(`import {ReactNativeTransport} from "@improbable-eng/grpc-web-react-native-transport";`); + printer.printEmptyLn(); + printer.printLn(`// @ts-ignore`); + printer.printLn(`grpc.setDefaultTransport(ReactNativeTransport(false));`); + printer.printEmptyLn(); + + // Services. + serviceDescriptor.services + .forEach(service => { + + // Method Type Definitions + service.methods.forEach(method => { + printer.printLn(`type ${method.serviceName}${method.nameAsPascalCase} = {`); + printer.printIndentedLn(`readonly methodName: string;`); + printer.printIndentedLn(`readonly service: typeof ${method.serviceName};`); + printer.printIndentedLn(`readonly requestStream: ${method.requestStream};`); + printer.printIndentedLn(`readonly responseStream: ${method.responseStream};`); + printer.printIndentedLn(`readonly requestType: typeof ${method.requestType};`); + printer.printIndentedLn(`readonly responseType: typeof ${method.responseType};`); + printer.printLn(`};`); + printer.printEmptyLn(); + }); + + printer.printLn(`export class ${service.name} {`); + printer.printIndentedLn(`static readonly serviceName: string;`); + service.methods.forEach(method => { + printer.printIndentedLn(`static readonly ${method.nameAsPascalCase}: ${method.serviceName}${method.nameAsPascalCase};`); + }); + printer.printLn(`}`); + printer.printEmptyLn(); + }); + + + + printer.printLn(`export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }`); + printer.printLn(`export type Status = { details: string, code: number; metadata: grpc.Metadata }`); + printer.printEmptyLn(); + printer.printLn("interface UnaryResponse {"); + printer.printIndentedLn("cancel(): void;"); + printer.printLn("}"); + printer.printLn(`interface ResponseStream {`); + printer.printIndentedLn(`cancel(): void;`); + printer.printIndentedLn(`on(type: 'data', handler: (message: T) => void): ResponseStream;`); + printer.printIndentedLn(`on(type: 'end', handler: (status?: Status) => void): ResponseStream;`); + printer.printIndentedLn(`on(type: 'status', handler: (status: Status) => void): ResponseStream;`); + printer.printLn(`}`); + printer.printLn(`interface RequestStream {`); + printer.printIndentedLn(`write(message: T): RequestStream;`); + printer.printIndentedLn(`end(): void;`); + printer.printIndentedLn(`cancel(): void;`); + printer.printIndentedLn(`on(type: 'end', handler: (status?: Status) => void): RequestStream;`); + printer.printIndentedLn(`on(type: 'status', handler: (status: Status) => void): RequestStream;`); + printer.printLn(`}`); + printer.printLn(`interface BidirectionalStream {`); + printer.printIndentedLn(`write(message: ReqT): BidirectionalStream;`); + printer.printIndentedLn(`end(): void;`); + printer.printIndentedLn(`cancel(): void;`); + printer.printIndentedLn(`on(type: 'data', handler: (message: ResT) => void): BidirectionalStream;`); + printer.printIndentedLn(`on(type: 'end', handler: (status?: Status) => void): BidirectionalStream;`); + printer.printIndentedLn(`on(type: 'status', handler: (status: Status) => void): BidirectionalStream;`); + printer.printLn(`}`); + printer.printEmptyLn(); + + // Add a client stub that talks with the @improbable-eng/grpc-web library + serviceDescriptor.services + .forEach(service => { + printServiceStubTypes(printer, service); + printer.printEmptyLn(); + }); + + return printer.getOutput(); +} + +function generateJavaScript(fileDescriptor: FileDescriptorProto, exportMap: ExportMap): string { + const serviceDescriptor = new GrpcServiceDescriptor(fileDescriptor, exportMap); + const printer = new Printer(0); + + // Header. + printer.printLn(`// package: ${serviceDescriptor.packageName}`); + printer.printLn(`// file: ${serviceDescriptor.filename}`); + printer.printEmptyLn(); + + if (serviceDescriptor.services.length === 0) { + return printer.getOutput(); + } + + // Import Statements + serviceDescriptor.imports + .forEach(importDescriptor => { + printer.printLn(`var ${importDescriptor.namespace} = require("${importDescriptor.path}");`); + }); + printer.printLn(`var grpc = require("@improbable-eng/grpc-web").grpc;`); + + // Where the native magic happens + printer.printLn(`var ReactNativeTransport = require("@improbable-eng/grpc-web-react-native-transport").ReactNativeTransport`); + printer.printEmptyLn(); + printer.printLn(`grpc.setDefaultTransport(ReactNativeTransport(false));`); + printer.printEmptyLn(); + + // Services. + serviceDescriptor.services + .forEach(service => { + printer.printLn(`var ${service.name} = (function () {`); + printer.printIndentedLn(`function ${service.name}() {}`); + printer.printIndentedLn(`${service.name}.serviceName = "${service.qualifiedName}";`); + printer.printIndentedLn(`return ${service.name};`); + printer.printLn(`}());`); + printer.printEmptyLn(); + + service.methods + .forEach(method => { + printer.printLn(`${method.serviceName}.${method.nameAsPascalCase} = {`); + printer.printIndentedLn(`methodName: "${method.nameAsPascalCase}",`); + printer.printIndentedLn(`service: ${method.serviceName},`); + printer.printIndentedLn(`requestStream: ${method.requestStream},`); + printer.printIndentedLn(`responseStream: ${method.responseStream},`); + printer.printIndentedLn(`requestType: ${method.requestType},`); + printer.printIndentedLn(`responseType: ${method.responseType}`); + printer.printLn(`};`); + printer.printEmptyLn(); + }); + printer.printLn(`exports.${service.name} = ${service.name};`); + printer.printEmptyLn(); + + // Add a client stub that talks with the @improbable-eng/grpc-web library + printServiceStub(printer, service); + + printer.printEmptyLn(); + }); + + return printer.getOutput(); +} + +function printServiceStub(methodPrinter: Printer, service: RPCDescriptor) { + const printer = new CodePrinter(0, methodPrinter); + + printer + .printLn(`function ${service.name}Client(serviceHost, options) {`) + .indent().printLn(`this.serviceHost = serviceHost;`) + .printLn(`this.options = options || {};`) + .dedent().printLn(`}`) + .printEmptyLn(); + + service.methods.forEach((method: RPCMethodDescriptor) => { + if (method.requestStream && method.responseStream) { + printBidirectionalStubMethod(printer, method); + } else if (method.requestStream) { + printClientStreamStubMethod(printer, method); + } else if (method.responseStream) { + printServerStreamStubMethod(printer, method); + } else { + printUnaryStubMethod(printer, method); + } + printer.printEmptyLn(); + }); + printer.printLn(`exports.${service.name}Client = ${service.name}Client;`); +} + +function printUnaryStubMethod(printer: CodePrinter, method: RPCMethodDescriptor) { + printer + .printLn(`${method.serviceName}Client.prototype.${method.nameAsCamelCase} = function ${method.functionName}(requestMessage, metadata, callback) {`) + .indent().printLn(`if (arguments.length === 2) {`) + .indent().printLn(`callback = arguments[1];`) + .dedent().printLn("}") + .printLn(`var client = grpc.unary(${method.serviceName}.${method.nameAsPascalCase}, {`) + .indent().printLn(`request: requestMessage,`) + .printLn(`host: this.serviceHost,`) + .printLn(`metadata: metadata,`) + .printLn(`transport: this.options.transport,`) + .printLn(`debug: this.options.debug,`) + .printLn(`onEnd: function (response) {`) + .indent().printLn(`if (callback) {`) + .indent().printLn(`if (response.status !== grpc.Code.OK) {`) + .indent().printLn(`var err = new Error(response.statusMessage);`) + .printLn(`err.code = response.status;`) + .printLn(`err.metadata = response.trailers;`) + .printLn(`callback(err, null);`) + .dedent().printLn(`} else {`) + .indent().printLn(`callback(null, response.message);`) + .dedent().printLn(`}`) + .dedent().printLn(`}`) + .dedent().printLn(`}`) + .dedent().printLn(`});`) + .printLn(`return {`) + .indent().printLn(`cancel: function () {`) + .indent().printLn(`callback = null;`) + .printLn(`client.close();`) + .dedent().printLn(`}`) + .dedent().printLn(`};`) + .dedent().printLn(`};`); +} + +function printServerStreamStubMethod(printer: CodePrinter, method: RPCMethodDescriptor) { + printer + .printLn(`${method.serviceName}Client.prototype.${method.nameAsCamelCase} = function ${method.functionName}(requestMessage, metadata) {`) + .indent().printLn(`var listeners = {`) + .indent().printLn(`data: [],`) + .printLn(`end: [],`) + .printLn(`status: []`) + .dedent().printLn(`};`) + .printLn(`var client = grpc.invoke(${method.serviceName}.${method.nameAsPascalCase}, {`) + .indent().printLn(`request: requestMessage,`) + .printLn(`host: this.serviceHost,`) + .printLn(`metadata: metadata,`) + .printLn(`transport: this.options.transport,`) + .printLn(`debug: this.options.debug,`) + .printLn(`onMessage: function (responseMessage) {`) + .indent().printLn(`listeners.data.forEach(function (handler) {`) + .indent().printLn(`handler(responseMessage);`) + .dedent().printLn(`});`) + .dedent().printLn(`},`) + .printLn(`onEnd: function (status, statusMessage, trailers) {`) + .indent().printLn(`listeners.status.forEach(function (handler) {`) + .indent().printLn(`handler({ code: status, details: statusMessage, metadata: trailers });`) + .dedent().printLn(`});`) + .printLn(`listeners.end.forEach(function (handler) {`) + .indent().printLn(`handler({ code: status, details: statusMessage, metadata: trailers });`) + .dedent().printLn(`});`) + .printLn(`listeners = null;`) + .dedent().printLn(`}`) + .dedent().printLn(`});`) + .printLn(`return {`) + .indent().printLn(`on: function (type, handler) {`) + .indent().printLn(`listeners[type].push(handler);`) + .printLn(`return this;`) + .dedent().printLn(`},`) + .printLn(`cancel: function () {`) + .indent().printLn(`listeners = null;`) + .printLn(`client.close();`) + .dedent().printLn(`}`) + .dedent().printLn(`};`) + .dedent().printLn(`};`); +} + +function printClientStreamStubMethod(printer: CodePrinter, method: RPCMethodDescriptor) { + printer + .printLn(`${method.serviceName}Client.prototype.${method.nameAsCamelCase} = function ${method.functionName}(metadata) {`) + .indent().printLn(`var listeners = {`) + .indent().printLn(`end: [],`) + .printLn(`status: []`) + .dedent().printLn(`};`) + .printLn(`var client = grpc.client(${method.serviceName}.${method.nameAsPascalCase}, {`) + .indent().printLn(`host: this.serviceHost,`) + .printLn(`metadata: metadata,`) + .printLn(`transport: this.options.transport`) + .dedent().printLn(`});`) + .printLn(`client.onEnd(function (status, statusMessage, trailers) {`) + .indent().printLn(`listeners.status.forEach(function (handler) {`) + .indent().printLn(`handler({ code: status, details: statusMessage, metadata: trailers });`) + .dedent().printLn(`});`) + .printLn(`listeners.end.forEach(function (handler) {`) + .indent().printLn(`handler({ code: status, details: statusMessage, metadata: trailers });`) + .dedent().printLn(`});`) + .printLn(`listeners = null;`) + .dedent().printLn(`});`) + .printLn(`return {`) + .indent().printLn(`on: function (type, handler) {`) + .indent().printLn(`listeners[type].push(handler);`) + .printLn(`return this;`) + .dedent().printLn(`},`) + .printLn(`write: function (requestMessage) {`) + .indent().printLn(`if (!client.started) {`) + .indent().printLn(`client.start(metadata);`) + .dedent().printLn(`}`) + .printLn(`client.send(requestMessage);`) + .printLn(`return this;`) + .dedent().printLn(`},`) + .printLn(`end: function () {`) + .indent().printLn(`client.finishSend();`) + .dedent().printLn(`},`) + .printLn(`cancel: function () {`) + .indent().printLn(`listeners = null;`) + .printLn(`client.close();`) + .dedent().printLn(`}`) + .dedent().printLn(`};`) + .dedent().printLn(`};`); +} + +function printBidirectionalStubMethod(printer: CodePrinter, method: RPCMethodDescriptor) { + printer + .printLn(`${method.serviceName}Client.prototype.${method.nameAsCamelCase} = function ${method.functionName}(metadata) {`) + .indent().printLn(`var listeners = {`) + .indent().printLn(`data: [],`) + .printLn(`end: [],`) + .printLn(`status: []`) + .dedent().printLn(`};`) + .printLn(`var client = grpc.client(${method.serviceName}.${method.nameAsPascalCase}, {`) + .indent().printLn(`host: this.serviceHost,`) + .printLn(`metadata: metadata,`) + .printLn(`transport: this.options.transport`) + .dedent().printLn(`});`) + .printLn(`client.onEnd(function (status, statusMessage, trailers) {`) + .indent().printLn(`listeners.status.forEach(function (handler) {`) + .indent().printLn(`handler({ code: status, details: statusMessage, metadata: trailers });`) + .dedent().printLn(`});`) + .printLn(`listeners.end.forEach(function (handler) {`) + .indent().printLn(`handler({ code: status, details: statusMessage, metadata: trailers });`) + .dedent().printLn(`});`) + .printLn(`listeners = null;`) + .dedent().printLn(`});`) + .printLn(`client.onMessage(function (message) {`) + .indent().printLn(`listeners.data.forEach(function (handler) {`) + .indent().printLn(`handler(message);`) + .dedent().printLn(`})`) + .dedent().printLn(`});`) + .printLn(`client.start(metadata);`) + .printLn(`return {`) + .indent().printLn(`on: function (type, handler) {`) + .indent().printLn(`listeners[type].push(handler);`) + .printLn(`return this;`) + .dedent().printLn(`},`) + .printLn(`write: function (requestMessage) {`) + .indent().printLn(`client.send(requestMessage);`) + .printLn(`return this;`) + .dedent().printLn(`},`) + .printLn(`end: function () {`) + .indent().printLn(`client.finishSend();`) + .dedent().printLn(`},`) + .printLn(`cancel: function () {`) + .indent().printLn(`listeners = null;`) + .printLn(`client.close();`) + .dedent().printLn(`}`) + .dedent().printLn(`};`) + .dedent().printLn(`};`); +} + +function printServiceStubTypes(methodPrinter: Printer, service: RPCDescriptor) { + const printer = new CodePrinter(0, methodPrinter); + + printer + .printLn(`export class ${service.name}Client {`) + .indent().printLn(`readonly serviceHost: string;`) + .printEmptyLn() + .printLn(`constructor(serviceHost: string, options?: grpc.RpcOptions);`); + + service.methods.forEach((method: RPCMethodDescriptor) => { + if (method.requestStream && method.responseStream) { + printBidirectionalStubMethodTypes(printer, method); + } else if (method.requestStream) { + printClientStreamStubMethodTypes(printer, method); + } else if (method.responseStream) { + printServerStreamStubMethodTypes(printer, method); + } else { + printUnaryStubMethodTypes(printer, method); + } + }); + printer.dedent().printLn("}"); +} + +function printUnaryStubMethodTypes(printer: CodePrinter, method: RPCMethodDescriptor) { + printer + .printLn(`${method.nameAsCamelCase}(`) + .indent().printLn(`requestMessage: ${method.requestType},`) + .printLn(`metadata: grpc.Metadata,`) + .printLn(`callback: (error: ServiceError|null, responseMessage: ${method.responseType}|null) => void`) + .dedent().printLn(`): UnaryResponse;`) + .printLn(`${method.nameAsCamelCase}(`) + .indent().printLn(`requestMessage: ${method.requestType},`) + .printLn(`callback: (error: ServiceError|null, responseMessage: ${method.responseType}|null) => void`) + .dedent().printLn(`): UnaryResponse;`); +} + +function printServerStreamStubMethodTypes(printer: CodePrinter, method: RPCMethodDescriptor) { + printer.printLn(`${method.nameAsCamelCase}(requestMessage: ${method.requestType}, metadata?: grpc.Metadata): ResponseStream<${method.responseType}>;`); +} + +function printClientStreamStubMethodTypes(printer: CodePrinter, method: RPCMethodDescriptor) { + printer.printLn(`${method.nameAsCamelCase}(metadata?: grpc.Metadata): RequestStream<${method.requestType}>;`); +} + +function printBidirectionalStubMethodTypes(printer: CodePrinter, method: RPCMethodDescriptor) { + printer.printLn(`${method.nameAsCamelCase}(metadata?: grpc.Metadata): BidirectionalStream<${method.requestType}, ${method.responseType}>;`); +} diff --git a/src/util.ts b/src/util.ts index 847ee99..7c3bdaa 100644 --- a/src/util.ts +++ b/src/util.ts @@ -164,6 +164,8 @@ export function getServiceParameter(service?: string): ServiceParameter { return ServiceParameter.GrpcWeb; case "grpc-node": return ServiceParameter.GrpcNode; + case "grpc-native": + return ServiceParameter.GrpcNative; case undefined: return ServiceParameter.None; default: