diff --git a/.codeclimate.yml b/.codeclimate.yml index e549fbe25..73f64e95c 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -21,6 +21,7 @@ ratings: - "lib/path/**.js" - "lib/pool/**.js" - "lib/utf8/**.js" + - "ext/**.js" - "**/*.d.ts" exclude_paths: - "dist/**" diff --git a/README.md b/README.md index af0ccc7e4..3a6d3ab4c 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ Contents A brief introduction to using the toolset. * [Valid Message](#valid-message) - * [Toolset](#toolset) - + * [Toolset](#toolset)
* [Examples](#examples)
A few examples to get you started. @@ -26,8 +25,7 @@ Contents * [Using reflection only](#using-reflection-only) * [Using custom classes](#using-custom-classes) * [Using services](#using-services) - * [Usage with TypeScript](#usage-with-typescript) - + * [Usage with TypeScript](#usage-with-typescript)
* [Command line](#command-line)
How to use the command line utility. @@ -35,8 +33,7 @@ Contents * [pbjs for JavaScript](#pbjs-for-javascript) * [pbts for TypeScript](#pbts-for-typescript) * [Reflection vs. static code](#reflection-vs-static-code) - * [Command line API](#command-line-api) - + * [Command line API](#command-line-api)
* [Additional documentation](#additional-documentation)
A list of available documentation resources. @@ -836,6 +833,7 @@ Compatibility * Support for pre-ES5 environments (except IE8) can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js). * Support for [Content Security Policy](https://w3c.github.io/webappsec-csp/)-restricted environments (like Chrome extensions without [unsafe-eval](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval)) can be achieved by generating and using static code instead. * If a proper way to work with 64 bit values (uint64, int64 etc.) is required, just install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)). +* For descriptor.proto interoperability, see [ext/descriptor](https://github.com/dcodeIO/protobuf.js/tree/master/ext/descriptor) Building -------- diff --git a/ext/descriptor/README.md b/ext/descriptor/README.md index 52ff8e1a9..920fcd488 100644 --- a/ext/descriptor/README.md +++ b/ext/descriptor/README.md @@ -7,23 +7,24 @@ Usage ----- ```js -var protobuf = require("protobufjs"), +var protobuf = require("protobufjs"), // requires the full library descriptor = require("protobufjs/ext/descriptor"); -// take any extisting root object var root = ...; -// convert it to the corresponding descriptor type -var fileDescriptorSet = root.toDescriptor("proto2"); +// convert any existing root instance to the corresponding descriptor type +var descriptor = root.toDescriptor("proto2"); +// ^ returns a FileDescriptorSet message, see table below -// encode it -var buffer = descriptor.FileDescriptorSet.encode(fileDescriptorSet).finish(); +// encode to a descriptor buffer +var buffer = descriptor.FileDescriptorSet.encode(descriptor).finish(); -// decode it back -var decoded = descriptor.FileDescriptorSet.decode(buffer); +// decode from a descriptor buffer +var decodedDescriptor = descriptor.FileDescriptorSet.decode(buffer); -// convert it back to a protobuf.js root -root = protobuf.Root.fromDescriptor(decoded); +// convert any existing descriptor to a root instance +root = protobuf.Root.fromDescriptor(decodedDescriptor); +// ^ expects a FileDescriptorSet message or buffer, see table below // and start all over again ``` @@ -31,29 +32,41 @@ root = protobuf.Root.fromDescriptor(decoded); API --- -The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto, including sub-types: - -| Descriptor type | protobuf.js type | Remarks -|--------------------------|------------------|--------- -| FileDescriptorSet | Root | -| FileDescriptorProto | Root | except dependencies -| FileOptions | Root | -| DescriptorProto | Type | -| MessageOptions | Type | -| FieldDescriptorProto | Field | -| FieldOptions | Field | -| OneofDescriptorProto | OneOf | -| OneofOptions | OneOf | -| EnumDescriptorProto | Enum | -| EnumValueDescriptorProto | Enum | -| EnumOptions | Enum | -| EnumValueOptions | Enum | not supported -| ServiceDescriptorProto | Service | -| ServiceOptions | Service | -| MethodDescriptorProto | Method | -| MethodOptions | Method | -| UninterpretedOption | | not supported -| SourceCodeInfo | | not supported -| GeneratedCodeInfo | | not supported +The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto: + +| Descriptor type | protobuf.js type | Remarks +|--------------------------------|------------------|--------- +| **FileDescriptorSet** | Root | +| FileDescriptorProto | | dependencies are not supported +| FileOptions | | +| FileOptions_OptimizeMode | | +| SourceCodeInfo | | not supported +| SourceCodeInfo_Location | | +| GeneratedCodeInfo | | not supported +| GeneratedCodeInfo_Annotation | | +| **DescriptorProto** | Type | +| MessageOptions | | +| DescriptorProto_ExtensionRange | | +| DescriptorProto_ReservedRange | | +| **FieldDescriptorProto** | Field | +| FieldDescriptorProto_Label | | +| FieldDescriptorProto_Type | | +| FieldOptions | | +| FieldOptions_CType | | +| FieldOptions_JSType | | +| **OneofDescriptorProto** | OneOf | +| OneofOptions | | +| **EnumDescriptorProto** | Enum | +| EnumOptions | | +| EnumValueDescriptorProto | | +| EnumValueOptions | | not supported +| **ServiceDescriptorProto** | Service | +| ServiceOptions | | +| **MethodDescriptorProto** | Method | +| MethodOptions | | +| UninterpretedOption | | not supported +| UninterpretedOption_NamePart | | Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names. + +When using TypeScript, the respective `...$Properties` types can be used to reference specific message types (i.e. `protobuf.Message`). diff --git a/ext/descriptor/index.d.ts b/ext/descriptor/index.d.ts index 40a558e5a..31ec94075 100644 --- a/ext/descriptor/index.d.ts +++ b/ext/descriptor/index.d.ts @@ -1,31 +1,31 @@ import * as $protobuf from "../.."; -type FileDescriptorSetProperties = { - file: FileDescriptorProtoProperties[]; +type FileDescriptorSet$Properties = { + file: FileDescriptorProto$Properties[]; }; -type FileDescriptorProtoProperties = { +type FileDescriptorProto$Properties = { name?: string; package?: string; dependency?: any; publicDependency?: any; weakDependency?: any; - messageType?: DescriptorProtoProperties[]; - enumType?: EnumDescriptorProtoProperties[]; - service?: ServiceDescriptorProtoProperties[]; - extension?: FieldDescriptorProtoProperties[]; - options?: FileOptionsProperties; + messageType?: DescriptorProto$Properties[]; + enumType?: EnumDescriptorProto$Properties[]; + service?: ServiceDescriptorProto$Properties[]; + extension?: FieldDescriptorProto$Properties[]; + options?: FileOptions$Properties; sourceCodeInfo?: any; syntax?: string; }; -type FileOptionsProperties = { +type FileOptions$Properties = { javaPackage?: string; javaOuterClassname?: string; javaMultipleFiles?: boolean; javaGenerateEqualsAndHash?: boolean; javaStringCheckUtf8?: boolean; - optimizeFor?: FileOptions_OptimizeMode; + optimizeFor?: FileOptions$OptimizeMode; goPackage?: string; ccGenericServices?: boolean; javaGenericServices?: boolean; @@ -36,101 +36,101 @@ type FileOptionsProperties = { csharpNamespace?: string; }; -type FileOptions_OptimizeMode = number; +type FileOptions$OptimizeMode = number; -type DescriptorProtoProperties = { +type DescriptorProto$Properties = { name?: string; - field?: FieldDescriptorProtoProperties[]; - extension?: FieldDescriptorProtoProperties[]; - nestedType?: DescriptorProtoProperties[]; - enumType?: EnumDescriptorProtoProperties[]; - extensionRange?: ExtensionRangeProperties[]; - oneofDecl?: OneofDescriptorProtoProperties[]; - options?: MessageOptionsProperties; - reservedRange?: ReservedRangeProperties[]; + field?: FieldDescriptorProto$Properties[]; + extension?: FieldDescriptorProto$Properties[]; + nestedType?: DescriptorProto$Properties[]; + enumType?: EnumDescriptorProto$Properties[]; + extensionRange?: ExtensionRange$Properties[]; + oneofDecl?: OneofDescriptorProto$Properties[]; + options?: MessageOptions$Properties; + reservedRange?: ReservedRange$Properties[]; reservedName?: string[]; }; -type MessageOptionsProperties = { +type MessageOptions$Properties = { mapEntry?: boolean; }; -type ExtensionRangeProperties = { +type ExtensionRange$Properties = { start?: number; end?: number; }; -type ReservedRangeProperties = { +type ReservedRange$Properties = { start?: number; end?: number; }; -type FieldDescriptorProtoProperties = { +type FieldDescriptorProto$Properties = { name?: string; number?: number; - label?: FieldDescriptorProto_Label; - type?: FieldDescriptorProto_Type; + label?: FieldDescriptorProto$Label; + type?: FieldDescriptorProto$Type; typeName?: string; extendee?: string; defaultValue?: string; oneofIndex?: number; jsonName?: any; - options?: FieldOptionsProperties; + options?: FieldOptions$Properties; }; -type FieldDescriptorProto_Label = number; +type FieldDescriptorProto$Label = number; -type FieldDescriptorProto_Type = number; +type FieldDescriptorProto$Type = number; -type FieldOptionsProperties = { +type FieldOptions$Properties = { packed?: boolean; - jstype?: FieldOptions_JSType; + jstype?: FieldOptions$JSType; }; -type FieldOptions_JSType = number; +type FieldOptions$JSType = number; -type EnumDescriptorProtoProperties = { +type EnumDescriptorProto$Properties = { name?: string; - value?: EnumValueDescriptorProtoProperties[]; - options?: EnumOptionsProperties; + value?: EnumValueDescriptorProto$Properties[]; + options?: EnumOptions$Properties; }; -type EnumValueDescriptorProtoProperties = { +type EnumValueDescriptorProto$Properties = { name?: string; number?: number; options?: any; }; -type EnumOptionsProperties = { +type EnumOptions$Properties = { allowAlias?: boolean; deprecated?: boolean; }; -type OneofDescriptorProtoProperties = { +type OneofDescriptorProto$Properties = { name?: string; options?: any; }; -type ServiceDescriptorProtoProperties = { +type ServiceDescriptorProto$Properties = { name?: string; - method?: MethodDescriptorProtoProperties[]; - options?: ServiceOptionsProperties; + method?: MethodDescriptorProto$Properties[]; + options?: ServiceOptions$Properties; }; -type ServiceOptionsProperties = { +type ServiceOptions$Properties = { deprecated?: boolean; }; -type MethodDescriptorProtoProperties = { +type MethodDescriptorProto$Properties = { name?: string; inputType?: string; outputType?: string; - options?: MethodOptionsProperties; + options?: MethodOptions$Properties; clientStreaming?: boolean; serverStreaming?: boolean; }; -type MethodOptionsProperties = { +type MethodOptions$Properties = { deprecated?: boolean; }; @@ -140,8 +140,16 @@ export const FileDescriptorProto: $protobuf.Type; export const DescriptorProto: $protobuf.Type; +export const DescriptorProto_ExtensionRange: $protobuf.Type; + +export const DescriptorProto_ReservedRange: $protobuf.Type; + export const FieldDescriptorProto: $protobuf.Type; +export const FieldDescriptorProto_Label: $protobuf.Enum; + +export const FieldDescriptorProto_Type: $protobuf.Enum; + export const OneofDescriptorProto: $protobuf.Type; export const EnumDescriptorProto: $protobuf.Type; @@ -154,10 +162,16 @@ export const MethodDescriptorProto: $protobuf.Type; export const FileOptions: $protobuf.Type; +export const FileOptions_OptimizeMode: $protobuf.Enum; + export const MessageOptions: $protobuf.Type; export const FieldOptions: $protobuf.Type; +export const FieldOptions_CType: $protobuf.Enum; + +export const FieldOptions_JSType: $protobuf.Enum; + export const OneofOptions: $protobuf.Type; export const EnumOptions: $protobuf.Type; @@ -170,6 +184,12 @@ export const MethodOptions: $protobuf.Type; export const UninterpretedOption: $protobuf.Type; +export const UninterpretedOption_NamePart: $protobuf.Type; + export const SourceCodeInfo: $protobuf.Type; +export const SourceCodeInfo_Location: $protobuf.Type; + export const GeneratedCodeInfo: $protobuf.Type; + +export const GeneratedCodeInfo_Annotation: $protobuf.Type; diff --git a/ext/descriptor/index.js b/ext/descriptor/index.js index b26b299cb..1e3291af8 100644 --- a/ext/descriptor/index.js +++ b/ext/descriptor/index.js @@ -16,39 +16,39 @@ var Namespace = $protobuf.Namespace, /** * Properties of a FileDescriptorSet message. - * @typedef FileDescriptorSetProperties + * @typedef FileDescriptorSet$Properties * @type {Object} - * @property {FileDescriptorProtoProperties[]} file Files + * @property {FileDescriptorProto$Properties[]} file Files */ /** * Properties of a FileDescriptorProto message. - * @typedef FileDescriptorProtoProperties + * @typedef FileDescriptorProto$Properties * @type {Object} * @property {string} [name] File name * @property {string} [package] Package * @property {*} [dependency] Not supported * @property {*} [publicDependency] Not supported * @property {*} [weakDependency] Not supported - * @property {DescriptorProtoProperties[]} [messageType] Nested message types - * @property {EnumDescriptorProtoProperties[]} [enumType] Nested enums - * @property {ServiceDescriptorProtoProperties[]} [service] Nested services - * @property {FieldDescriptorProtoProperties[]} [extension] Nested extension fields - * @property {FileOptionsProperties} [options] Options + * @property {DescriptorProto$Properties[]} [messageType] Nested message types + * @property {EnumDescriptorProto$Properties[]} [enumType] Nested enums + * @property {ServiceDescriptorProto$Properties[]} [service] Nested services + * @property {FieldDescriptorProto$Properties[]} [extension] Nested extension fields + * @property {FileOptions$Properties} [options] Options * @property {*} [sourceCodeInfo] Not supported * @property {string} [syntax="proto2"] Syntax */ /** * Properties of a FileOptions message. - * @typedef FileOptionsProperties + * @typedef FileOptions$Properties * @type {Object} * @property {string} [javaPackage] * @property {string} [javaOuterClassname] * @property {boolean} [javaMultipleFiles] * @property {boolean} [javaGenerateEqualsAndHash] * @property {boolean} [javaStringCheckUtf8] - * @property {FileOptions_OptimizeMode} [optimizeFor=1] + * @property {FileOptions$OptimizeMode} [optimizeFor=1] * @property {string} [goPackage] * @property {boolean} [ccGenericServices] * @property {boolean} [javaGenericServices] @@ -61,7 +61,7 @@ var Namespace = $protobuf.Namespace, /** * Values of he FileOptions.OptimizeMode enum. - * @typedef FileOptions_OptimizeMode + * @typedef FileOptions$OptimizeMode * @type {number} * @property {number} SPEED=1 * @property {number} CODE_SIZE=2 @@ -70,7 +70,7 @@ var Namespace = $protobuf.Namespace, /** * Creates a root from a descriptor set. - * @param {FileDescriptorSetProperties|Reader|Uint8Array} descriptor Descriptor + * @param {FileDescriptorSet$Properties|Reader|Uint8Array} descriptor Descriptor * @returns {Root} Root instance */ Root.fromDescriptor = function fromDescriptor(descriptor) { @@ -113,7 +113,7 @@ Root.fromDescriptor = function fromDescriptor(descriptor) { /** * Converts a root to a descriptor set. - * @returns {Message} Descriptor + * @returns {Message} Descriptor * @param {string} [syntax="proto2"] Syntax */ Root.prototype.toDescriptor = function toDescriptor(syntax) { @@ -157,30 +157,30 @@ function Root_toDescriptorRecursive(ns, files, syntax) { /** * Properties of a DescriptorProto message. - * @typedef DescriptorProtoProperties + * @typedef DescriptorProto$Properties * @type {Object} * @property {string} [name] Message type name - * @property {FieldDescriptorProtoProperties[]} [field] Fields - * @property {FieldDescriptorProtoProperties[]} [extension] Extension fields - * @property {DescriptorProtoProperties[]} [nestedType] Nested message types - * @property {EnumDescriptorProtoProperties[]} [enumType] Nested enums - * @property {ExtensionRangeProperties[]} [extensionRange] Extension ranges - * @property {OneofDescriptorProtoProperties[]} [oneofDecl] Oneofs - * @property {MessageOptionsProperties} [options] Not supported - * @property {ReservedRangeProperties[]} [reservedRange] Reserved ranges + * @property {FieldDescriptorProto$Properties[]} [field] Fields + * @property {FieldDescriptorProto$Properties[]} [extension] Extension fields + * @property {DescriptorProto$Properties[]} [nestedType] Nested message types + * @property {EnumDescriptorProto$Properties[]} [enumType] Nested enums + * @property {ExtensionRange$Properties[]} [extensionRange] Extension ranges + * @property {OneofDescriptorProto$Properties[]} [oneofDecl] Oneofs + * @property {MessageOptions$Properties} [options] Not supported + * @property {ReservedRange$Properties[]} [reservedRange] Reserved ranges * @property {string[]} [reservedName] Reserved names */ /** * Properties of a MessageOptions message. - * @typedef MessageOptionsProperties + * @typedef MessageOptions$Properties * @type {Object} * @property {boolean} [mapEntry=false] Whether this message is a map entry */ /** * Properties of an ExtensionRange message. - * @typedef ExtensionRangeProperties + * @typedef ExtensionRange$Properties * @type {Object} * @property {number} [start] Start field id * @property {number} [end] End field id @@ -188,7 +188,7 @@ function Root_toDescriptorRecursive(ns, files, syntax) { /** * Properties of a ReservedRange message. - * @typedef ReservedRangeProperties + * @typedef ReservedRange$Properties * @type {Object} * @property {number} [start] Start field id * @property {number} [end] End field id @@ -198,7 +198,7 @@ var unnamedMessageIndex = 0; /** * Creates a type from a descriptor. - * @param {DescriptorProtoProperties|Reader|Uint8Array} descriptor Descriptor + * @param {DescriptorProto$Properties|Reader|Uint8Array} descriptor Descriptor * @param {string} [syntax="proto2"] Syntax * @returns {Type} Type instance */ @@ -254,7 +254,7 @@ Type.fromDescriptor = function fromDescriptor(descriptor, syntax) { /** * Converts a type to a descriptor. - * @returns {Message} Descriptor + * @returns {Message} Descriptor * @param {string} [syntax="proto2"] Syntax */ Type.prototype.toDescriptor = function toDescriptor(syntax) { @@ -310,23 +310,23 @@ Type.prototype.toDescriptor = function toDescriptor(syntax) { /** * Properties of a FieldDescriptorProto message. - * @typedef FieldDescriptorProtoProperties + * @typedef FieldDescriptorProto$Properties * @type {Object} * @property {string} [name] Field name * @property {number} [number] Field id - * @property {FieldDescriptorProto_Label} [label] Field rule - * @property {FieldDescriptorProto_Type} [type] Field basic type + * @property {FieldDescriptorProto$Label} [label] Field rule + * @property {FieldDescriptorProto$Type} [type] Field basic type * @property {string} [typeName] Field type name * @property {string} [extendee] Extended type name * @property {string} [defaultValue] Literal default value * @property {number} [oneofIndex] Oneof index if part of a oneof * @property {*} [jsonName] Not supported - * @property {FieldOptionsProperties} [options] Field options + * @property {FieldOptions$Properties} [options] Field options */ /** * Values of the FieldDescriptorProto.Label enum. - * @typedef FieldDescriptorProto_Label + * @typedef FieldDescriptorProto$Label * @type {number} * @property {number} LABEL_OPTIONAL=1 * @property {number} LABEL_REQUIRED=2 @@ -335,7 +335,7 @@ Type.prototype.toDescriptor = function toDescriptor(syntax) { /** * Values of the FieldDescriptorProto.Type enum. - * @typedef FieldDescriptorProto_Type + * @typedef FieldDescriptorProto$Type * @type {number} * @property {number} TYPE_DOUBLE=1 * @property {number} TYPE_FLOAT=2 @@ -359,15 +359,15 @@ Type.prototype.toDescriptor = function toDescriptor(syntax) { /** * Properties of a FieldOptions message. - * @typedef FieldOptionsProperties + * @typedef FieldOptions$Properties * @type {Object} * @property {boolean} [packed] Whether packed or not (defaults to `false` for proto2 and `true` for proto3) - * @property {FieldOptions_JSType} [jstype] JavaScript value type (not used by protobuf.js) + * @property {FieldOptions$JSType} [jstype] JavaScript value type (not used by protobuf.js) */ /** * Values of the FieldOptions.JSType enum. - * @typedef FieldOptions_JSType + * @typedef FieldOptions$JSType * @type {number} * @property {number} JS_NORMAL=0 * @property {number} JS_STRING=1 @@ -376,7 +376,7 @@ Type.prototype.toDescriptor = function toDescriptor(syntax) { /** * Creates a field from a descriptor. - * @param {FieldDescriptorProtoProperties|Reader|Uint8Array} descriptor Descriptor + * @param {FieldDescriptorProto$Properties|Reader|Uint8Array} descriptor Descriptor * @param {string} [syntax="proto2"] Syntax * @returns {Field} Field instance */ @@ -447,7 +447,7 @@ Field.fromDescriptor = function fromDescriptor(descriptor, syntax) { /** * Converts a field to a descriptor. - * @returns {Message} Descriptor + * @returns {Message} Descriptor * @param {string} [syntax="proto2"] Syntax */ Field.prototype.toDescriptor = function toDescriptor(syntax) { @@ -506,16 +506,16 @@ Field.prototype.toDescriptor = function toDescriptor(syntax) { /** * Properties of an EnumDescriptorProto message. - * @typedef EnumDescriptorProtoProperties + * @typedef EnumDescriptorProto$Properties * @type {Object} * @property {string} [name] Enum name - * @property {EnumValueDescriptorProtoProperties[]} [value] Enum values - * @property {EnumOptionsProperties} [options] Enum options + * @property {EnumValueDescriptorProto$Properties[]} [value] Enum values + * @property {EnumOptions$Properties} [options] Enum options */ /** * Properties of an EnumValueDescriptorProto message. - * @typedef EnumValueDescriptorProtoProperties + * @typedef EnumValueDescriptorProto$Properties * @type {Object} * @property {string} [name] Name * @property {number} [number] Value @@ -524,7 +524,7 @@ Field.prototype.toDescriptor = function toDescriptor(syntax) { /** * Properties of an EnumOptions message. - * @typedef EnumOptionsProperties + * @typedef EnumOptions$Properties * @type {Object} * @property {boolean} [allowAlias] Whether aliases are allowed * @property {boolean} [deprecated] @@ -534,7 +534,7 @@ var unnamedEnumIndex = 0; /** * Creates an enum from a descriptor. - * @param {EnumDescriptorProtoProperties|Reader|Uint8Array} descriptor Descriptor + * @param {EnumDescriptorProto$Properties|Reader|Uint8Array} descriptor Descriptor * @returns {Enum} Enum instance */ Enum.fromDescriptor = function fromDescriptor(descriptor) { @@ -561,7 +561,7 @@ Enum.fromDescriptor = function fromDescriptor(descriptor) { /** * Converts an enum to a descriptor. - * @returns {Message} Descriptor + * @returns {Message} Descriptor */ Enum.prototype.toDescriptor = function toDescriptor() { @@ -581,7 +581,7 @@ Enum.prototype.toDescriptor = function toDescriptor() { /** * Properties of a OneofDescriptorProto message. - * @typedef OneofDescriptorProtoProperties + * @typedef OneofDescriptorProto$Properties * @type {Object} * @property {string} [name] Oneof name * @property {*} [options] Not supported @@ -591,7 +591,7 @@ var unnamedOneofIndex = 0; /** * Creates a oneof from a descriptor. - * @param {OneofDescriptorProtoProperties|Reader|Uint8Array} descriptor Descriptor + * @param {OneofDescriptorProto$Properties|Reader|Uint8Array} descriptor Descriptor * @returns {OneOf} OneOf instance */ OneOf.fromDescriptor = function fromDescriptor(descriptor) { @@ -609,7 +609,7 @@ OneOf.fromDescriptor = function fromDescriptor(descriptor) { /** * Converts a oneof to a descriptor. - * @returns {Message} Descriptor + * @returns {Message} Descriptor */ OneOf.prototype.toDescriptor = function toDescriptor() { return exports.OneofDescriptorProto.create({ @@ -622,16 +622,16 @@ OneOf.prototype.toDescriptor = function toDescriptor() { /** * Properties of a ServiceDescriptorProto message. - * @typedef ServiceDescriptorProtoProperties + * @typedef ServiceDescriptorProto$Properties * @type {Object} * @property {string} [name] Service name - * @property {MethodDescriptorProtoProperties[]} [method] Methods - * @property {ServiceOptionsProperties} [options] Options + * @property {MethodDescriptorProto$Properties[]} [method] Methods + * @property {ServiceOptions$Properties} [options] Options */ /** * Properties of a ServiceOptions message. - * @typedef ServiceOptionsProperties + * @typedef ServiceOptions$Properties * @type {Object} * @property {boolean} [deprecated] */ @@ -640,7 +640,7 @@ var unnamedServiceIndex = 0; /** * Creates a service from a descriptor. - * @param {ServiceDescriptorProtoProperties|Reader|Uint8Array} descriptor Descriptor + * @param {ServiceDescriptorProto$Properties|Reader|Uint8Array} descriptor Descriptor * @returns {Service} Service instance */ Service.fromDescriptor = function fromDescriptor(descriptor) { @@ -659,7 +659,7 @@ Service.fromDescriptor = function fromDescriptor(descriptor) { /** * Converts a service to a descriptor. - * @returns {Message} Descriptor + * @returns {Message} Descriptor */ Service.prototype.toDescriptor = function toDescriptor() { @@ -679,19 +679,19 @@ Service.prototype.toDescriptor = function toDescriptor() { /** * Properties of a MethodDescriptorProto message. - * @typedef MethodDescriptorProtoProperties + * @typedef MethodDescriptorProto$Properties * @type {Object} * @property {string} [name] Method name * @property {string} [inputType] Request type name * @property {string} [outputType] Response type name - * @property {MethodOptionsProperties} [options] Not supported + * @property {MethodOptions$Properties} [options] Not supported * @property {boolean} [clientStreaming=false] Whether requests are streamed * @property {boolean} [serverStreaming=false] Whether responses are streamed */ /** * Properties of a MethodOptions message. - * @typedef MethodOptionsProperties + * @typedef MethodOptions$Properties * @type {Object} * @property {boolean} [deprecated] */ @@ -700,7 +700,7 @@ var unnamedMethodIndex = 0; /** * Creates a method from a descriptor. - * @param {MethodDescriptorProtoProperties|Reader|Uint8Array} descriptor Descriptor + * @param {MethodDescriptorProto$Properties|Reader|Uint8Array} descriptor Descriptor * @returns {Method} Reflected method instance */ Method.fromDescriptor = function fromDescriptor(descriptor) { @@ -723,7 +723,7 @@ Method.fromDescriptor = function fromDescriptor(descriptor) { /** * Converts a method to a descriptor. - * @returns {Message} Descriptor + * @returns {Message} Descriptor */ Method.prototype.toDescriptor = function toDescriptor() { return exports.MethodDescriptorProto.create({ @@ -895,6 +895,24 @@ function underScore(str) { * @tstype $protobuf.Type */ +/** + * Reflected descriptor proto extension range. + * @name DescriptorProto_ExtensionRange + * @type {Type} + * @const + * @tstype $protobuf.Type + */ +exports.DescriptorProto_ExtensionRange = exports.DescriptorProto.ExtensionRange; + +/** + * Reflected descriptor proto reserved range. + * @name DescriptorProto_ReservedRange + * @type {Type} + * @const + * @tstype $protobuf.Type + */ +exports.DescriptorProto_ReservedRange = exports.DescriptorProto.ReservedRange; + /** * Reflected field descriptor proto. * @name FieldDescriptorProto @@ -903,6 +921,24 @@ function underScore(str) { * @tstype $protobuf.Type */ +/** + * Reflected field descriptor proto label. + * @name FieldDescriptorProto_Label + * @type {Enum} + * @const + * @tstype $protobuf.Enum + */ +exports.FieldDescriptorProto_Label = exports.FieldDescriptorProto.Label; + +/** + * Reflected field descriptor proto type. + * @name FieldDescriptorProto_Type + * @type {Enum} + * @const + * @tstype $protobuf.Enum + */ +exports.FieldDescriptorProto_Type = exports.FieldDescriptorProto.Type; + /** * Reflected oneof descriptor proto. * @name OneofDescriptorProto @@ -951,6 +987,15 @@ function underScore(str) { * @tstype $protobuf.Type */ +/** + * Reflected file options optimize mode. + * @name FileOptions_OptimizeMode + * @type {Type} + * @const + * @tstype $protobuf.Enum + */ +exports.FileOptions_OptimizeMode = exports.FileOptions.OptimizeMode; + /** * Reflected message options. * @name MessageOptions @@ -967,6 +1012,24 @@ function underScore(str) { * @tstype $protobuf.Type */ +/** + * Reflected field options c-type. + * @name FieldOptions_CType + * @type {Enum} + * @const + * @tstype $protobuf.Enum + */ +exports.FieldOptions_CType = exports.FieldOptions.CType; + +/** + * Reflected field options js-type. + * @name FieldOptions_JSType + * @type {Enum} + * @const + * @tstype $protobuf.Enum + */ +exports.FieldOptions_JSType = exports.FieldOptions.JSType; + /** * Reflected oneof options. * @name OneofOptions @@ -1015,6 +1078,15 @@ function underScore(str) { * @tstype $protobuf.Type */ +/** + * Reflected uninterpreted option name part. + * @name UninterpretedOption_NamePart + * @type {Type} + * @const + * @tstype $protobuf.Type + */ +exports.UninterpretedOption_NamePart = exports.UninterpretedOption.NamePart; + /** * Reflected source code info. * @name SourceCodeInfo @@ -1023,6 +1095,15 @@ function underScore(str) { * @tstype $protobuf.Type */ +/** + * Reflected source code info location. + * @name SourceCodeInfo_Location + * @type {Type} + * @const + * @tstype $protobuf.Type + */ +exports.SourceCodeInfo_Location = exports.SourceCodeInfo.Location; + /** * Reflected generated code info. * @name GeneratedCodeInfo @@ -1030,3 +1111,12 @@ function underScore(str) { * @const * @tstype $protobuf.Type */ + +/** + * Reflected generated code info annotation. + * @name GeneratedCodeInfo_Annotation + * @type {Type} + * @const + * @tstype $protobuf.Type + */ +exports.GeneratedCodeInfo_Annotation = exports.GeneratedCodeInfo.Annotation;