From 65637ffce20099df97ffbcdce50faccc8e97c366 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Sat, 31 Dec 2016 01:08:14 +0100 Subject: [PATCH] CLI: Do not wrap main definition as a module and export directly instead; CLI: Generate prettier definitions with --no-comments --- cli/pbts.js | 22 +- index.d.ts | 4203 +++++++++++++++--------------- lib/tsd-jsdoc/publish.js | 41 +- package.json | 2 +- scripts/gentests.js | 2 +- tests/data/test.d.ts | 5325 +++++--------------------------------- tests/typescript.ts | 2 +- 7 files changed, 2818 insertions(+), 6779 deletions(-) diff --git a/cli/pbts.js b/cli/pbts.js index 51abece73..d5268b965 100644 --- a/cli/pbts.js +++ b/cli/pbts.js @@ -22,12 +22,15 @@ exports.main = function(args, callback) { var argv = minimist(args, { alias: { name: "n", - out : "o" + out : "o", + main: "m", + global: "g" }, - string: [ "name", "out" ], - boolean: [ "comments" ], + string: [ "name", "out", "global" ], + boolean: [ "comments", "main" ], default: { - comments: true + comments: true, + main: false } }); @@ -43,9 +46,9 @@ exports.main = function(args, callback) { "Generates TypeScript definitions from annotated JavaScript files.", "", " -n, --name Wraps everything in a module of the specified name.", - "", " -o, --out Saves to a file instead of writing to stdout.", - "", + " -m, --main Whether building the main library without any imports.", + " -g, --global Name of the global object in browser environments, if any.", " --no-comments Does not output any JSDoc comments.", "", "usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." @@ -96,7 +99,12 @@ exports.main = function(args, callback) { "// Generated " + (new Date()).toUTCString().replace(/GMT/, "UTC"), "" ]; - if (argv.name !== "protobuf") + if (argv.global) + output.push( + "export as namespace " + argv.global + ";", + "" + ); + if (!argv.main) output.push( "import * as $protobuf from \"protobufjs\";", "" diff --git a/index.d.ts b/index.d.ts index 4acb70159..3bd243887 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,10 +1,15 @@ -// $> pbts --name protobuf --out index.d.ts src -// Generated Fri, 30 Dec 2016 23:13:42 UTC +// $> pbts --main --global protobuf --out index.d.ts src +// Generated Sat, 31 Dec 2016 00:05:20 UTC -export = protobuf; export as namespace protobuf; -declare namespace protobuf { +/** + * Constructs a class instance, which is also a message prototype. + * @classdesc Runtime class providing the tools to create your own custom classes. + * @constructor + * @param {Type} type Reflected type + */ +export class Class { /** * Constructs a class instance, which is also a message prototype. @@ -12,159 +17,164 @@ declare namespace protobuf { * @constructor * @param {Type} type Reflected type */ - class Class { - - /** - * Constructs a class instance, which is also a message prototype. - * @classdesc Runtime class providing the tools to create your own custom classes. - * @constructor - * @param {Type} type Reflected type - */ - constructor(type: Type); - - /** - * Constructs a new message prototype for the specified reflected type and sets up its constructor. - * @memberof Class - * @param {Type} type Reflected message type - * @param {*} [ctor] Custom constructor to set up, defaults to create a generic one if omitted - * @returns {Message} Message prototype - */ - static create(type: Type, ctor?: any): Message; - - /** - * Encodes a message of this type. - * @name Class#encode - * @function - * @param {Message|Object} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - */ - encode(message: (Message|Object), writer?: Writer): Writer; - - /** - * Encodes a message of this type preceeded by its length as a varint. - * @name Class#encodeDelimited - * @function - * @param {Message|Object} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - */ - encodeDelimited(message: (Message|Object), writer?: Writer): Writer; - - /** - * Decodes a message of this type. - * @name Class#decode - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode - * @returns {Message} Decoded message - */ - decode(readerOrBuffer: (Reader|Uint8Array)): Message; - - /** - * Decodes a message of this type preceeded by its length as a varint. - * @name Class#decodeDelimited - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode - * @returns {Message} Decoded message - */ - decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; - - /** - * Verifies a message of this type. - * @name Class#verify - * @function - * @param {Message|Object} message Message or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - verify(message: (Message|Object)): string; - } + constructor(type: Type); /** - * Provides common type definitions. - * Can also be used to provide additional google types or your own custom types. - * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name - * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition - * @returns {undefined} - * @property {Object.} google/protobuf/any.proto Any - * @property {Object.} google/protobuf/duration.proto Duration - * @property {Object.} google/protobuf/empty.proto Empty - * @property {Object.} google/protobuf/struct.proto Struct, Value, NullValue and ListValue - * @property {Object.} google/protobuf/timestamp.proto Timestamp - * @property {Object.} google/protobuf/wrappers.proto Wrappers + * Constructs a new message prototype for the specified reflected type and sets up its constructor. + * @memberof Class + * @param {Type} type Reflected message type + * @param {*} [ctor] Custom constructor to set up, defaults to create a generic one if omitted + * @returns {Message} Message prototype */ - function common(name: string, json: { [k: string]: any }): void; + static create(type: Type, ctor?: any): Message; /** - * A converter as used by {@link convert}. - * @typedef Converter - * @type {function} - * @param {Field} field Reflected field - * @param {*} value Value to convert - * @param {Object.} options Conversion options - * @returns {*} Converted value + * Encodes a message of this type. + * @name Class#encode + * @function + * @param {Message|Object} message Message to encode + * @param {Writer} [writer] Writer to use + * @returns {Writer} Writer */ - type Converter = (field: Field, value: any, options: { [k: string]: any }) => any; + encode(message: (Message|Object), writer?: Writer): Writer; /** - * Converts between JSON objects and messages, based on reflection information. - * @param {Type} type Type - * @param {*} source Source object - * @param {*} destination Destination object - * @param {Object.} options Conversion options - * @param {Converter} converter Conversion function - * @returns {*} `destination` - * @property {Converter} toJson To JSON converter using {@link JSONConversionOptions} - * @property {Converter} toMessage To message converter using {@link MessageConversionOptions} + * Encodes a message of this type preceeded by its length as a varint. + * @name Class#encodeDelimited + * @function + * @param {Message|Object} message Message to encode + * @param {Writer} [writer] Writer to use + * @returns {Writer} Writer */ - function convert(type: Type, source: any, destination: any, options: { [k: string]: any }, converter: Converter): any; - - /** - * JSON conversion options as used by {@link Message#asJSON} with {@link convert}. - * @typedef JSONConversionOptions - * @type {Object} - * @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field - * @property {*} [longs] Long conversion type. Only relevant with a long library. - * Valid values are `String` and `Number` (the global types). - * Defaults to a possibly unsafe number without, and a `Long` with a long library. - * @property {*} [enums=Number] Enum value conversion type. - * Valid values are `String` and `Number` (the global types). - * Defaults to the numeric ids. - * @property {*} [bytes] Bytes value conversion type. - * Valid values are `Array` and `String` (the global types). - * Defaults to return the underlying buffer type. - * @property {boolean} [defaults=false] Also sets default values on the resulting object - */ - interface JSONConversionOptions { - fieldsOnly?: boolean; - longs?: any; - enums?: any; - bytes?: any; - defaults?: boolean; - } + encodeDelimited(message: (Message|Object), writer?: Writer): Writer; /** - * Message conversion options as used by {@link Message.from} and {@link Type#from} with {@link convert}. - * @typedef MessageConversionOptions - * @type {Object} - * @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field + * Decodes a message of this type. + * @name Class#decode + * @function + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode + * @returns {Message} Decoded message */ - interface MessageConversionOptions { - fieldsOnly?: boolean; - } + decode(readerOrBuffer: (Reader|Uint8Array)): Message; /** - * Generates a decoder specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance + * Decodes a message of this type preceeded by its length as a varint. + * @name Class#decodeDelimited + * @function + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode + * @returns {Message} Decoded message */ - function decoder(mtype: Type): Codegen; + decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; /** - * Generates an encoder specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance + * Verifies a message of this type. + * @name Class#verify + * @function + * @param {Message|Object} message Message or plain object to verify + * @returns {?string} `null` if valid, otherwise the reason why it is not */ - function encoder(mtype: Type): Codegen; + verify(message: (Message|Object)): string; +} + +/** + * Provides common type definitions. + * Can also be used to provide additional google types or your own custom types. + * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name + * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition + * @returns {undefined} + * @property {Object.} google/protobuf/any.proto Any + * @property {Object.} google/protobuf/duration.proto Duration + * @property {Object.} google/protobuf/empty.proto Empty + * @property {Object.} google/protobuf/struct.proto Struct, Value, NullValue and ListValue + * @property {Object.} google/protobuf/timestamp.proto Timestamp + * @property {Object.} google/protobuf/wrappers.proto Wrappers + */ +export function common(name: string, json: { [k: string]: any }): void; + +/** + * A converter as used by {@link convert}. + * @typedef Converter + * @type {function} + * @param {Field} field Reflected field + * @param {*} value Value to convert + * @param {Object.} options Conversion options + * @returns {*} Converted value + */ +type Converter = (field: Field, value: any, options: { [k: string]: any }) => any; + +/** + * Converts between JSON objects and messages, based on reflection information. + * @param {Type} type Type + * @param {*} source Source object + * @param {*} destination Destination object + * @param {Object.} options Conversion options + * @param {Converter} converter Conversion function + * @returns {*} `destination` + * @property {Converter} toJson To JSON converter using {@link JSONConversionOptions} + * @property {Converter} toMessage To message converter using {@link MessageConversionOptions} + */ +export function convert(type: Type, source: any, destination: any, options: { [k: string]: any }, converter: Converter): any; + +/** + * JSON conversion options as used by {@link Message#asJSON} with {@link convert}. + * @typedef JSONConversionOptions + * @type {Object} + * @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field + * @property {*} [longs] Long conversion type. Only relevant with a long library. + * Valid values are `String` and `Number` (the global types). + * Defaults to a possibly unsafe number without, and a `Long` with a long library. + * @property {*} [enums=Number] Enum value conversion type. + * Valid values are `String` and `Number` (the global types). + * Defaults to the numeric ids. + * @property {*} [bytes] Bytes value conversion type. + * Valid values are `Array` and `String` (the global types). + * Defaults to return the underlying buffer type. + * @property {boolean} [defaults=false] Also sets default values on the resulting object + */ + +interface JSONConversionOptions { + fieldsOnly?: boolean; + longs?: any; + enums?: any; + bytes?: any; + defaults?: boolean; +} + +/** + * Message conversion options as used by {@link Message.from} and {@link Type#from} with {@link convert}. + * @typedef MessageConversionOptions + * @type {Object} + * @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field + */ + +interface MessageConversionOptions { + fieldsOnly?: boolean; +} + +/** + * Generates a decoder specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +export function decoder(mtype: Type): Codegen; + +/** + * Generates an encoder specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +export function encoder(mtype: Type): Codegen; + +/** + * Constructs a new enum instance. + * @classdesc Reflected enum. + * @extends ReflectionObject + * @constructor + * @param {string} name Unique name within its namespace + * @param {Object.} [values] Enum values as an object, by name + * @param {Object.} [options] Declared options + */ +export class Enum extends ReflectionObject { /** * Constructs a new enum instance. @@ -175,76 +185,79 @@ declare namespace protobuf { * @param {Object.} [values] Enum values as an object, by name * @param {Object.} [options] Declared options */ - class Enum extends ReflectionObject { + constructor(name: string, values?: { [k: string]: number }, options?: { [k: string]: any }); - /** - * Constructs a new enum instance. - * @classdesc Reflected enum. - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {Object.} [values] Enum values as an object, by name - * @param {Object.} [options] Declared options - */ - constructor(name: string, values?: { [k: string]: number }, options?: { [k: string]: any }); + /** + * Enum values by name. + * @type {Object.} + */ + values: { [k: string]: number }; - /** - * Enum values by name. - * @type {Object.} - */ - values: { [k: string]: number }; + /** + * Enum values by id. + * @name Enum#valuesById + * @type {Object.} + * @readonly + */ + readonly valuesById: { [k: number]: string }; - /** - * Enum values by id. - * @name Enum#valuesById - * @type {Object.} - * @readonly - */ - readonly valuesById: { [k: number]: string }; + /** + * Gets this enum's values by id. This is an alias of {@link Enum#valuesById|valuesById}'s getter for use within non-ES5 environments. + * @name Enum#getValuesById + * @function + * @returns {Object.} + */ + getValuesById(): { [k: number]: string }; - /** - * Gets this enum's values by id. This is an alias of {@link Enum#valuesById|valuesById}'s getter for use within non-ES5 environments. - * @name Enum#getValuesById - * @function - * @returns {Object.} - */ - getValuesById(): { [k: number]: string }; + /** + * Tests if the specified JSON object describes an enum. + * @param {*} json JSON object to test + * @returns {boolean} `true` if the object describes an enum + */ + static testJSON(json: any): boolean; - /** - * Tests if the specified JSON object describes an enum. - * @param {*} json JSON object to test - * @returns {boolean} `true` if the object describes an enum - */ - static testJSON(json: any): boolean; + /** + * Creates an enum from JSON. + * @param {string} name Enum name + * @param {Object.} json JSON object + * @returns {Enum} Created enum + * @throws {TypeError} If arguments are invalid + */ + static fromJSON(name: string, json: { [k: string]: any }): Enum; - /** - * Creates an enum from JSON. - * @param {string} name Enum name - * @param {Object.} json JSON object - * @returns {Enum} Created enum - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): Enum; + /** + * Adds a value to this enum. + * @param {string} name Value name + * @param {number} id Value id + * @returns {Enum} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If there is already a value with this name or id + */ + add(name: string, id: number): Enum; - /** - * Adds a value to this enum. - * @param {string} name Value name - * @param {number} id Value id - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a value with this name or id - */ - add(name: string, id: number): Enum; + /** + * Removes a value from this enum + * @param {string} name Value name + * @returns {Enum} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If `name` is not a name of this enum + */ + remove(name: string): Enum; +} - /** - * Removes a value from this enum - * @param {string} name Value name - * @returns {Enum} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `name` is not a name of this enum - */ - remove(name: string): Enum; - } +/** + * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. + * @classdesc Reflected message field. + * @extends ReflectionObject + * @constructor + * @param {string} name Unique name within its namespace + * @param {number} id Unique id within its namespace + * @param {string} type Value type + * @param {string|Object.} [rule="optional"] Field rule + * @param {string|Object.} [extend] Extended type if different from parent + * @param {Object.} [options] Declared options + */ +export class Field extends ReflectionObject { /** * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. @@ -258,222 +271,221 @@ declare namespace protobuf { * @param {string|Object.} [extend] Extended type if different from parent * @param {Object.} [options] Declared options */ - class Field extends ReflectionObject { - - /** - * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. - * @classdesc Reflected message field. - * @extends ReflectionObject - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} type Value type - * @param {string|Object.} [rule="optional"] Field rule - * @param {string|Object.} [extend] Extended type if different from parent - * @param {Object.} [options] Declared options - */ - constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any }); - - /** - * Field rule, if any. - * @type {string|undefined} - */ - rule: (string|undefined); - - /** - * Field type. - * @type {string} - */ - type: string; - - /** - * Unique field id. - * @type {number} - */ - id: number; + constructor(name: string, id: number, type: string, rule?: (string|{ [k: string]: any }), extend?: (string|{ [k: string]: any }), options?: { [k: string]: any }); - /** - * Extended type if different from parent. - * @type {string|undefined} - */ - extend: (string|undefined); - - /** - * Whether this field is required. - * @type {boolean} - */ - required: boolean; - - /** - * Whether this field is optional. - * @type {boolean} - */ - optional: boolean; - - /** - * Whether this field is repeated. - * @type {boolean} - */ - repeated: boolean; - - /** - * Whether this field is a map or not. - * @type {boolean} - */ - map: boolean; + /** + * Field rule, if any. + * @type {string|undefined} + */ + rule: (string|undefined); - /** - * Message this field belongs to. - * @type {?Type} - */ - message: Type; + /** + * Field type. + * @type {string} + */ + type: string; - /** - * OneOf this field belongs to, if any, - * @type {?OneOf} - */ - partOf: OneOf; + /** + * Unique field id. + * @type {number} + */ + id: number; - /** - * The field's default value. Only relevant when working with proto2. - * @type {*} - */ - defaultValue: any; + /** + * Extended type if different from parent. + * @type {string|undefined} + */ + extend: (string|undefined); - /** - * Whether this field's value should be treated as a long. - * @type {boolean} - */ - long: boolean; + /** + * Whether this field is required. + * @type {boolean} + */ + required: boolean; - /** - * Whether this field's value is a buffer. - * @type {boolean} - */ - bytes: boolean; + /** + * Whether this field is optional. + * @type {boolean} + */ + optional: boolean; - /** - * Resolved type if not a basic type. - * @type {?(Type|Enum)} - */ - resolvedType: (Type|Enum); + /** + * Whether this field is repeated. + * @type {boolean} + */ + repeated: boolean; - /** - * Sister-field within the extended type if a declaring extension field. - * @type {?Field} - */ - extensionField: Field; + /** + * Whether this field is a map or not. + * @type {boolean} + */ + map: boolean; - /** - * Sister-field within the declaring namespace if an extended field. - * @type {?Field} - */ - declaringField: Field; + /** + * Message this field belongs to. + * @type {?Type} + */ + message: Type; - /** - * Determines whether this field is packed. Only relevant when repeated and working with proto2. - * @name Field#packed - * @type {boolean} - * @readonly - */ - readonly packed: boolean; + /** + * OneOf this field belongs to, if any, + * @type {?OneOf} + */ + partOf: OneOf; - /** - * Determines whether this field is packed. This is an alias of {@link Field#packed|packed}'s getter for use within non-ES5 environments. - * @name Field#isPacked - * @function - * @returns {boolean} - */ - isPacked(): boolean; + /** + * The field's default value. Only relevant when working with proto2. + * @type {*} + */ + defaultValue: any; - /** - * Tests if the specified JSON object describes a field. - * @param {*} json Any JSON object to test - * @returns {boolean} `true` if the object describes a field - */ - static testJSON(json: any): boolean; + /** + * Whether this field's value should be treated as a long. + * @type {boolean} + */ + long: boolean; - /** - * Constructs a field from JSON. - * @param {string} name Field name - * @param {Object.} json JSON object - * @returns {Field} Created field - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): Field; + /** + * Whether this field's value is a buffer. + * @type {boolean} + */ + bytes: boolean; - /** - * Resolves this field's type references. - * @returns {Field} `this` - * @throws {Error} If any reference cannot be resolved - */ - resolve(): Field; - } + /** + * Resolved type if not a basic type. + * @type {?(Type|Enum)} + */ + resolvedType: (Type|Enum); /** - * A node-style callback as used by {@link load} and {@link Root#load}. - * @typedef LoadCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {Root} [root] Root, if there hasn't been an error - * @returns {undefined} + * Sister-field within the extended type if a declaring extension field. + * @type {?Field} */ - type LoadCallback = (error: Error, root?: Root) => void; + extensionField: Field; /** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @param {string|string[]} filename One or multiple files to load - * @param {Root} root Root namespace, defaults to create a new one if omitted. - * @param {LoadCallback} callback Callback function - * @returns {undefined} + * Sister-field within the declaring namespace if an extended field. + * @type {?Field} */ - function load(filename: (string|string[]), root: Root, callback: LoadCallback): void; + declaringField: Field; /** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. - * @name load - * @function - * @param {string|string[]} filename One or multiple files to load - * @param {LoadCallback} callback Callback function - * @returns {undefined} - * @variation 2 + * Determines whether this field is packed. Only relevant when repeated and working with proto2. + * @name Field#packed + * @type {boolean} + * @readonly */ - function load(filename: (string|string[]), callback: LoadCallback): void; + readonly packed: boolean; /** - * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. - * @name load + * Determines whether this field is packed. This is an alias of {@link Field#packed|packed}'s getter for use within non-ES5 environments. + * @name Field#isPacked * @function - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Promise} Promise - * @variation 3 + * @returns {boolean} */ - function load(filename: (string|string[]), root?: Root): Promise; + isPacked(): boolean; /** - * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). - * @param {string|string[]} filename One or multiple files to load - * @param {Root} [root] Root namespace, defaults to create a new one if omitted. - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid + * Tests if the specified JSON object describes a field. + * @param {*} json Any JSON object to test + * @returns {boolean} `true` if the object describes a field */ - function loadSync(filename: (string|string[]), root?: Root): Root; + static testJSON(json: any): boolean; /** - * Named roots. - * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). - * Can also be used manually to make roots available accross modules. - * @name roots - * @type {Object.} + * Constructs a field from JSON. + * @param {string} name Field name + * @param {Object.} json JSON object + * @returns {Field} Created field + * @throws {TypeError} If arguments are invalid */ - var roots: { [k: string]: Root }; + static fromJSON(name: string, json: { [k: string]: any }): Field; /** - * Reconfigures the library according to the environment. - * @returns {undefined} + * Resolves this field's type references. + * @returns {Field} `this` + * @throws {Error} If any reference cannot be resolved */ - function configure(): void; + resolve(): Field; +} + +/** + * A node-style callback as used by {@link load} and {@link Root#load}. + * @typedef LoadCallback + * @type {function} + * @param {?Error} error Error, if any, otherwise `null` + * @param {Root} [root] Root, if there hasn't been an error + * @returns {undefined} + */ +type LoadCallback = (error: Error, root?: Root) => void; + +/** + * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. + * @param {string|string[]} filename One or multiple files to load + * @param {Root} root Root namespace, defaults to create a new one if omitted. + * @param {LoadCallback} callback Callback function + * @returns {undefined} + */ +export function load(filename: (string|string[]), root: Root, callback: LoadCallback): void; + +/** + * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. + * @name load + * @function + * @param {string|string[]} filename One or multiple files to load + * @param {LoadCallback} callback Callback function + * @returns {undefined} + * @variation 2 + */ +export function load(filename: (string|string[]), callback: LoadCallback): void; + +/** + * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. + * @name load + * @function + * @param {string|string[]} filename One or multiple files to load + * @param {Root} [root] Root namespace, defaults to create a new one if omitted. + * @returns {Promise} Promise + * @variation 3 + */ +export function load(filename: (string|string[]), root?: Root): Promise; + +/** + * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). + * @param {string|string[]} filename One or multiple files to load + * @param {Root} [root] Root namespace, defaults to create a new one if omitted. + * @returns {Root} Root namespace + * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid + */ +export function loadSync(filename: (string|string[]), root?: Root): Root; + +/** + * Named roots. + * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). + * Can also be used manually to make roots available accross modules. + * @name roots + * @type {Object.} + */ +export var roots: { [k: string]: Root }; + +/** + * Reconfigures the library according to the environment. + * @returns {undefined} + */ +export function configure(): void; + +/** + * Constructs a new map field instance. + * @classdesc Reflected map field. + * @extends Field + * @constructor + * @param {string} name Unique name within its namespace + * @param {number} id Unique id within its namespace + * @param {string} keyType Key type + * @param {string} type Value type + * @param {Object.} [options] Declared options + */ +export class MapField extends Field { /** * Constructs a new map field instance. @@ -486,49 +498,47 @@ declare namespace protobuf { * @param {string} type Value type * @param {Object.} [options] Declared options */ - class MapField extends Field { + constructor(name: string, id: number, keyType: string, type: string, options?: { [k: string]: any }); - /** - * Constructs a new map field instance. - * @classdesc Reflected map field. - * @extends Field - * @constructor - * @param {string} name Unique name within its namespace - * @param {number} id Unique id within its namespace - * @param {string} keyType Key type - * @param {string} type Value type - * @param {Object.} [options] Declared options - */ - constructor(name: string, id: number, keyType: string, type: string, options?: { [k: string]: any }); + /** + * Key type. + * @type {string} + */ + keyType: string; - /** - * Key type. - * @type {string} - */ - keyType: string; + /** + * Resolved key type if not a basic type. + * @type {?ReflectionObject} + */ + resolvedKeyType: ReflectionObject; - /** - * Resolved key type if not a basic type. - * @type {?ReflectionObject} - */ - resolvedKeyType: ReflectionObject; + /** + * Tests if the specified JSON object describes a map field. + * @param {*} json JSON object to test + * @returns {boolean} `true` if the object describes a field + */ + static testJSON(json: any): boolean; - /** - * Tests if the specified JSON object describes a map field. - * @param {*} json JSON object to test - * @returns {boolean} `true` if the object describes a field - */ - static testJSON(json: any): boolean; + /** + * Constructs a map field from JSON. + * @param {string} name Field name + * @param {Object.} json JSON object + * @returns {MapField} Created map field + * @throws {TypeError} If arguments are invalid + */ + static fromJSON(name: string, json: { [k: string]: any }): MapField; +} - /** - * Constructs a map field from JSON. - * @param {string} name Field name - * @param {Object.} json JSON object - * @returns {MapField} Created map field - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): MapField; - } +/** + * Constructs a new message instance. + * + * This function should also be called from your custom constructors, i.e. `Message.call(this, properties)`. + * @classdesc Abstract runtime message. + * @constructor + * @param {Object.} [properties] Properties to set + * @see {@link Class.create} + */ +export class Message { /** * Constructs a new message instance. @@ -539,93 +549,97 @@ declare namespace protobuf { * @param {Object.} [properties] Properties to set * @see {@link Class.create} */ - class Message { + constructor(properties?: { [k: string]: any }); - /** - * Constructs a new message instance. - * - * This function should also be called from your custom constructors, i.e. `Message.call(this, properties)`. - * @classdesc Abstract runtime message. - * @constructor - * @param {Object.} [properties] Properties to set - * @see {@link Class.create} - */ - constructor(properties?: { [k: string]: any }); + /** + * Reference to the reflected type. + * @name Message.$type + * @type {Type} + * @readonly + */ + static readonly $type: Type; - /** - * Reference to the reflected type. - * @name Message.$type - * @type {Type} - * @readonly - */ - static readonly $type: Type; + /** + * Reference to the reflected type. + * @name Message#$type + * @type {Type} + * @readonly + */ + readonly $type: Type; - /** - * Reference to the reflected type. - * @name Message#$type - * @type {Type} - * @readonly - */ - readonly $type: Type; + /** + * Converts this message to a JSON object. + * @param {JSONConversionOptions} [options] Conversion options + * @returns {Object.} JSON object + */ + asJSON(options?: JSONConversionOptions): { [k: string]: any }; - /** - * Converts this message to a JSON object. - * @param {JSONConversionOptions} [options] Conversion options - * @returns {Object.} JSON object - */ - asJSON(options?: JSONConversionOptions): { [k: string]: any }; + /** + * Creates a message from a JSON object by converting strings and numbers to their respective field types. + * @param {Object.} object JSON object + * @param {MessageConversionOptions} [options] Options + * @returns {Message} Message instance + */ + static from(object: { [k: string]: any }, options?: MessageConversionOptions): Message; - /** - * Creates a message from a JSON object by converting strings and numbers to their respective field types. - * @param {Object.} object JSON object - * @param {MessageConversionOptions} [options] Options - * @returns {Message} Message instance - */ - static from(object: { [k: string]: any }, options?: MessageConversionOptions): Message; + /** + * Encodes a message of this type. + * @param {Message|Object} message Message to encode + * @param {Writer} [writer] Writer to use + * @returns {Writer} Writer + */ + static encode(message: (Message|Object), writer?: Writer): Writer; - /** - * Encodes a message of this type. - * @param {Message|Object} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - */ - static encode(message: (Message|Object), writer?: Writer): Writer; + /** + * Encodes a message of this type preceeded by its length as a varint. + * @param {Message|Object} message Message to encode + * @param {Writer} [writer] Writer to use + * @returns {Writer} Writer + */ + static encodeDelimited(message: (Message|Object), writer?: Writer): Writer; - /** - * Encodes a message of this type preceeded by its length as a varint. - * @param {Message|Object} message Message to encode - * @param {Writer} [writer] Writer to use - * @returns {Writer} Writer - */ - static encodeDelimited(message: (Message|Object), writer?: Writer): Writer; + /** + * Decodes a message of this type. + * @name Message.decode + * @function + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode + * @returns {Message} Decoded message + */ + static decode(readerOrBuffer: (Reader|Uint8Array)): Message; - /** - * Decodes a message of this type. - * @name Message.decode - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode - * @returns {Message} Decoded message - */ - static decode(readerOrBuffer: (Reader|Uint8Array)): Message; + /** + * Decodes a message of this type preceeded by its length as a varint. + * @name Message.decodeDelimited + * @function + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode + * @returns {Message} Decoded message + */ + static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; - /** - * Decodes a message of this type preceeded by its length as a varint. - * @name Message.decodeDelimited - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode - * @returns {Message} Decoded message - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; + /** + * Verifies a message of this type. + * @name Message.verify + * @function + * @param {Message|Object} message Message or plain object to verify + * @returns {?string} `null` if valid, otherwise the reason why it is not + */ + static verify(message: (Message|Object)): string; +} - /** - * Verifies a message of this type. - * @name Message.verify - * @function - * @param {Message|Object} message Message or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (Message|Object)): string; - } +/** + * Constructs a new service method instance. + * @classdesc Reflected service method. + * @extends ReflectionObject + * @constructor + * @param {string} name Method name + * @param {string|undefined} type Method type, usually `"rpc"` + * @param {string} requestType Request message type + * @param {string} responseType Response message type + * @param {boolean|Object.} [requestStream] Whether the request is streamed + * @param {boolean|Object.} [responseStream] Whether the response is streamed + * @param {Object.} [options] Declared options + */ +export class Method extends ReflectionObject { /** * Constructs a new service method instance. @@ -640,81 +654,76 @@ declare namespace protobuf { * @param {boolean|Object.} [responseStream] Whether the response is streamed * @param {Object.} [options] Declared options */ - class Method extends ReflectionObject { - - /** - * Constructs a new service method instance. - * @classdesc Reflected service method. - * @extends ReflectionObject - * @constructor - * @param {string} name Method name - * @param {string|undefined} type Method type, usually `"rpc"` - * @param {string} requestType Request message type - * @param {string} responseType Response message type - * @param {boolean|Object.} [requestStream] Whether the request is streamed - * @param {boolean|Object.} [responseStream] Whether the response is streamed - * @param {Object.} [options] Declared options - */ - constructor(name: string, type: (string|undefined), requestType: string, responseType: string, requestStream?: (boolean|{ [k: string]: any }), responseStream?: (boolean|{ [k: string]: any }), options?: { [k: string]: any }); + constructor(name: string, type: (string|undefined), requestType: string, responseType: string, requestStream?: (boolean|{ [k: string]: any }), responseStream?: (boolean|{ [k: string]: any }), options?: { [k: string]: any }); - /** - * Method type. - * @type {string} - */ - type: string; + /** + * Method type. + * @type {string} + */ + type: string; - /** - * Request type. - * @type {string} - */ - requestType: string; + /** + * Request type. + * @type {string} + */ + requestType: string; - /** - * Whether requests are streamed or not. - * @type {boolean|undefined} - */ - requestStream: (boolean|undefined); + /** + * Whether requests are streamed or not. + * @type {boolean|undefined} + */ + requestStream: (boolean|undefined); - /** - * Response type. - * @type {string} - */ - responseType: string; + /** + * Response type. + * @type {string} + */ + responseType: string; - /** - * Whether responses are streamed or not. - * @type {boolean|undefined} - */ - responseStream: (boolean|undefined); + /** + * Whether responses are streamed or not. + * @type {boolean|undefined} + */ + responseStream: (boolean|undefined); - /** - * Resolved request type. - * @type {?Type} - */ - resolvedRequestType: Type; + /** + * Resolved request type. + * @type {?Type} + */ + resolvedRequestType: Type; - /** - * Resolved response type. - * @type {?Type} - */ - resolvedResponseType: Type; + /** + * Resolved response type. + * @type {?Type} + */ + resolvedResponseType: Type; - /** - * Tests if the specified JSON object describes a service method. - * @param {*} json JSON object - * @returns {boolean} `true` if the object describes a map field - */ - static testJSON(json: any): boolean; + /** + * Tests if the specified JSON object describes a service method. + * @param {*} json JSON object + * @returns {boolean} `true` if the object describes a map field + */ + static testJSON(json: any): boolean; - /** - * Constructs a service method from JSON. - * @param {string} name Method name - * @param {Object.} json JSON object - * @returns {Method} Created method - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): Method; - } + /** + * Constructs a service method from JSON. + * @param {string} name Method name + * @param {Object.} json JSON object + * @returns {Method} Created method + * @throws {TypeError} If arguments are invalid + */ + static fromJSON(name: string, json: { [k: string]: any }): Method; +} + +/** + * Constructs a new namespace instance. + * @classdesc Reflected namespace and base class of all reflection objects containing nested objects. + * @extends ReflectionObject + * @constructor + * @param {string} name Namespace name + * @param {Object.} [options] Declared options + */ +export class Namespace extends ReflectionObject { /** * Constructs a new namespace instance. @@ -724,266 +733,267 @@ declare namespace protobuf { * @param {string} name Namespace name * @param {Object.} [options] Declared options */ - class Namespace extends ReflectionObject { + constructor(name: string, options?: { [k: string]: any }); - /** - * Constructs a new namespace instance. - * @classdesc Reflected namespace and base class of all reflection objects containing nested objects. - * @extends ReflectionObject - * @constructor - * @param {string} name Namespace name - * @param {Object.} [options] Declared options - */ - constructor(name: string, options?: { [k: string]: any }); + /** + * Nested objects by name. + * @type {Object.|undefined} + */ + nested: ({ [k: string]: ReflectionObject }|undefined); - /** - * Nested objects by name. - * @type {Object.|undefined} - */ - nested: ({ [k: string]: ReflectionObject }|undefined); + /** + * Nested objects of this namespace as an array for iteration. + * @name Namespace#nestedArray + * @type {ReflectionObject[]} + * @readonly + */ + readonly nestedArray: ReflectionObject[]; - /** - * Nested objects of this namespace as an array for iteration. - * @name Namespace#nestedArray - * @type {ReflectionObject[]} - * @readonly - */ - readonly nestedArray: ReflectionObject[]; + /** + * Tests if the specified JSON object describes not another reflection object. + * @param {*} json JSON object + * @returns {boolean} `true` if the object describes not another reflection object + */ + static testJSON(json: any): boolean; - /** - * Tests if the specified JSON object describes not another reflection object. - * @param {*} json JSON object - * @returns {boolean} `true` if the object describes not another reflection object - */ - static testJSON(json: any): boolean; + /** + * Constructs a namespace from JSON. + * @param {string} name Namespace name + * @param {Object.} json JSON object + * @returns {Namespace} Created namespace + * @throws {TypeError} If arguments are invalid + */ + static fromJSON(name: string, json: { [k: string]: any }): Namespace; - /** - * Constructs a namespace from JSON. - * @param {string} name Namespace name - * @param {Object.} json JSON object - * @returns {Namespace} Created namespace - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): Namespace; + /** + * Converts an array of reflection objects to JSON. + * @memberof Namespace + * @param {ReflectionObject[]} array Object array + * @returns {Object.|undefined} JSON object or `undefined` when array is empty + */ + static arrayToJSON(array: ReflectionObject[]): ({ [k: string]: any }|undefined); - /** - * Converts an array of reflection objects to JSON. - * @memberof Namespace - * @param {ReflectionObject[]} array Object array - * @returns {Object.|undefined} JSON object or `undefined` when array is empty - */ - static arrayToJSON(array: ReflectionObject[]): ({ [k: string]: any }|undefined); + /** + * Adds nested elements to this namespace from JSON. + * @param {Object.} nestedJson Nested JSON + * @returns {Namespace} `this` + */ + addJSON(nestedJson: { [k: string]: any }): Namespace; - /** - * Adds nested elements to this namespace from JSON. - * @param {Object.} nestedJson Nested JSON - * @returns {Namespace} `this` - */ - addJSON(nestedJson: { [k: string]: any }): Namespace; + /** + * Gets the nested object of the specified name. + * @param {string} name Nested object name + * @returns {?ReflectionObject} The reflection object or `null` if it doesn't exist + */ + get(name: string): ReflectionObject; - /** - * Gets the nested object of the specified name. - * @param {string} name Nested object name - * @returns {?ReflectionObject} The reflection object or `null` if it doesn't exist - */ - get(name: string): ReflectionObject; + /** + * Gets the values of the nested {@link Enum|enum} of the specified name. + * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. + * @param {string} name Nested enum name + * @returns {Object.} Enum values + * @throws {Error} If there is no such enum + */ + getEnum(name: string): { [k: string]: number }; - /** - * Gets the values of the nested {@link Enum|enum} of the specified name. - * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. - * @param {string} name Nested enum name - * @returns {Object.} Enum values - * @throws {Error} If there is no such enum - */ - getEnum(name: string): { [k: string]: number }; + /** + * Adds a nested object to this namespace. + * @param {ReflectionObject} object Nested object to add + * @returns {Namespace} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If there is already a nested object with this name + */ + add(object: ReflectionObject): Namespace; - /** - * Adds a nested object to this namespace. - * @param {ReflectionObject} object Nested object to add - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name - */ - add(object: ReflectionObject): Namespace; + /** + * Removes a nested object from this namespace. + * @param {ReflectionObject} object Nested object to remove + * @returns {Namespace} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If `object` is not a member of this namespace + */ + remove(object: ReflectionObject): Namespace; - /** - * Removes a nested object from this namespace. - * @param {ReflectionObject} object Nested object to remove - * @returns {Namespace} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this namespace - */ - remove(object: ReflectionObject): Namespace; + /** + * Defines additial namespaces within this one if not yet existing. + * @param {string|string[]} path Path to create + * @param {*} [json] Nested types to create from JSON + * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty + */ + define(path: (string|string[]), json?: any): Namespace; - /** - * Defines additial namespaces within this one if not yet existing. - * @param {string|string[]} path Path to create - * @param {*} [json] Nested types to create from JSON - * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty - */ - define(path: (string|string[]), json?: any): Namespace; + /** + * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree. + * @returns {Namespace} `this` + */ + resolveAll(): Namespace; - /** - * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree. - * @returns {Namespace} `this` - */ - resolveAll(): Namespace; + /** + * Looks up the reflection object at the specified path, relative to this namespace. + * @param {string|string[]} path Path to look up + * @param {function(new: ReflectionObject)} filterType Filter type, one of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. + * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked + * @returns {?ReflectionObject} Looked up object or `null` if none could be found + */ + lookup(path: (string|string[]), filterType: () => any, parentAlreadyChecked?: boolean): ReflectionObject; - /** - * Looks up the reflection object at the specified path, relative to this namespace. - * @param {string|string[]} path Path to look up - * @param {function(new: ReflectionObject)} filterType Filter type, one of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. - * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked - * @returns {?ReflectionObject} Looked up object or `null` if none could be found - */ - lookup(path: (string|string[]), filterType: () => any, parentAlreadyChecked?: boolean): ReflectionObject; + /** + * Looks up the reflection object at the specified path, relative to this namespace. + * @name Namespace#lookup + * @function + * @param {string|string[]} path Path to look up + * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked + * @returns {?ReflectionObject} Looked up object or `null` if none could be found + * @variation 2 + */ + lookup(path: (string|string[]), parentAlreadyChecked?: boolean): ReflectionObject; - /** - * Looks up the reflection object at the specified path, relative to this namespace. - * @name Namespace#lookup - * @function - * @param {string|string[]} path Path to look up - * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked - * @returns {?ReflectionObject} Looked up object or `null` if none could be found - * @variation 2 - */ - lookup(path: (string|string[]), parentAlreadyChecked?: boolean): ReflectionObject; + /** + * Looks up the {@link Type|type} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Type} Looked up type + * @throws {Error} If `path` does not point to a type + */ + lookupType(path: (string|string[])): Type; - /** - * Looks up the {@link Type|type} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Type} Looked up type - * @throws {Error} If `path` does not point to a type - */ - lookupType(path: (string|string[])): Type; + /** + * Looks up the {@link Service|service} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Service} Looked up service + * @throws {Error} If `path` does not point to a service + */ + lookupService(path: (string|string[])): Service; - /** - * Looks up the {@link Service|service} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Service} Looked up service - * @throws {Error} If `path` does not point to a service - */ - lookupService(path: (string|string[])): Service; + /** + * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it returns the enum's values directly and throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Object.} Enum values + * @throws {Error} If `path` does not point to an enum + */ + lookupEnum(path: (string|string[])): { [k: string]: number }; +} - /** - * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. - * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it returns the enum's values directly and throws instead of returning `null`. - * @param {string|string[]} path Path to look up - * @returns {Object.} Enum values - * @throws {Error} If `path` does not point to an enum - */ - lookupEnum(path: (string|string[])): { [k: string]: number }; - } +/** + * Constructs a new reflection object instance. + * @classdesc Base class of all reflection objects. + * @constructor + * @param {string} name Object name + * @param {Object.} [options] Declared options + * @abstract + */ +export abstract class ReflectionObject { /** - * Constructs a new reflection object instance. - * @classdesc Base class of all reflection objects. - * @constructor - * @param {string} name Object name - * @param {Object.} [options] Declared options - * @abstract + * Options. + * @type {Object.|undefined} */ - abstract class ReflectionObject { + options: ({ [k: string]: any }|undefined); - /** - * Options. - * @type {Object.|undefined} - */ - options: ({ [k: string]: any }|undefined); + /** + * Unique name within its namespace. + * @type {string} + */ + name: string; - /** - * Unique name within its namespace. - * @type {string} - */ - name: string; + /** + * Parent namespace. + * @type {?Namespace} + */ + parent: Namespace; - /** - * Parent namespace. - * @type {?Namespace} - */ - parent: Namespace; + /** + * Whether already resolved or not. + * @type {boolean} + */ + resolved: boolean; - /** - * Whether already resolved or not. - * @type {boolean} - */ - resolved: boolean; + /** + * Reference to the root namespace. + * @name ReflectionObject#root + * @type {Root} + * @readonly + */ + readonly root: Root; - /** - * Reference to the root namespace. - * @name ReflectionObject#root - * @type {Root} - * @readonly - */ - readonly root: Root; + /** + * Full name including leading dot. + * @name ReflectionObject#fullName + * @type {string} + * @readonly + */ + readonly fullName: string; - /** - * Full name including leading dot. - * @name ReflectionObject#fullName - * @type {string} - * @readonly - */ - readonly fullName: string; + /** + * Converts this reflection object to its JSON representation. + * @returns {Object.} JSON object + * @abstract + */ + toJSON(): { [k: string]: any }; - /** - * Converts this reflection object to its JSON representation. - * @returns {Object.} JSON object - * @abstract - */ - toJSON(): { [k: string]: any }; + /** + * Called when this object is added to a parent. + * @param {ReflectionObject} parent Parent added to + * @returns {undefined} + */ + onAdd(parent: ReflectionObject): void; - /** - * Called when this object is added to a parent. - * @param {ReflectionObject} parent Parent added to - * @returns {undefined} - */ - onAdd(parent: ReflectionObject): void; + /** + * Called when this object is removed from a parent. + * @param {ReflectionObject} parent Parent removed from + * @returns {undefined} + */ + onRemove(parent: ReflectionObject): void; - /** - * Called when this object is removed from a parent. - * @param {ReflectionObject} parent Parent removed from - * @returns {undefined} - */ - onRemove(parent: ReflectionObject): void; + /** + * Resolves this objects type references. + * @returns {ReflectionObject} `this` + */ + resolve(): ReflectionObject; - /** - * Resolves this objects type references. - * @returns {ReflectionObject} `this` - */ - resolve(): ReflectionObject; + /** + * Gets an option value. + * @param {string} name Option name + * @returns {*} Option value or `undefined` if not set + */ + getOption(name: string): any; - /** - * Gets an option value. - * @param {string} name Option name - * @returns {*} Option value or `undefined` if not set - */ - getOption(name: string): any; + /** + * Sets an option. + * @param {string} name Option name + * @param {*} value Option value + * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set + * @returns {ReflectionObject} `this` + */ + setOption(name: string, value: any, ifNotSet?: boolean): ReflectionObject; - /** - * Sets an option. - * @param {string} name Option name - * @param {*} value Option value - * @param {boolean} [ifNotSet] Sets the option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ - setOption(name: string, value: any, ifNotSet?: boolean): ReflectionObject; + /** + * Sets multiple options. + * @param {Object.} options Options to set + * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set + * @returns {ReflectionObject} `this` + */ + setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject; - /** - * Sets multiple options. - * @param {Object.} options Options to set - * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set - * @returns {ReflectionObject} `this` - */ - setOptions(options: { [k: string]: any }, ifNotSet?: boolean): ReflectionObject; + /** + * Converts this instance to its string representation. + * @returns {string} Class name[, space, full name] + */ + toString(): string; +} - /** - * Converts this instance to its string representation. - * @returns {string} Class name[, space, full name] - */ - toString(): string; - } +/** + * Constructs a new oneof instance. + * @classdesc Reflected oneof. + * @extends ReflectionObject + * @constructor + * @param {string} name Oneof name + * @param {string[]|Object} [fieldNames] Field names + * @param {Object.} [options] Declared options + */ +export class OneOf extends ReflectionObject { /** * Constructs a new oneof instance. @@ -994,111 +1004,108 @@ declare namespace protobuf { * @param {string[]|Object} [fieldNames] Field names * @param {Object.} [options] Declared options */ - class OneOf extends ReflectionObject { - - /** - * Constructs a new oneof instance. - * @classdesc Reflected oneof. - * @extends ReflectionObject - * @constructor - * @param {string} name Oneof name - * @param {string[]|Object} [fieldNames] Field names - * @param {Object.} [options] Declared options - */ - constructor(name: string, fieldNames?: (string[]|Object), options?: { [k: string]: any }); - - /** - * Upper cased name for getter/setter calls. - * @type {string} - */ - ucName: string; + constructor(name: string, fieldNames?: (string[]|Object), options?: { [k: string]: any }); - /** - * Field names that belong to this oneof. - * @type {string[]} - */ - oneof: string[]; - - /** - * Fields that belong to this oneof as an array for iteration. - * @name OneOf#fieldsArray - * @type {Field[]} - * @readonly - */ - readonly fieldsArray: Field[]; - - /** - * Tests if the specified JSON object describes a oneof. - * @param {*} json JSON object - * @returns {boolean} `true` if the object describes a oneof - */ - static testJSON(json: any): boolean; - - /** - * Constructs a oneof from JSON. - * @param {string} name Oneof name - * @param {Object.} json JSON object - * @returns {MapField} Created oneof - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): MapField; + /** + * Upper cased name for getter/setter calls. + * @type {string} + */ + ucName: string; - /** - * Adds a field to this oneof. - * @param {Field} field Field to add - * @returns {OneOf} `this` - */ - add(field: Field): OneOf; + /** + * Field names that belong to this oneof. + * @type {string[]} + */ + oneof: string[]; - /** - * Removes a field from this oneof. - * @param {Field} field Field to remove - * @returns {OneOf} `this` - */ - remove(field: Field): OneOf; - } + /** + * Fields that belong to this oneof as an array for iteration. + * @name OneOf#fieldsArray + * @type {Field[]} + * @readonly + */ + readonly fieldsArray: Field[]; /** - * Result object returned from {@link parse}. - * @typedef ParserResult - * @type {Object.} - * @property {string|undefined} package Package name, if declared - * @property {string[]|undefined} imports Imports, if any - * @property {string[]|undefined} weakImports Weak imports, if any - * @property {string|undefined} syntax Syntax, if specified (either `"proto2"` or `"proto3"`) - * @property {Root} root Populated root instance + * Tests if the specified JSON object describes a oneof. + * @param {*} json JSON object + * @returns {boolean} `true` if the object describes a oneof */ - type ParserResult = { [k: string]: any }; + static testJSON(json: any): boolean; /** - * Options modifying the behavior of {@link parse}. - * @typedef ParseOptions - * @type {Object.} - * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case + * Constructs a oneof from JSON. + * @param {string} name Oneof name + * @param {Object.} json JSON object + * @returns {MapField} Created oneof + * @throws {TypeError} If arguments are invalid */ - type ParseOptions = { [k: string]: any }; + static fromJSON(name: string, json: { [k: string]: any }): MapField; /** - * Parses the given .proto source and returns an object with the parsed contents. - * @function - * @param {string} source Source contents - * @param {Root} root Root to populate - * @param {ParseOptions} [options] Parse options - * @returns {ParserResult} Parser result - * @property {string} filename=null Currently processing file name for error reporting, if known + * Adds a field to this oneof. + * @param {Field} field Field to add + * @returns {OneOf} `this` */ - function parse(source: string, root: Root, options?: ParseOptions): ParserResult; + add(field: Field): OneOf; /** - * Parses the given .proto source and returns an object with the parsed contents. - * @name parse - * @function - * @param {string} source Source contents - * @param {ParseOptions} [options] Parse options - * @returns {ParserResult} Parser result - * @variation 2 + * Removes a field from this oneof. + * @param {Field} field Field to remove + * @returns {OneOf} `this` */ - function parse(source: string, options?: ParseOptions): ParserResult; + remove(field: Field): OneOf; +} + +/** + * Result object returned from {@link parse}. + * @typedef ParserResult + * @type {Object.} + * @property {string|undefined} package Package name, if declared + * @property {string[]|undefined} imports Imports, if any + * @property {string[]|undefined} weakImports Weak imports, if any + * @property {string|undefined} syntax Syntax, if specified (either `"proto2"` or `"proto3"`) + * @property {Root} root Populated root instance + */ +type ParserResult = { [k: string]: any }; + +/** + * Options modifying the behavior of {@link parse}. + * @typedef ParseOptions + * @type {Object.} + * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case + */ +type ParseOptions = { [k: string]: any }; + +/** + * Parses the given .proto source and returns an object with the parsed contents. + * @function + * @param {string} source Source contents + * @param {Root} root Root to populate + * @param {ParseOptions} [options] Parse options + * @returns {ParserResult} Parser result + * @property {string} filename=null Currently processing file name for error reporting, if known + */ +export function parse(source: string, root: Root, options?: ParseOptions): ParserResult; + +/** + * Parses the given .proto source and returns an object with the parsed contents. + * @name parse + * @function + * @param {string} source Source contents + * @param {ParseOptions} [options] Parse options + * @returns {ParserResult} Parser result + * @variation 2 + */ +export function parse(source: string, options?: ParseOptions): ParserResult; + +/** + * Constructs a new reader instance using the specified buffer. + * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. + * @constructor + * @param {Uint8Array} buffer Buffer to read from + */ +export class Reader { /** * Constructs a new reader instance using the specified buffer. @@ -1106,159 +1113,160 @@ declare namespace protobuf { * @constructor * @param {Uint8Array} buffer Buffer to read from */ - class Reader { + constructor(buffer: Uint8Array); - /** - * Constructs a new reader instance using the specified buffer. - * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. - * @constructor - * @param {Uint8Array} buffer Buffer to read from - */ - constructor(buffer: Uint8Array); + /** + * Read buffer. + * @type {Uint8Array} + */ + buf: Uint8Array; - /** - * Read buffer. - * @type {Uint8Array} - */ - buf: Uint8Array; + /** + * Read buffer position. + * @type {number} + */ + pos: number; - /** - * Read buffer position. - * @type {number} - */ - pos: number; + /** + * Read buffer length. + * @type {number} + */ + len: number; - /** - * Read buffer length. - * @type {number} - */ - len: number; + /** + * Creates a new reader using the specified buffer. + * @function + * @param {Uint8Array} buffer Buffer to read from + * @returns {BufferReader|Reader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} + */ + static create(buffer: Uint8Array): (BufferReader|Reader); - /** - * Creates a new reader using the specified buffer. - * @function - * @param {Uint8Array} buffer Buffer to read from - * @returns {BufferReader|Reader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} - */ - static create(buffer: Uint8Array): (BufferReader|Reader); + /** + * Reads a varint as an unsigned 32 bit value. + * @function + * @returns {number} Value read + */ + uint32(): number; - /** - * Reads a varint as an unsigned 32 bit value. - * @function - * @returns {number} Value read - */ - uint32(): number; + /** + * Reads a varint as a signed 32 bit value. + * @returns {number} Value read + */ + int32(): number; - /** - * Reads a varint as a signed 32 bit value. - * @returns {number} Value read - */ - int32(): number; + /** + * Reads a zig-zag encoded varint as a signed 32 bit value. + * @returns {number} Value read + */ + sint32(): number; - /** - * Reads a zig-zag encoded varint as a signed 32 bit value. - * @returns {number} Value read - */ - sint32(): number; + /** + * Reads a varint as a signed 64 bit value. + * @name Reader#int64 + * @function + * @returns {Long|number} Value read + */ + int64(): (Long|number); - /** - * Reads a varint as a signed 64 bit value. - * @name Reader#int64 - * @function - * @returns {Long|number} Value read - */ - int64(): (Long|number); + /** + * Reads a varint as an unsigned 64 bit value. + * @name Reader#uint64 + * @function + * @returns {Long|number} Value read + */ + uint64(): (Long|number); - /** - * Reads a varint as an unsigned 64 bit value. - * @name Reader#uint64 - * @function - * @returns {Long|number} Value read - */ - uint64(): (Long|number); + /** + * Reads a zig-zag encoded varint as a signed 64 bit value. + * @name Reader#sint64 + * @function + * @returns {Long|number} Value read + */ + sint64(): (Long|number); - /** - * Reads a zig-zag encoded varint as a signed 64 bit value. - * @name Reader#sint64 - * @function - * @returns {Long|number} Value read - */ - sint64(): (Long|number); + /** + * Reads a varint as a boolean. + * @returns {boolean} Value read + */ + bool(): boolean; - /** - * Reads a varint as a boolean. - * @returns {boolean} Value read - */ - bool(): boolean; + /** + * Reads fixed 32 bits as a number. + * @returns {number} Value read + */ + fixed32(): number; - /** - * Reads fixed 32 bits as a number. - * @returns {number} Value read - */ - fixed32(): number; + /** + * Reads zig-zag encoded fixed 32 bits as a number. + * @returns {number} Value read + */ + sfixed32(): number; - /** - * Reads zig-zag encoded fixed 32 bits as a number. - * @returns {number} Value read - */ - sfixed32(): number; + /** + * Reads fixed 64 bits. + * @name Reader#fixed64 + * @function + * @returns {Long|number} Value read + */ + fixed64(): (Long|number); - /** - * Reads fixed 64 bits. - * @name Reader#fixed64 - * @function - * @returns {Long|number} Value read - */ - fixed64(): (Long|number); + /** + * Reads zig-zag encoded fixed 64 bits. + * @name Reader#sfixed64 + * @function + * @returns {Long|number} Value read + */ + sfixed64(): (Long|number); - /** - * Reads zig-zag encoded fixed 64 bits. - * @name Reader#sfixed64 - * @function - * @returns {Long|number} Value read - */ - sfixed64(): (Long|number); + /** + * Reads a float (32 bit) as a number. + * @function + * @returns {number} Value read + */ + float(): number; - /** - * Reads a float (32 bit) as a number. - * @function - * @returns {number} Value read - */ - float(): number; + /** + * Reads a double (64 bit float) as a number. + * @function + * @returns {number} Value read + */ + double(): number; - /** - * Reads a double (64 bit float) as a number. - * @function - * @returns {number} Value read - */ - double(): number; + /** + * Reads a sequence of bytes preceeded by its length as a varint. + * @returns {Uint8Array} Value read + */ + bytes(): Uint8Array; - /** - * Reads a sequence of bytes preceeded by its length as a varint. - * @returns {Uint8Array} Value read - */ - bytes(): Uint8Array; + /** + * Reads a string preceeded by its byte length as a varint. + * @returns {string} Value read + */ + string(): string; - /** - * Reads a string preceeded by its byte length as a varint. - * @returns {string} Value read - */ - string(): string; + /** + * Skips the specified number of bytes if specified, otherwise skips a varint. + * @param {number} [length] Length if known, otherwise a varint is assumed + * @returns {Reader} `this` + */ + skip(length?: number): Reader; - /** - * Skips the specified number of bytes if specified, otherwise skips a varint. - * @param {number} [length] Length if known, otherwise a varint is assumed - * @returns {Reader} `this` - */ - skip(length?: number): Reader; + /** + * Skips the next element of the specified wire type. + * @param {number} wireType Wire type received + * @returns {Reader} `this` + */ + skipType(wireType: number): Reader; +} - /** - * Skips the next element of the specified wire type. - * @param {number} wireType Wire type received - * @returns {Reader} `this` - */ - skipType(wireType: number): Reader; - } +/** + * Constructs a new buffer reader instance. + * @classdesc Wire format reader using node buffers. + * @extends Reader + * @constructor + * @param {Buffer} buffer Buffer to read from + */ +export class BufferReader extends Reader { /** * Constructs a new buffer reader instance. @@ -1267,17 +1275,17 @@ declare namespace protobuf { * @constructor * @param {Buffer} buffer Buffer to read from */ - class BufferReader extends Reader { + constructor(buffer: Buffer); +} - /** - * Constructs a new buffer reader instance. - * @classdesc Wire format reader using node buffers. - * @extends Reader - * @constructor - * @param {Buffer} buffer Buffer to read from - */ - constructor(buffer: Buffer); - } +/** + * Constructs a new root namespace instance. + * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. + * @extends Namespace + * @constructor + * @param {Object.} [options] Top level options + */ +export class Root extends Namespace { /** * Constructs a new root namespace instance. @@ -1286,82 +1294,83 @@ declare namespace protobuf { * @constructor * @param {Object.} [options] Top level options */ - class Root extends Namespace { + constructor(options?: { [k: string]: any }); - /** - * Constructs a new root namespace instance. - * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. - * @extends Namespace - * @constructor - * @param {Object.} [options] Top level options - */ - constructor(options?: { [k: string]: any }); + /** + * Deferred extension fields. + * @type {Field[]} + */ + deferred: Field[]; - /** - * Deferred extension fields. - * @type {Field[]} - */ - deferred: Field[]; + /** + * Resolved file names of loaded files. + * @type {string[]} + */ + files: string[]; - /** - * Resolved file names of loaded files. - * @type {string[]} - */ - files: string[]; + /** + * Loads a JSON definition into a root namespace. + * @param {Object.|*} json JSON definition + * @param {Root} [root] Root namespace, defaults to create a new one if omitted + * @returns {Root} Root namespace + */ + static fromJSON(json: ({ [k: string]: any }|any), root?: Root): Root; - /** - * Loads a JSON definition into a root namespace. - * @param {Object.|*} json JSON definition - * @param {Root} [root] Root namespace, defaults to create a new one if omitted - * @returns {Root} Root namespace - */ - static fromJSON(json: ({ [k: string]: any }|any), root?: Root): Root; + /** + * Resolves the path of an imported file, relative to the importing origin. + * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. + * @function + * @param {string} origin The file name of the importing file + * @param {string} target The file name being imported + * @returns {string} Resolved path to `target` + */ + resolvePath(origin: string, target: string): string; - /** - * Resolves the path of an imported file, relative to the importing origin. - * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. - * @function - * @param {string} origin The file name of the importing file - * @param {string} target The file name being imported - * @returns {string} Resolved path to `target` - */ - resolvePath(origin: string, target: string): string; + /** + * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. + * @param {string|string[]} filename Names of one or multiple files to load + * @param {ParseOptions} options Parse options + * @param {LoadCallback} callback Callback function + * @returns {undefined} + */ + load(filename: (string|string[]), options: ParseOptions, callback: LoadCallback): void; - /** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. - * @param {string|string[]} filename Names of one or multiple files to load - * @param {ParseOptions} options Parse options - * @param {LoadCallback} callback Callback function - * @returns {undefined} - */ - load(filename: (string|string[]), options: ParseOptions, callback: LoadCallback): void; + /** + * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. + * @name Root#load + * @function + * @param {string|string[]} filename Names of one or multiple files to load + * @param {ParseOptions} [options] Parse options + * @returns {Promise} Promise + * @variation 3 + */ + load(filename: (string|string[]), options?: ParseOptions): Promise; - /** - * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. - * @name Root#load - * @function - * @param {string|string[]} filename Names of one or multiple files to load - * @param {ParseOptions} [options] Parse options - * @returns {Promise} Promise - * @variation 3 - */ - load(filename: (string|string[]), options?: ParseOptions): Promise; + /** + * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace. + * @param {string|string[]} filename Names of one or multiple files to load + * @param {ParseOptions} [options] Parse options + * @returns {Root} Root namespace + * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid + */ + loadSync(filename: (string|string[]), options?: ParseOptions): Root; +} - /** - * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace. - * @param {string|string[]} filename Names of one or multiple files to load - * @param {ParseOptions} [options] Parse options - * @returns {Root} Root namespace - * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid - */ - loadSync(filename: (string|string[]), options?: ParseOptions): Root; - } +/** + * Streaming RPC helpers. + * @namespace + */ +export namespace rpc { /** - * Streaming RPC helpers. - * @namespace + * Constructs a new RPC service instance. + * @classdesc An RPC service as returned by {@link Service#create}. + * @memberof rpc + * @extends util.EventEmitter + * @constructor + * @param {RPCImpl} rpcImpl RPC implementation */ - namespace rpc { + class Service extends util.EventEmitter { /** * Constructs a new RPC service instance. @@ -1371,32 +1380,33 @@ declare namespace protobuf { * @constructor * @param {RPCImpl} rpcImpl RPC implementation */ - class Service extends util.EventEmitter { - - /** - * Constructs a new RPC service instance. - * @classdesc An RPC service as returned by {@link Service#create}. - * @memberof rpc - * @extends util.EventEmitter - * @constructor - * @param {RPCImpl} rpcImpl RPC implementation - */ - constructor(rpcImpl: RPCImpl); - - /** - * RPC implementation. Becomes `null` once the service is ended. - * @type {?RPCImpl} - */ - $rpc: RPCImpl; - - /** - * Ends this service and emits the `end` event. - * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. - * @returns {rpc.Service} `this` - */ - end(endedByRPC?: boolean): rpc.Service; - } + constructor(rpcImpl: RPCImpl); + + /** + * RPC implementation. Becomes `null` once the service is ended. + * @type {?RPCImpl} + */ + $rpc: RPCImpl; + + /** + * Ends this service and emits the `end` event. + * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. + * @returns {rpc.Service} `this` + */ + end(endedByRPC?: boolean): rpc.Service; } +} + +/** + * Constructs a new service instance. + * @classdesc Reflected service. + * @extends Namespace + * @constructor + * @param {string} name Service name + * @param {Object.} [options] Service options + * @throws {TypeError} If arguments are invalid + */ +export class Service extends Namespace { /** * Constructs a new service instance. @@ -1407,97 +1417,96 @@ declare namespace protobuf { * @param {Object.} [options] Service options * @throws {TypeError} If arguments are invalid */ - class Service extends Namespace { - - /** - * Constructs a new service instance. - * @classdesc Reflected service. - * @extends Namespace - * @constructor - * @param {string} name Service name - * @param {Object.} [options] Service options - * @throws {TypeError} If arguments are invalid - */ - constructor(name: string, options?: { [k: string]: any }); - - /** - * Service methods. - * @type {Object.} - */ - methods: { [k: string]: Method }; - - /** - * Methods of this service as an array for iteration. - * @name Service#methodsArray - * @type {Method[]} - * @readonly - */ - readonly methodsArray: Method[]; - - /** - * Tests if the specified JSON object describes a service. - * @param {*} json JSON object to test - * @returns {boolean} `true` if the object describes a service - */ - static testJSON(json: any): boolean; + constructor(name: string, options?: { [k: string]: any }); - /** - * Constructs a service from JSON. - * @param {string} name Service name - * @param {Object.} json JSON object - * @returns {Service} Created service - * @throws {TypeError} If arguments are invalid - */ - static fromJSON(name: string, json: { [k: string]: any }): Service; - - /** - * Creates a runtime service using the specified rpc implementation. - * @param {function(Method, Uint8Array, function)} rpcImpl {@link RPCImpl|RPC implementation} - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {rpc.Service} Runtime RPC service. Useful where requests and/or responses are streamed. - */ - create(rpcImpl: () => any, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service; - } + /** + * Service methods. + * @type {Object.} + */ + methods: { [k: string]: Method }; /** - * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. - * @typedef RPCImpl - * @type {function} - * @param {Method} method Reflected method being called - * @param {Uint8Array} requestData Request data - * @param {RPCCallback} callback Callback function - * @returns {undefined} + * Methods of this service as an array for iteration. + * @name Service#methodsArray + * @type {Method[]} + * @readonly */ - type RPCImpl = (method: Method, requestData: Uint8Array, callback: RPCCallback) => void; + readonly methodsArray: Method[]; /** - * Node-style callback as used by {@link RPCImpl}. - * @typedef RPCCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {Uint8Array} [responseData] Response data or `null` to signal end of stream, if there hasn't been an error - * @returns {undefined} + * Tests if the specified JSON object describes a service. + * @param {*} json JSON object to test + * @returns {boolean} `true` if the object describes a service */ - type RPCCallback = (error: Error, responseData?: Uint8Array) => void; + static testJSON(json: any): boolean; /** - * Handle object returned from {@link tokenize}. - * @typedef {Object.} TokenizerHandle - * @property {function():number} line Gets the current line number - * @property {function():?string} next Gets the next token and advances (`null` on eof) - * @property {function():?string} peek Peeks for the next token (`null` on eof) - * @property {function(string)} push Pushes a token back to the stack - * @property {function(string, boolean=):boolean} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws + * Constructs a service from JSON. + * @param {string} name Service name + * @param {Object.} json JSON object + * @returns {Service} Created service + * @throws {TypeError} If arguments are invalid */ - type TokenizerHandle = { [k: string]: any }; + static fromJSON(name: string, json: { [k: string]: any }): Service; /** - * Tokenizes the given .proto source and returns an object with useful utility functions. - * @param {string} source Source contents - * @returns {TokenizerHandle} Tokenizer handle + * Creates a runtime service using the specified rpc implementation. + * @param {function(Method, Uint8Array, function)} rpcImpl {@link RPCImpl|RPC implementation} + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {rpc.Service} Runtime RPC service. Useful where requests and/or responses are streamed. */ - function tokenize(source: string): TokenizerHandle; + create(rpcImpl: () => any, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service; +} + +/** + * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. + * @typedef RPCImpl + * @type {function} + * @param {Method} method Reflected method being called + * @param {Uint8Array} requestData Request data + * @param {RPCCallback} callback Callback function + * @returns {undefined} + */ +type RPCImpl = (method: Method, requestData: Uint8Array, callback: RPCCallback) => void; + +/** + * Node-style callback as used by {@link RPCImpl}. + * @typedef RPCCallback + * @type {function} + * @param {?Error} error Error, if any, otherwise `null` + * @param {Uint8Array} [responseData] Response data or `null` to signal end of stream, if there hasn't been an error + * @returns {undefined} + */ +type RPCCallback = (error: Error, responseData?: Uint8Array) => void; + +/** + * Handle object returned from {@link tokenize}. + * @typedef {Object.} TokenizerHandle + * @property {function():number} line Gets the current line number + * @property {function():?string} next Gets the next token and advances (`null` on eof) + * @property {function():?string} peek Peeks for the next token (`null` on eof) + * @property {function(string)} push Pushes a token back to the stack + * @property {function(string, boolean=):boolean} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws + */ +type TokenizerHandle = { [k: string]: any }; + +/** + * Tokenizes the given .proto source and returns an object with useful utility functions. + * @param {string} source Source contents + * @returns {TokenizerHandle} Tokenizer handle + */ +export function tokenize(source: string): TokenizerHandle; + +/** + * Constructs a new reflected message type instance. + * @classdesc Reflected message type. + * @extends Namespace + * @constructor + * @param {string} name Message name + * @param {Object.} [options] Declared options + */ +export class Type extends Namespace { /** * Constructs a new reflected message type instance. @@ -1507,455 +1516,454 @@ declare namespace protobuf { * @param {string} name Message name * @param {Object.} [options] Declared options */ - class Type extends Namespace { - - /** - * Constructs a new reflected message type instance. - * @classdesc Reflected message type. - * @extends Namespace - * @constructor - * @param {string} name Message name - * @param {Object.} [options] Declared options - */ - constructor(name: string, options?: { [k: string]: any }); - - /** - * Message fields. - * @type {Object.} - */ - fields: { [k: string]: Field }; - - /** - * Oneofs declared within this namespace, if any. - * @type {Object.} - */ - oneofs: { [k: string]: OneOf }; - - /** - * Extension ranges, if any. - * @type {number[][]} - */ - extensions: number[][]; - - /** - * Reserved ranges, if any. - * @type {number[][]} - */ - reserved: number[][]; + constructor(name: string, options?: { [k: string]: any }); - /** - * Message fields by id. - * @name Type#fieldsById - * @type {Object.} - * @readonly - */ - readonly fieldsById: { [k: number]: Field }; + /** + * Message fields. + * @type {Object.} + */ + fields: { [k: string]: Field }; - /** - * Fields of this message as an array for iteration. - * @name Type#fieldsArray - * @type {Field[]} - * @readonly - */ - readonly fieldsArray: Field[]; + /** + * Oneofs declared within this namespace, if any. + * @type {Object.} + */ + oneofs: { [k: string]: OneOf }; - /** - * Repeated fields of this message as an array for iteration. - * @name Type#repeatedFieldsArray - * @type {Field[]} - * @readonly - */ - readonly repeatedFieldsArray: Field[]; + /** + * Extension ranges, if any. + * @type {number[][]} + */ + extensions: number[][]; - /** - * Oneofs of this message as an array for iteration. - * @name Type#oneofsArray - * @type {OneOf[]} - * @readonly - */ - readonly oneofsArray: OneOf[]; + /** + * Reserved ranges, if any. + * @type {number[][]} + */ + reserved: number[][]; - /** - * The registered constructor, if any registered, otherwise a generic constructor. - * @name Type#ctor - * @type {Class} - */ - ctor: Class; + /** + * Message fields by id. + * @name Type#fieldsById + * @type {Object.} + * @readonly + */ + readonly fieldsById: { [k: number]: Field }; - /** - * Tests if the specified JSON object describes a message type. - * @param {*} json JSON object to test - * @returns {boolean} `true` if the object describes a message type - */ - static testJSON(json: any): boolean; + /** + * Fields of this message as an array for iteration. + * @name Type#fieldsArray + * @type {Field[]} + * @readonly + */ + readonly fieldsArray: Field[]; - /** - * Creates a type from JSON. - * @param {string} name Message name - * @param {Object.} json JSON object - * @returns {Type} Created message type - */ - static fromJSON(name: string, json: { [k: string]: any }): Type; + /** + * Repeated fields of this message as an array for iteration. + * @name Type#repeatedFieldsArray + * @type {Field[]} + * @readonly + */ + readonly repeatedFieldsArray: Field[]; - /** - * Adds a nested object to this type. - * @param {ReflectionObject} object Nested object to add - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id - */ - add(object: ReflectionObject): Type; + /** + * Oneofs of this message as an array for iteration. + * @name Type#oneofsArray + * @type {OneOf[]} + * @readonly + */ + readonly oneofsArray: OneOf[]; - /** - * Removes a nested object from this type. - * @param {ReflectionObject} object Nested object to remove - * @returns {Type} `this` - * @throws {TypeError} If arguments are invalid - * @throws {Error} If `object` is not a member of this type - */ - remove(object: ReflectionObject): Type; + /** + * The registered constructor, if any registered, otherwise a generic constructor. + * @name Type#ctor + * @type {Class} + */ + ctor: Class; - /** - * Creates a new message of this type using the specified properties. - * @param {Object.} [properties] Properties to set - * @returns {Message} Runtime message - */ - create(properties?: { [k: string]: any }): Message; + /** + * Tests if the specified JSON object describes a message type. + * @param {*} json JSON object to test + * @returns {boolean} `true` if the object describes a message type + */ + static testJSON(json: any): boolean; - /** - * Creates a new message of this type from a JSON object by converting strings and numbers to their respective field types. - * @param {Object.} object JSON object - * @param {MessageConversionOptions} [options] Conversion options - * @returns {Message} Runtime message - */ - from(object: { [k: string]: any }, options?: MessageConversionOptions): Message; + /** + * Creates a type from JSON. + * @param {string} name Message name + * @param {Object.} json JSON object + * @returns {Type} Created message type + */ + static fromJSON(name: string, json: { [k: string]: any }): Type; - /** - * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. - * @returns {Type} `this` - */ - setup(): Type; + /** + * Adds a nested object to this type. + * @param {ReflectionObject} object Nested object to add + * @returns {Type} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id + */ + add(object: ReflectionObject): Type; - /** - * Encodes a message of this type. - * @param {Message|Object} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ - encode(message: (Message|Object), writer?: Writer): Writer; + /** + * Removes a nested object from this type. + * @param {ReflectionObject} object Nested object to remove + * @returns {Type} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If `object` is not a member of this type + */ + remove(object: ReflectionObject): Type; - /** - * Encodes a message of this type preceeded by its byte length as a varint. - * @param {Message|Object} message Message instance or plain object - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} writer - */ - encodeDelimited(message: (Message|Object), writer?: Writer): Writer; + /** + * Creates a new message of this type using the specified properties. + * @param {Object.} [properties] Properties to set + * @returns {Message} Runtime message + */ + create(properties?: { [k: string]: any }): Message; - /** - * Decodes a message of this type. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Length of the message, if known beforehand - * @returns {Message} Decoded message - */ - decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Message; + /** + * Creates a new message of this type from a JSON object by converting strings and numbers to their respective field types. + * @param {Object.} object JSON object + * @param {MessageConversionOptions} [options] Conversion options + * @returns {Message} Runtime message + */ + from(object: { [k: string]: any }, options?: MessageConversionOptions): Message; - /** - * Decodes a message of this type preceeded by its byte length as a varint. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Message} Decoded message - */ - decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; + /** + * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. + * @returns {Type} `this` + */ + setup(): Type; - /** - * Verifies that field values are valid and that required fields are present. - * @param {Message|Object} message Message to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - verify(message: (Message|Object)): string; - } + /** + * Encodes a message of this type. + * @param {Message|Object} message Message instance or plain object + * @param {Writer} [writer] Writer to encode to + * @returns {Writer} writer + */ + encode(message: (Message|Object), writer?: Writer): Writer; /** - * Common type constants. - * @namespace + * Encodes a message of this type preceeded by its byte length as a varint. + * @param {Message|Object} message Message instance or plain object + * @param {Writer} [writer] Writer to encode to + * @returns {Writer} writer */ - namespace types { + encodeDelimited(message: (Message|Object), writer?: Writer): Writer; - /** - * Basic type wire types. - * @type {Object.} - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - * @property {number} bytes=2 Ldelim wire type - */ - var basic: { - "double": number, - "float": number, - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": number, - "string": number, - "bytes": number - }; + /** + * Decodes a message of this type. + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from + * @param {number} [length] Length of the message, if known beforehand + * @returns {Message} Decoded message + */ + decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Message; - /** - * Basic type defaults. - * @type {Object.} - * @property {number} double=0 Double default - * @property {number} float=0 Float default - * @property {number} int32=0 Int32 default - * @property {number} uint32=0 Uint32 default - * @property {number} sint32=0 Sint32 default - * @property {number} fixed32=0 Fixed32 default - * @property {number} sfixed32=0 Sfixed32 default - * @property {number} int64=0 Int64 default - * @property {number} uint64=0 Uint64 default - * @property {number} sint64=0 Sint32 default - * @property {number} fixed64=0 Fixed64 default - * @property {number} sfixed64=0 Sfixed64 default - * @property {boolean} bool=false Bool default - * @property {string} string="" String default - * @property {Array.} bytes=Array(0) Bytes default - * @property {Message} message=null Message default - */ - var defaults: { - "double": number, - "float": number, - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": boolean, - "string": string, - "bytes": number[], - "message": Message - }; + /** + * Decodes a message of this type preceeded by its byte length as a varint. + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from + * @returns {Message} Decoded message + */ + decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; - /** - * Basic long type wire types. - * @type {Object.} - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - */ - var long: { - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number - }; + /** + * Verifies that field values are valid and that required fields are present. + * @param {Message|Object} message Message to verify + * @returns {?string} `null` if valid, otherwise the reason why it is not + */ + verify(message: (Message|Object)): string; +} - /** - * Allowed types for map keys with their associated wire type. - * @type {Object.} - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - * @property {number} string=2 Ldelim wire type - */ - var mapKey: { - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": number, - "string": number - }; +/** + * Common type constants. + * @namespace + */ +export namespace types { - /** - * Allowed types for packed repeated fields with their associated wire type. - * @type {Object.} - * @property {number} double=1 Fixed64 wire type - * @property {number} float=5 Fixed32 wire type - * @property {number} int32=0 Varint wire type - * @property {number} uint32=0 Varint wire type - * @property {number} sint32=0 Varint wire type - * @property {number} fixed32=5 Fixed32 wire type - * @property {number} sfixed32=5 Fixed32 wire type - * @property {number} int64=0 Varint wire type - * @property {number} uint64=0 Varint wire type - * @property {number} sint64=0 Varint wire type - * @property {number} fixed64=1 Fixed64 wire type - * @property {number} sfixed64=1 Fixed64 wire type - * @property {number} bool=0 Varint wire type - */ - var packed: { - "double": number, - "float": number, - "int32": number, - "uint32": number, - "sint32": number, - "fixed32": number, - "sfixed32": number, - "int64": number, - "uint64": number, - "sint64": number, - "fixed64": number, - "sfixed64": number, - "bool": number - }; - } + /** + * Basic type wire types. + * @type {Object.} + * @property {number} double=1 Fixed64 wire type + * @property {number} float=5 Fixed32 wire type + * @property {number} int32=0 Varint wire type + * @property {number} uint32=0 Varint wire type + * @property {number} sint32=0 Varint wire type + * @property {number} fixed32=5 Fixed32 wire type + * @property {number} sfixed32=5 Fixed32 wire type + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + * @property {number} bool=0 Varint wire type + * @property {number} string=2 Ldelim wire type + * @property {number} bytes=2 Ldelim wire type + */ + var basic: { + "double": number, + "float": number, + "int32": number, + "uint32": number, + "sint32": number, + "fixed32": number, + "sfixed32": number, + "int64": number, + "uint64": number, + "sint64": number, + "fixed64": number, + "sfixed64": number, + "bool": number, + "string": number, + "bytes": number + }; /** - * A codegen instance as returned by {@link codegen}, that also is a sprintf-like appender function. - * @typedef Codegen - * @type {function} - * @param {string} format Format string - * @param {...*} args Replacements - * @returns {Codegen} Itself - * @property {function(string=):string} str Stringifies the so far generated function source. - * @property {function(string=, Object=):function} eof Ends generation and builds the function whilst applying a scope. + * Basic type defaults. + * @type {Object.} + * @property {number} double=0 Double default + * @property {number} float=0 Float default + * @property {number} int32=0 Int32 default + * @property {number} uint32=0 Uint32 default + * @property {number} sint32=0 Sint32 default + * @property {number} fixed32=0 Fixed32 default + * @property {number} sfixed32=0 Sfixed32 default + * @property {number} int64=0 Int64 default + * @property {number} uint64=0 Uint64 default + * @property {number} sint64=0 Sint32 default + * @property {number} fixed64=0 Fixed64 default + * @property {number} sfixed64=0 Sfixed64 default + * @property {boolean} bool=false Bool default + * @property {string} string="" String default + * @property {Array.} bytes=Array(0) Bytes default + * @property {Message} message=null Message default */ - type Codegen = (format: string, ...args: any[]) => Codegen; + var defaults: { + "double": number, + "float": number, + "int32": number, + "uint32": number, + "sint32": number, + "fixed32": number, + "sfixed32": number, + "int64": number, + "uint64": number, + "sint64": number, + "fixed64": number, + "sfixed64": number, + "bool": boolean, + "string": string, + "bytes": number[], + "message": Message + }; /** - * Node-style callback as used by {@link util.fetch}. - * @typedef FetchCallback - * @type {function} - * @param {?Error} error Error, if any, otherwise `null` - * @param {string} [contents] File contents, if there hasn't been an error - * @returns {undefined} + * Basic long type wire types. + * @type {Object.} + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type */ - type FetchCallback = (error: Error, contents?: string) => void; + var long: { + "int64": number, + "uint64": number, + "sint64": number, + "fixed64": number, + "sfixed64": number + }; /** - * Any compatible Long instance. - * @typedef Long - * @type {Object} - * @property {number} low Low bits - * @property {number} high High bits - * @property {boolean} unsigned Whether unsigned or not - */ - interface Long { - low: number; - high: number; - unsigned: boolean; - } + * Allowed types for map keys with their associated wire type. + * @type {Object.} + * @property {number} int32=0 Varint wire type + * @property {number} uint32=0 Varint wire type + * @property {number} sint32=0 Varint wire type + * @property {number} fixed32=5 Fixed32 wire type + * @property {number} sfixed32=5 Fixed32 wire type + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + * @property {number} bool=0 Varint wire type + * @property {number} string=2 Ldelim wire type + */ + var mapKey: { + "int32": number, + "uint32": number, + "sint32": number, + "fixed32": number, + "sfixed32": number, + "int64": number, + "uint64": number, + "sint64": number, + "fixed64": number, + "sfixed64": number, + "bool": number, + "string": number + }; /** - * An allocator as used by {@link util.pool}. - * @typedef PoolAllocator - * @type {function} - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer + * Allowed types for packed repeated fields with their associated wire type. + * @type {Object.} + * @property {number} double=1 Fixed64 wire type + * @property {number} float=5 Fixed32 wire type + * @property {number} int32=0 Varint wire type + * @property {number} uint32=0 Varint wire type + * @property {number} sint32=0 Varint wire type + * @property {number} fixed32=5 Fixed32 wire type + * @property {number} sfixed32=5 Fixed32 wire type + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + * @property {number} bool=0 Varint wire type */ - type PoolAllocator = (size: number) => Uint8Array; + var packed: { + "double": number, + "float": number, + "int32": number, + "uint32": number, + "sint32": number, + "fixed32": number, + "sfixed32": number, + "int64": number, + "uint64": number, + "sint64": number, + "fixed64": number, + "sfixed64": number, + "bool": number + }; +} + +/** + * A codegen instance as returned by {@link codegen}, that also is a sprintf-like appender function. + * @typedef Codegen + * @type {function} + * @param {string} format Format string + * @param {...*} args Replacements + * @returns {Codegen} Itself + * @property {function(string=):string} str Stringifies the so far generated function source. + * @property {function(string=, Object=):function} eof Ends generation and builds the function whilst applying a scope. + */ +type Codegen = (format: string, ...args: any[]) => Codegen; + +/** + * Node-style callback as used by {@link util.fetch}. + * @typedef FetchCallback + * @type {function} + * @param {?Error} error Error, if any, otherwise `null` + * @param {string} [contents] File contents, if there hasn't been an error + * @returns {undefined} + */ +type FetchCallback = (error: Error, contents?: string) => void; + +/** + * Any compatible Long instance. + * @typedef Long + * @type {Object} + * @property {number} low Low bits + * @property {number} high High bits + * @property {boolean} unsigned Whether unsigned or not + */ + +interface Long { + low: number; + high: number; + unsigned: boolean; +} + +/** + * An allocator as used by {@link util.pool}. + * @typedef PoolAllocator + * @type {function} + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ +type PoolAllocator = (size: number) => Uint8Array; + +/** + * A slicer as used by {@link util.pool}. + * @typedef PoolSlicer + * @type {function} + * @param {number} start Start offset + * @param {number} end End offset + * @returns {Uint8Array} Buffer slice + * @this {Uint8Array} + */ +type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array; + +/** + * Various utility functions. + * @namespace + */ +export namespace util { /** - * A slicer as used by {@link util.pool}. - * @typedef PoolSlicer - * @type {function} - * @param {number} start Start offset - * @param {number} end End offset - * @returns {Uint8Array} Buffer slice - * @this {Uint8Array} + * Returns a promise from a node-style callback function. + * @memberof util + * @param {function(?Error, ...*)} fn Function to call + * @param {*} ctx Function context + * @param {...*} params Function arguments + * @returns {Promise<*>} Promisified function */ - type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array; + function asPromise(fn: () => any, ctx: any, ...params: any[]): Promise; /** - * Various utility functions. + * A minimal base64 implementation for number arrays. + * @memberof util * @namespace */ - namespace util { + namespace base64 { /** - * Returns a promise from a node-style callback function. - * @memberof util - * @param {function(?Error, ...*)} fn Function to call - * @param {*} ctx Function context - * @param {...*} params Function arguments - * @returns {Promise<*>} Promisified function + * Calculates the byte length of a base64 encoded string. + * @param {string} string Base64 encoded string + * @returns {number} Byte length */ - function asPromise(fn: () => any, ctx: any, ...params: any[]): Promise; + function length(string: string): number; /** - * A minimal base64 implementation for number arrays. - * @memberof util - * @namespace + * Encodes a buffer to a base64 encoded string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} Base64 encoded string */ - namespace base64 { - - /** - * Calculates the byte length of a base64 encoded string. - * @param {string} string Base64 encoded string - * @returns {number} Byte length - */ - function length(string: string): number; - - /** - * Encodes a buffer to a base64 encoded string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} Base64 encoded string - */ - function encode(buffer: Uint8Array, start: number, end: number): string; - - /** - * Decodes a base64 encoded string to a buffer. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Number of bytes written - * @throws {Error} If encoding is invalid - */ - function decode(string: string, buffer: Uint8Array, offset: number): number; - } + function encode(buffer: Uint8Array, start: number, end: number): string; /** - * A closure for generating functions programmatically. - * @memberof util - * @namespace - * @function - * @param {...string} params Function parameter names - * @returns {Codegen} Codegen instance - * @property {boolean} supported Whether code generation is supported by the environment. - * @property {boolean} verbose=false When set to true, codegen will log generated code to console. Useful for debugging. + * Decodes a base64 encoded string to a buffer. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Number of bytes written + * @throws {Error} If encoding is invalid */ - function codegen(...params: string[]): Codegen; + function decode(string: string, buffer: Uint8Array, offset: number): number; + } + + /** + * A closure for generating functions programmatically. + * @memberof util + * @namespace + * @function + * @param {...string} params Function parameter names + * @returns {Codegen} Codegen instance + * @property {boolean} supported Whether code generation is supported by the environment. + * @property {boolean} verbose=false When set to true, codegen will log generated code to console. Useful for debugging. + */ + function codegen(...params: string[]): Codegen; + + /** + * Constructs a new event emitter instance. + * @classdesc A minimal event emitter. + * @memberof util + * @constructor + */ + class EventEmitter { /** * Constructs a new event emitter instance. @@ -1963,67 +1971,69 @@ declare namespace protobuf { * @memberof util * @constructor */ - class EventEmitter { - - /** - * Constructs a new event emitter instance. - * @classdesc A minimal event emitter. - * @memberof util - * @constructor - */ - constructor(); - - /** - * Registers an event listener. - * @param {string} evt Event name - * @param {function} fn Listener - * @param {*} [ctx] Listener context - * @returns {util.EventEmitter} `this` - */ - on(evt: string, fn: () => any, ctx?: any): util.EventEmitter; - - /** - * Removes an event listener or any matching listeners if arguments are omitted. - * @param {string} [evt] Event name. Removes all listeners if omitted. - * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. - * @returns {util.EventEmitter} `this` - */ - off(evt?: string, fn?: () => any): util.EventEmitter; - - /** - * Emits an event by calling its listeners with the specified arguments. - * @param {string} evt Event name - * @param {...*} args Arguments - * @returns {util.EventEmitter} `this` - */ - emit(evt: string, ...args: any[]): util.EventEmitter; - } + constructor(); /** - * Lets the specified constructor extend `this` class. - * @memberof util - * @param {*} ctor Extending constructor - * @returns {Object.} Constructor prototype - * @this Function + * Registers an event listener. + * @param {string} evt Event name + * @param {function} fn Listener + * @param {*} [ctx] Listener context + * @returns {util.EventEmitter} `this` + */ + on(evt: string, fn: () => any, ctx?: any): util.EventEmitter; + + /** + * Removes an event listener or any matching listeners if arguments are omitted. + * @param {string} [evt] Event name. Removes all listeners if omitted. + * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. + * @returns {util.EventEmitter} `this` + */ + off(evt?: string, fn?: () => any): util.EventEmitter; + + /** + * Emits an event by calling its listeners with the specified arguments. + * @param {string} evt Event name + * @param {...*} args Arguments + * @returns {util.EventEmitter} `this` */ - function extend(this: Function, ctor: any): { [k: string]: any }; + emit(evt: string, ...args: any[]): util.EventEmitter; + } + + /** + * Lets the specified constructor extend `this` class. + * @memberof util + * @param {*} ctor Extending constructor + * @returns {Object.} Constructor prototype + * @this Function + */ + function extend(this: Function, ctor: any): { [k: string]: any }; + + /** + * Fetches the contents of a file. + * @memberof util + * @param {string} path File path or url + * @param {FetchCallback} [callback] Callback function + * @returns {Promise|undefined} A Promise if `callback` has been omitted + */ + function fetch(path: string, callback?: FetchCallback): (Promise|undefined); - /** - * Fetches the contents of a file. - * @memberof util - * @param {string} path File path or url - * @param {FetchCallback} [callback] Callback function - * @returns {Promise|undefined} A Promise if `callback` has been omitted - */ - function fetch(path: string, callback?: FetchCallback): (Promise|undefined); + /** + * Requires a module only if available. + * @memberof util + * @param {string} moduleName Module to require + * @returns {?Object} Required module if available and not empty, otherwise `null` + */ + function inquire(moduleName: string): Object; - /** - * Requires a module only if available. - * @memberof util - * @param {string} moduleName Module to require - * @returns {?Object} Required module if available and not empty, otherwise `null` - */ - function inquire(moduleName: string): Object; + /** + * Constructs new long bits. + * @classdesc Helper class for working with the low and high bits of a 64 bit value. + * @memberof util + * @constructor + * @param {number} lo Low bits + * @param {number} hi High bits + */ + class LongBits { /** * Constructs new long bits. @@ -2033,554 +2043,552 @@ declare namespace protobuf { * @param {number} lo Low bits * @param {number} hi High bits */ - class LongBits { - - /** - * Constructs new long bits. - * @classdesc Helper class for working with the low and high bits of a 64 bit value. - * @memberof util - * @constructor - * @param {number} lo Low bits - * @param {number} hi High bits - */ - constructor(lo: number, hi: number); - - /** - * Low bits. - * @type {number} - */ - lo: number; - - /** - * High bits. - * @type {number} - */ - hi: number; - - /** - * Zero bits. - * @memberof util.LongBits - * @type {util.LongBits} - */ - static zero: util.LongBits; - - /** - * Zero hash. - * @memberof util.LongBits - * @type {string} - */ - static zeroHash: string; - - /** - * Constructs new long bits from the specified number. - * @param {number} value Value - * @returns {util.LongBits} Instance - */ - static fromNumber(value: number): util.LongBits; - - /** - * Constructs new long bits from a number, long or string. - * @param {Long|number|string} value Value - * @returns {util.LongBits} Instance - */ - static from(value: (Long|number|string)): util.LongBits; - - /** - * Converts this long bits to a possibly unsafe JavaScript number. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {number} Possibly unsafe number - */ - toNumber(unsigned?: boolean): number; - - /** - * Converts this long bits to a long. - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long} Long - */ - toLong(unsigned?: boolean): Long; - - /** - * Constructs new long bits from the specified 8 characters long hash. - * @param {string} hash Hash - * @returns {util.LongBits} Bits - */ - static fromHash(hash: string): util.LongBits; - - /** - * Converts this long bits to a 8 characters long hash. - * @returns {string} Hash - */ - toHash(): string; - - /** - * Zig-zag encodes this long bits. - * @returns {util.LongBits} `this` - */ - zzEncode(): util.LongBits; - - /** - * Zig-zag decodes this long bits. - * @returns {util.LongBits} `this` - */ - zzDecode(): util.LongBits; - - /** - * Calculates the length of this longbits when encoded as a varint. - * @returns {number} Length - */ - length(): number; - } - - /** - * A minimal path module to resolve Unix, Windows and URL paths alike. - * @memberof util - * @namespace - */ - namespace path { - - /** - * Tests if the specified path is absolute. - * @param {string} path Path to test - * @returns {boolean} `true` if path is absolute - */ - function isAbsolute(path: string): boolean; - - /** - * Normalizes the specified path. - * @param {string} path Path to normalize - * @returns {string} Normalized path - */ - function normalize(path: string): string; - - /** - * Resolves the specified include path against the specified origin path. - * @param {string} originPath Path to the origin file - * @param {string} includePath Include path relative to origin path - * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized - * @returns {string} Path to the include file - */ - function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string; - } + constructor(lo: number, hi: number); /** - * A general purpose buffer pool. - * @memberof util - * @function - * @param {PoolAllocator} alloc Allocator - * @param {PoolSlicer} slice Slicer - * @param {number} [size=8192] Slab size - * @returns {PoolAllocator} Pooled allocator + * Low bits. + * @type {number} */ - function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator; + lo: number; /** - * Whether running within node or not. - * @memberof util - * @type {boolean} + * High bits. + * @type {number} */ - var isNode: boolean; + hi: number; /** - * Whether running within IE8 or not. - * @memberof util - * @type {boolean} + * Zero bits. + * @memberof util.LongBits + * @type {util.LongBits} */ - var isIE8: boolean; + static zero: util.LongBits; /** - * Node's Buffer class if available. - * @type {?function(new: Buffer)} + * Zero hash. + * @memberof util.LongBits + * @type {string} */ - var Buffer: () => any; + static zeroHash: string; /** - * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. - * @type {?function(new: Uint8Array, *)} + * Constructs new long bits from the specified number. + * @param {number} value Value + * @returns {util.LongBits} Instance */ - var Array: () => any; + static fromNumber(value: number): util.LongBits; /** - * Long.js's Long class if available. - * @type {?function(new: Long)} + * Constructs new long bits from a number, long or string. + * @param {Long|number|string} value Value + * @returns {util.LongBits} Instance */ - var Long: () => any; + static from(value: (Long|number|string)): util.LongBits; /** - * Tests if the specified value is an integer. - * @function - * @param {*} value Value to test - * @returns {boolean} `true` if the value is an integer + * Converts this long bits to a possibly unsafe JavaScript number. + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {number} Possibly unsafe number */ - function isInteger(value: any): boolean; + toNumber(unsigned?: boolean): number; /** - * Tests if the specified value is a string. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a string + * Converts this long bits to a long. + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {Long} Long */ - function isString(value: any): boolean; + toLong(unsigned?: boolean): Long; /** - * Tests if the specified value is a non-null object. - * @param {*} value Value to test - * @returns {boolean} `true` if the value is a non-null object + * Constructs new long bits from the specified 8 characters long hash. + * @param {string} hash Hash + * @returns {util.LongBits} Bits */ - function isObject(value: any): boolean; + static fromHash(hash: string): util.LongBits; /** - * Converts a number or long to an 8 characters long hash string. - * @param {Long|number} value Value to convert + * Converts this long bits to a 8 characters long hash. * @returns {string} Hash */ - function longToHash(value: (Long|number)): string; + toHash(): string; /** - * Converts an 8 characters long hash string to a long or number. - * @param {string} hash Hash - * @param {boolean} [unsigned=false] Whether unsigned or not - * @returns {Long|number} Original value + * Zig-zag encodes this long bits. + * @returns {util.LongBits} `this` */ - function longFromHash(hash: string, unsigned?: boolean): (Long|number); + zzEncode(): util.LongBits; /** - * Tests if two possibly long values are not equal. - * @param {number|Long} a First value - * @param {number|Long} b Second value - * @returns {boolean} `true` if not equal - * @deprecated Use {@link util.longNe|longNe} instead + * Zig-zag decodes this long bits. + * @returns {util.LongBits} `this` */ - function longNeq(a: (number|Long), b: (number|Long)): boolean; + zzDecode(): util.LongBits; /** - * Tests if a possibily long value equals the specified low and high bits. - * @param {number|string|Long} val Value to test - * @param {number} lo Low bits to test against - * @param {number} hi High bits to test against - * @returns {boolean} `true` if not equal + * Calculates the length of this longbits when encoded as a varint. + * @returns {number} Length */ - function longNe(val: (number|string|Long), lo: number, hi: number): boolean; + length(): number; + } - /** - * Converts the first character of a string to upper case. - * @param {string} str String to convert - * @returns {string} Converted string - */ - function ucFirst(str: string): string; + /** + * A minimal path module to resolve Unix, Windows and URL paths alike. + * @memberof util + * @namespace + */ + namespace path { /** - * Defines the specified properties on the specified target. Also adds getters and setters for non-ES5 environments. - * @param {Object} target Target object - * @param {Object.} descriptors Property descriptors - * @returns {undefined} + * Tests if the specified path is absolute. + * @param {string} path Path to test + * @returns {boolean} `true` if path is absolute */ - function props(target: Object, descriptors: { [k: string]: any }): void; + function isAbsolute(path: string): boolean; /** - * Defines the specified property on the specified target. Also adds getters and setters for non-ES5 environments. - * @param {Object} target Target object - * @param {string} key Property name - * @param {Object.} descriptor Property descriptor - * @returns {undefined} + * Normalizes the specified path. + * @param {string} path Path to normalize + * @returns {string} Normalized path */ - function prop(target: Object, key: string, descriptor: { [k: string]: any }): void; + function normalize(path: string): string; /** - * An immuable empty array. - * @memberof util - * @type {Array.<*>} + * Resolves the specified include path against the specified origin path. + * @param {string} originPath Path to the origin file + * @param {string} includePath Include path relative to origin path + * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized + * @returns {string} Path to the include file */ - var emptyArray: any[]; + function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string; + } - /** - * An immutable empty object. - * @type {Object} - */ - var emptyObject: Object; + /** + * A general purpose buffer pool. + * @memberof util + * @function + * @param {PoolAllocator} alloc Allocator + * @param {PoolSlicer} slice Slicer + * @param {number} [size=8192] Slab size + * @returns {PoolAllocator} Pooled allocator + */ + function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator; - /** - * A minimal UTF8 implementation for number arrays. - * @memberof util - * @namespace - */ - namespace utf8 { - - /** - * Calculates the UTF8 byte length of a string. - * @param {string} string String - * @returns {number} Byte length - */ - function length(string: string): number; - - /** - * Reads UTF8 bytes as a string. - * @param {Uint8Array} buffer Source buffer - * @param {number} start Source start - * @param {number} end Source end - * @returns {string} String read - */ - function read(buffer: Uint8Array, start: number, end: number): string; - - /** - * Writes a string as UTF8 bytes. - * @param {string} string Source string - * @param {Uint8Array} buffer Destination buffer - * @param {number} offset Destination offset - * @returns {number} Bytes written - */ - function write(string: string, buffer: Uint8Array, offset: number): number; - } + /** + * Whether running within node or not. + * @memberof util + * @type {boolean} + */ + var isNode: boolean; - /** - * Node's fs module if available. - * @type {Object.} - */ - var fs: { [k: string]: any }; + /** + * Whether running within IE8 or not. + * @memberof util + * @type {boolean} + */ + var isIE8: boolean; - /** - * Converts an object's values to an array. - * @param {Object.} object Object to convert - * @returns {Array.<*>} Converted array - */ - function toArray(object: { [k: string]: any }): any[]; + /** + * Node's Buffer class if available. + * @type {?function(new: Buffer)} + */ + var Buffer: () => any; - /** - * Merges the properties of the source object into the destination object. - * @param {Object.} dst Destination object - * @param {Object.} src Source object - * @param {boolean} [ifNotSet=false] Merges only if the key is not already set - * @returns {Object.} Destination object - */ - function merge(dst: { [k: string]: any }, src: { [k: string]: any }, ifNotSet?: boolean): { [k: string]: any }; + /** + * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. + * @type {?function(new: Uint8Array, *)} + */ + var Array: () => any; + + /** + * Long.js's Long class if available. + * @type {?function(new: Long)} + */ + var Long: () => any; + + /** + * Tests if the specified value is an integer. + * @function + * @param {*} value Value to test + * @returns {boolean} `true` if the value is an integer + */ + function isInteger(value: any): boolean; + + /** + * Tests if the specified value is a string. + * @param {*} value Value to test + * @returns {boolean} `true` if the value is a string + */ + function isString(value: any): boolean; + + /** + * Tests if the specified value is a non-null object. + * @param {*} value Value to test + * @returns {boolean} `true` if the value is a non-null object + */ + function isObject(value: any): boolean; + + /** + * Converts a number or long to an 8 characters long hash string. + * @param {Long|number} value Value to convert + * @returns {string} Hash + */ + function longToHash(value: (Long|number)): string; + + /** + * Converts an 8 characters long hash string to a long or number. + * @param {string} hash Hash + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {Long|number} Original value + */ + function longFromHash(hash: string, unsigned?: boolean): (Long|number); + + /** + * Tests if two possibly long values are not equal. + * @param {number|Long} a First value + * @param {number|Long} b Second value + * @returns {boolean} `true` if not equal + * @deprecated Use {@link util.longNe|longNe} instead + */ + function longNeq(a: (number|Long), b: (number|Long)): boolean; + + /** + * Tests if a possibily long value equals the specified low and high bits. + * @param {number|string|Long} val Value to test + * @param {number} lo Low bits to test against + * @param {number} hi High bits to test against + * @returns {boolean} `true` if not equal + */ + function longNe(val: (number|string|Long), lo: number, hi: number): boolean; + + /** + * Converts the first character of a string to upper case. + * @param {string} str String to convert + * @returns {string} Converted string + */ + function ucFirst(str: string): string; + + /** + * Defines the specified properties on the specified target. Also adds getters and setters for non-ES5 environments. + * @param {Object} target Target object + * @param {Object.} descriptors Property descriptors + * @returns {undefined} + */ + function props(target: Object, descriptors: { [k: string]: any }): void; + + /** + * Defines the specified property on the specified target. Also adds getters and setters for non-ES5 environments. + * @param {Object} target Target object + * @param {string} key Property name + * @param {Object.} descriptor Property descriptor + * @returns {undefined} + */ + function prop(target: Object, key: string, descriptor: { [k: string]: any }): void; + + /** + * An immuable empty array. + * @memberof util + * @type {Array.<*>} + */ + var emptyArray: any[]; + + /** + * An immutable empty object. + * @type {Object} + */ + var emptyObject: Object; + + /** + * A minimal UTF8 implementation for number arrays. + * @memberof util + * @namespace + */ + namespace utf8 { /** - * Returns a safe property accessor for the specified properly name. - * @param {string} prop Property name - * @returns {string} Safe accessor + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length */ - function safeProp(prop: string): string; + function length(string: string): number; /** - * Converts the second character of a string to lower case. - * @param {string} str String to convert - * @returns {string} Converted string + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read */ - function lcFirst(str: string): string; + function read(buffer: Uint8Array, start: number, end: number): string; /** - * Creates a new buffer of whatever type supported by the environment. - * @param {number} [size=0] Buffer size - * @returns {Uint8Array} Buffer + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written */ - function newBuffer(size?: number): Uint8Array; + function write(string: string, buffer: Uint8Array, offset: number): number; } /** - * Generates a verifier specific to the specified message type. - * @param {Type} mtype Message type - * @returns {Codegen} Codegen instance + * Node's fs module if available. + * @type {Object.} + */ + var fs: { [k: string]: any }; + + /** + * Converts an object's values to an array. + * @param {Object.} object Object to convert + * @returns {Array.<*>} Converted array + */ + function toArray(object: { [k: string]: any }): any[]; + + /** + * Merges the properties of the source object into the destination object. + * @param {Object.} dst Destination object + * @param {Object.} src Source object + * @param {boolean} [ifNotSet=false] Merges only if the key is not already set + * @returns {Object.} Destination object + */ + function merge(dst: { [k: string]: any }, src: { [k: string]: any }, ifNotSet?: boolean): { [k: string]: any }; + + /** + * Returns a safe property accessor for the specified properly name. + * @param {string} prop Property name + * @returns {string} Safe accessor + */ + function safeProp(prop: string): string; + + /** + * Converts the second character of a string to lower case. + * @param {string} str String to convert + * @returns {string} Converted string + */ + function lcFirst(str: string): string; + + /** + * Creates a new buffer of whatever type supported by the environment. + * @param {number} [size=0] Buffer size + * @returns {Uint8Array} Buffer */ - function verifier(mtype: Type): Codegen; + function newBuffer(size?: number): Uint8Array; +} + +/** + * Generates a verifier specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +export function verifier(mtype: Type): Codegen; + +/** + * Constructs a new writer instance. + * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. + * @constructor + */ +export class Writer { /** * Constructs a new writer instance. * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. * @constructor */ - class Writer { + constructor(); - /** - * Constructs a new writer instance. - * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. - * @constructor - */ - constructor(); + /** + * Current length. + * @type {number} + */ + len: number; - /** - * Current length. - * @type {number} - */ - len: number; + /** + * Operations head. + * @type {Object} + */ + head: Object; - /** - * Operations head. - * @type {Object} - */ - head: Object; + /** + * Operations tail + * @type {Object} + */ + tail: Object; - /** - * Operations tail - * @type {Object} - */ - tail: Object; + /** + * Linked forked states. + * @type {?Object} + */ + states: Object; - /** - * Linked forked states. - * @type {?Object} - */ - states: Object; + /** + * Creates a new writer. + * @function + * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} + */ + static create(): (BufferWriter|Writer); - /** - * Creates a new writer. - * @function - * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} - */ - static create(): (BufferWriter|Writer); + /** + * Allocates a buffer of the specified size. + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ + static alloc(size: number): Uint8Array; - /** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - static alloc(size: number): Uint8Array; + /** + * Pushes a new operation to the queue. + * @param {function(Uint8Array, number, *)} fn Function to call + * @param {number} len Value byte length + * @param {number} val Value to write + * @returns {Writer} `this` + */ + push(fn: () => any, len: number, val: number): Writer; - /** - * Pushes a new operation to the queue. - * @param {function(Uint8Array, number, *)} fn Function to call - * @param {number} len Value byte length - * @param {number} val Value to write - * @returns {Writer} `this` - */ - push(fn: () => any, len: number, val: number): Writer; + /** + * Writes an unsigned 32 bit value as a varint. + * @param {number} value Value to write + * @returns {Writer} `this` + */ + uint32(value: number): Writer; - /** - * Writes an unsigned 32 bit value as a varint. - * @param {number} value Value to write - * @returns {Writer} `this` - */ - uint32(value: number): Writer; + /** + * Writes a signed 32 bit value as a varint. + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ + int32(value: number): Writer; - /** - * Writes a signed 32 bit value as a varint. - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ - int32(value: number): Writer; + /** + * Writes a 32 bit value as a varint, zig-zag encoded. + * @param {number} value Value to write + * @returns {Writer} `this` + */ + sint32(value: number): Writer; - /** - * Writes a 32 bit value as a varint, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ - sint32(value: number): Writer; + /** + * Writes an unsigned 64 bit value as a varint. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ + uint64(value: (Long|number|string)): Writer; - /** - * Writes an unsigned 64 bit value as a varint. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - uint64(value: (Long|number|string)): Writer; + /** + * Writes a signed 64 bit value as a varint. + * @function + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ + int64(value: (Long|number|string)): Writer; - /** - * Writes a signed 64 bit value as a varint. - * @function - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - int64(value: (Long|number|string)): Writer; + /** + * Writes a signed 64 bit value as a varint, zig-zag encoded. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ + sint64(value: (Long|number|string)): Writer; - /** - * Writes a signed 64 bit value as a varint, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - sint64(value: (Long|number|string)): Writer; + /** + * Writes a boolish value as a varint. + * @param {boolean} value Value to write + * @returns {Writer} `this` + */ + bool(value: boolean): Writer; - /** - * Writes a boolish value as a varint. - * @param {boolean} value Value to write - * @returns {Writer} `this` - */ - bool(value: boolean): Writer; + /** + * Writes a 32 bit value as fixed 32 bits. + * @param {number} value Value to write + * @returns {Writer} `this` + */ + fixed32(value: number): Writer; - /** - * Writes a 32 bit value as fixed 32 bits. - * @param {number} value Value to write - * @returns {Writer} `this` - */ - fixed32(value: number): Writer; + /** + * Writes a 32 bit value as fixed 32 bits, zig-zag encoded. + * @param {number} value Value to write + * @returns {Writer} `this` + */ + sfixed32(value: number): Writer; - /** - * Writes a 32 bit value as fixed 32 bits, zig-zag encoded. - * @param {number} value Value to write - * @returns {Writer} `this` - */ - sfixed32(value: number): Writer; + /** + * Writes a 64 bit value as fixed 64 bits. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ + fixed64(value: (Long|number|string)): Writer; - /** - * Writes a 64 bit value as fixed 64 bits. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - fixed64(value: (Long|number|string)): Writer; + /** + * Writes a 64 bit value as fixed 64 bits, zig-zag encoded. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ + sfixed64(value: (Long|number|string)): Writer; - /** - * Writes a 64 bit value as fixed 64 bits, zig-zag encoded. - * @param {Long|number|string} value Value to write - * @returns {Writer} `this` - * @throws {TypeError} If `value` is a string and no long library is present. - */ - sfixed64(value: (Long|number|string)): Writer; + /** + * Writes a float (32 bit). + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ + float(value: number): Writer; - /** - * Writes a float (32 bit). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ - float(value: number): Writer; + /** + * Writes a double (64 bit float). + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ + double(value: number): Writer; - /** - * Writes a double (64 bit float). - * @function - * @param {number} value Value to write - * @returns {Writer} `this` - */ - double(value: number): Writer; + /** + * Writes a sequence of bytes. + * @param {Uint8Array|string} value Buffer or base64 encoded string to write + * @returns {Writer} `this` + */ + bytes(value: (Uint8Array|string)): Writer; - /** - * Writes a sequence of bytes. - * @param {Uint8Array|string} value Buffer or base64 encoded string to write - * @returns {Writer} `this` - */ - bytes(value: (Uint8Array|string)): Writer; + /** + * Writes a string. + * @param {string} value Value to write + * @returns {Writer} `this` + */ + string(value: string): Writer; - /** - * Writes a string. - * @param {string} value Value to write - * @returns {Writer} `this` - */ - string(value: string): Writer; + /** + * Forks this writer's state by pushing it to a stack. + * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. + * @returns {Writer} `this` + */ + fork(): Writer; - /** - * Forks this writer's state by pushing it to a stack. - * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. - * @returns {Writer} `this` - */ - fork(): Writer; + /** + * Resets this instance to the last state. + * @returns {Writer} `this` + */ + reset(): Writer; - /** - * Resets this instance to the last state. - * @returns {Writer} `this` - */ - reset(): Writer; + /** + * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. + * @returns {Writer} `this` + */ + ldelim(): Writer; - /** - * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. - * @returns {Writer} `this` - */ - ldelim(): Writer; + /** + * Finishes the write operation. + * @returns {Uint8Array} Finished buffer + */ + finish(): Uint8Array; +} - /** - * Finishes the write operation. - * @returns {Uint8Array} Finished buffer - */ - finish(): Uint8Array; - } +/** + * Constructs a new buffer writer instance. + * @classdesc Wire format writer using node buffers. + * @extends Writer + * @constructor + */ +export class BufferWriter extends Writer { /** * Constructs a new buffer writer instance. @@ -2588,21 +2596,12 @@ declare namespace protobuf { * @extends Writer * @constructor */ - class BufferWriter extends Writer { - - /** - * Constructs a new buffer writer instance. - * @classdesc Wire format writer using node buffers. - * @extends Writer - * @constructor - */ - constructor(); + constructor(); - /** - * Allocates a buffer of the specified size. - * @param {number} size Buffer size - * @returns {Uint8Array} Buffer - */ - static alloc(size: number): Uint8Array; - } + /** + * Allocates a buffer of the specified size. + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ + static alloc(size: number): Uint8Array; } diff --git a/lib/tsd-jsdoc/publish.js b/lib/tsd-jsdoc/publish.js index ac2f60923..0fdd442f9 100644 --- a/lib/tsd-jsdoc/publish.js +++ b/lib/tsd-jsdoc/publish.js @@ -70,9 +70,9 @@ exports.publish = function publish(taffy, opts) { // wrap everything in a module if configured if (options.module) { writeln("export = ", options.module, ";"); - writeln("export as namespace " + options.module, ";"); writeln(); writeln("declare namespace ", options.module, " {"); + writeln(); ++indent; } @@ -132,9 +132,12 @@ function writeln() { } // writes a comment -function writeComment(comment) { - if (!comment || options.comments === false) +function writeComment(comment, otherwiseNewline) { + if (!comment || options.comments === false) { + if (otherwiseNewline) + writeln(); return; + } var first = true; comment.split(/\r?\n/g).forEach(function(line) { line = line.trim().replace(/^\*/, " *"); @@ -161,16 +164,21 @@ function replaceRecursive(name, re, fn) { return name; } -// tests if an element is considered class-like -function isClass(element) { +// tests if an element is considered to be a class or class-like +function isClassLike(element) { return element && (element.kind === "class" || element.kind === "interface" || element.kind === "mixin"); } -// tests if an element is considered an interface +// tests if an element is considered to be an interface function isInterface(element) { return element && (element.kind === "interface" || (getTypeOf(element) === 'Object' && element.properties && element.properties.length)); } +// tests if an element is considered to be a namespace +function isNamespace(element) { + return element && (element.kind === "namespace" || element.kind === "module"); +} + // gets all children of the specified parent function getChildrenOf(parent) { var memberof = parent ? parent.longname : undefined; @@ -219,10 +227,11 @@ function getTypeOf(element) { } // begins writing the definition of the specified element -function begin(element, noDeclare) { - writeComment(element.comment); - if (element.scope === "global" && !options.module && !noDeclare) - write("declare "); +function begin(element, is_interface) { + writeComment(element.comment, is_interface || isInterface(element) || isClassLike(element) || isNamespace(element)); + if (element.scope !== "global" || options.module || is_interface || isInterface(element)) + return; + write("export "); } // writes the function signature describing element @@ -281,6 +290,7 @@ function writeFunctionSignature(element, isConstructor, isTypeDef) { // writes (a typedef as) an interface function writeInterface(element) { + writeln(); writeln("interface ", element.name, " {"); ++indent; element.properties.forEach(function(property) { @@ -302,7 +312,7 @@ function handleElement(element, parent) { if (seen[element.longname]) return; seen[element.longname] = element; - if (isClass(element)) + if (isClassLike(element)) return handleClass(element, parent); switch (element.kind) { case "module": @@ -376,7 +386,7 @@ function handleClass(element, parent) { // members except inner classes var innerClasses = []; getChildrenOf(element).forEach(function(child) { - if (isClass(child)) + if (isClassLike(child)) innerClasses.push(child); else handleElement(child, element); @@ -386,7 +396,6 @@ function handleClass(element, parent) { writeln("}"); if (innerClasses.length) { - writeln(""); begin(element); writeln("namespace ", element.name, " {"); ++indent; @@ -419,7 +428,7 @@ function handleMember(element, parent) { } else { - if (isClass(parent)) { + if (isClassLike(parent)) { if (element.access) write(element.access, " "); if (element.scope === "static") @@ -451,7 +460,7 @@ function handleFunction(element, parent, isConstructor) { write("constructor"); } else { begin(element); - if (isClass(parent)) { + if (isClassLike(parent)) { if (element.access) write(element.access, " "); if (element.scope === "static") @@ -467,7 +476,7 @@ function handleFunction(element, parent, isConstructor) { // handles a type definition (not a real type) function handleTypeDef(element, parent) { if (isInterface(element)) { - if (isClass(parent)) + if (isClassLike(parent)) queuedInterfaces.push(element); else { begin(element); diff --git a/package.json b/package.json index 9f0c7a8dc..fa7b7a0b1 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "prepublish": "node scripts/prepublish", "prof": "node bench/prof", "test": "tape tests/*.js | tap-spec", - "types": "node bin/pbts --name protobuf --out index.d.ts src && tsc tests/typescript.ts --lib es2015 --noEmit && tsc tests/data/test.ts --lib es2015 --noEmit", + "types": "node bin/pbts --main --global protobuf --out index.d.ts src && tsc tests/typescript.ts --lib es2015 --noEmit && tsc tests/data/test.ts --lib es2015 --noEmit", "zuul": "zuul --ui tape --no-coverage --concurrency 4 -- tests/*.js", "zuul-local": "zuul --ui tape --concurrency 1 --local 8080 --disable-tunnel -- tests/*.js", "make": "npm run lint && npm run test && npm run types && npm run build", diff --git a/scripts/gentests.js b/scripts/gentests.js index 1f7b4e647..ef5f07df6 100644 --- a/scripts/gentests.js +++ b/scripts/gentests.js @@ -33,8 +33,8 @@ var fs = require("fs"), .forEach(function(file) { var out = file.replace(/\.js$/, ".d.ts"); pbts.main([ - "--name", path.basename(out, ".d.ts"), "--out", out, + "--no-comments", file ], function(err) { if (err) diff --git a/tests/data/test.d.ts b/tests/data/test.d.ts index d2eef3c70..68a68565a 100644 --- a/tests/data/test.d.ts +++ b/tests/data/test.d.ts @@ -1,4742 +1,765 @@ -// $> pbts --name test --out tests/data/test.d.ts tests/data/test.js -// Generated Fri, 30 Dec 2016 15:32:46 UTC +// $> pbts --out tests/data/test.d.ts --no-comments tests/data/test.js +// Generated Sat, 31 Dec 2016 00:04:43 UTC import * as $protobuf from "../.."; -export = test; -export as namespace test; +export namespace jspb { -declare namespace test { + namespace test { - /** - * Namespace jspb. - * @exports jspb - * @namespace - */ - namespace jspb { - - /** - * Namespace test. - * @exports jspb.test - * @namespace - */ - namespace test { - - /** - * Constructs a new Empty. - * @exports jspb.test.Empty - * @constructor - * @param {Object} [properties] Properties to set - */ - class Empty { - - /** - * Constructs a new Empty. - * @exports jspb.test.Empty - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Creates a new Empty instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Empty} Empty instance - */ - static create(properties?: Object): jspb.test.Empty; - - /** - * Encodes the specified Empty. - * @function - * @param {jspb.test.Empty|Object} message Empty or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Empty|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Empty, length delimited. - * @param {jspb.test.Empty|Object} message Empty or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Empty|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Empty from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Empty} Empty - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Empty; - - /** - * Decodes a Empty from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Empty} Empty - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Empty; - - /** - * Verifies a Empty. - * @function - * @param {jspb.test.Empty|Object} message Empty or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Empty|Object)): string; - } - - /** - * Constructs a new EnumContainer. - * @exports jspb.test.EnumContainer - * @constructor - * @param {Object} [properties] Properties to set - */ - class EnumContainer { - - /** - * Constructs a new EnumContainer. - * @exports jspb.test.EnumContainer - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * EnumContainer outerEnum. - * @type {number} - */ - outerEnum: number; - - /** - * Creates a new EnumContainer instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.EnumContainer} EnumContainer instance - */ - static create(properties?: Object): jspb.test.EnumContainer; - - /** - * Encodes the specified EnumContainer. - * @function - * @param {jspb.test.EnumContainer|Object} message EnumContainer or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.EnumContainer|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumContainer, length delimited. - * @param {jspb.test.EnumContainer|Object} message EnumContainer or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.EnumContainer|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a EnumContainer from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.EnumContainer} EnumContainer - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.EnumContainer; - - /** - * Decodes a EnumContainer from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.EnumContainer} EnumContainer - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.EnumContainer; - - /** - * Verifies a EnumContainer. - * @function - * @param {jspb.test.EnumContainer|Object} message EnumContainer or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.EnumContainer|Object)): string; - } - - /** - * Constructs a new Simple1. - * @exports jspb.test.Simple1 - * @constructor - * @param {Object} [properties] Properties to set - */ - class Simple1 { - - /** - * Constructs a new Simple1. - * @exports jspb.test.Simple1 - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Simple1 aString. - * @type {string} - */ - aString: string; - - /** - * Simple1 aRepeatedString. - * @type {Array.} - */ - aRepeatedString: string[]; - - /** - * Simple1 aBoolean. - * @type {boolean} - */ - aBoolean: boolean; - - /** - * Creates a new Simple1 instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Simple1} Simple1 instance - */ - static create(properties?: Object): jspb.test.Simple1; + class Empty { + constructor(properties?: Object); + static create(properties?: Object): jspb.test.Empty; + static encode(message: (jspb.test.Empty|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Empty|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Empty; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Empty; + static verify(message: (jspb.test.Empty|Object)): string; + } - /** - * Encodes the specified Simple1. - * @function - * @param {jspb.test.Simple1|Object} message Simple1 or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Simple1|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class EnumContainer { + constructor(properties?: Object); + outerEnum: number; + static create(properties?: Object): jspb.test.EnumContainer; + static encode(message: (jspb.test.EnumContainer|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.EnumContainer|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.EnumContainer; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.EnumContainer; + static verify(message: (jspb.test.EnumContainer|Object)): string; + } - /** - * Encodes the specified Simple1, length delimited. - * @param {jspb.test.Simple1|Object} message Simple1 or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Simple1|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class Simple1 { + constructor(properties?: Object); + aString: string; + aRepeatedString: string[]; + aBoolean: boolean; + static create(properties?: Object): jspb.test.Simple1; + static encode(message: (jspb.test.Simple1|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Simple1|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Simple1; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Simple1; + static verify(message: (jspb.test.Simple1|Object)): string; + } - /** - * Decodes a Simple1 from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Simple1} Simple1 - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Simple1; + class Simple2 { + constructor(properties?: Object); + aString: string; + aRepeatedString: string[]; + static create(properties?: Object): jspb.test.Simple2; + static encode(message: (jspb.test.Simple2|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Simple2|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Simple2; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Simple2; + static verify(message: (jspb.test.Simple2|Object)): string; + } - /** - * Decodes a Simple1 from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Simple1} Simple1 - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Simple1; + class SpecialCases { + constructor(properties?: Object); + normal: string; + default: string; + function: string; + var: string; + static create(properties?: Object): jspb.test.SpecialCases; + static encode(message: (jspb.test.SpecialCases|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.SpecialCases|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.SpecialCases; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.SpecialCases; + static verify(message: (jspb.test.SpecialCases|Object)): string; + } - /** - * Verifies a Simple1. - * @function - * @param {jspb.test.Simple1|Object} message Simple1 or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Simple1|Object)): string; - } + class OptionalFields { + constructor(properties?: Object); + aString: string; + aBool: boolean; + aNestedMessage: jspb.test.OptionalFields.Nested; + aRepeatedMessage: jspb.test.OptionalFields.Nested[]; + aRepeatedString: string[]; + static create(properties?: Object): jspb.test.OptionalFields; + static encode(message: (jspb.test.OptionalFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.OptionalFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OptionalFields; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OptionalFields; + static verify(message: (jspb.test.OptionalFields|Object)): string; + } - /** - * Constructs a new Simple2. - * @exports jspb.test.Simple2 - * @constructor - * @param {Object} [properties] Properties to set - */ - class Simple2 { + namespace OptionalFields { - /** - * Constructs a new Simple2. - * @exports jspb.test.Simple2 - * @constructor - * @param {Object} [properties] Properties to set - */ + class Nested { constructor(properties?: Object); - - /** - * Simple2 aString. - * @type {string} - */ - aString: string; - - /** - * Simple2 aRepeatedString. - * @type {Array.} - */ - aRepeatedString: string[]; - - /** - * Creates a new Simple2 instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Simple2} Simple2 instance - */ - static create(properties?: Object): jspb.test.Simple2; - - /** - * Encodes the specified Simple2. - * @function - * @param {jspb.test.Simple2|Object} message Simple2 or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Simple2|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Simple2, length delimited. - * @param {jspb.test.Simple2|Object} message Simple2 or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Simple2|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Simple2 from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Simple2} Simple2 - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Simple2; - - /** - * Decodes a Simple2 from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Simple2} Simple2 - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Simple2; - - /** - * Verifies a Simple2. - * @function - * @param {jspb.test.Simple2|Object} message Simple2 or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Simple2|Object)): string; + anInt: number; + static create(properties?: Object): jspb.test.OptionalFields.Nested; + static encode(message: (jspb.test.OptionalFields.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.OptionalFields.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OptionalFields.Nested; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OptionalFields.Nested; + static verify(message: (jspb.test.OptionalFields.Nested|Object)): string; } + } - /** - * Constructs a new SpecialCases. - * @exports jspb.test.SpecialCases - * @constructor - * @param {Object} [properties] Properties to set - */ - class SpecialCases { - - /** - * Constructs a new SpecialCases. - * @exports jspb.test.SpecialCases - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * SpecialCases normal. - * @type {string} - */ - normal: string; - - /** - * SpecialCases default. - * @name jspb.test.SpecialCases#default - * @type {string} - */ - default: string; - - /** - * SpecialCases function. - * @name jspb.test.SpecialCases#function - * @type {string} - */ - function: string; - - /** - * SpecialCases var. - * @name jspb.test.SpecialCases#var - * @type {string} - */ - var: string; - - /** - * Creates a new SpecialCases instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.SpecialCases} SpecialCases instance - */ - static create(properties?: Object): jspb.test.SpecialCases; - - /** - * Encodes the specified SpecialCases. - * @function - * @param {jspb.test.SpecialCases|Object} message SpecialCases or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.SpecialCases|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SpecialCases, length delimited. - * @param {jspb.test.SpecialCases|Object} message SpecialCases or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.SpecialCases|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SpecialCases from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.SpecialCases} SpecialCases - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.SpecialCases; - - /** - * Decodes a SpecialCases from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.SpecialCases} SpecialCases - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.SpecialCases; + class HasExtensions { + constructor(properties?: Object); + str1: string; + str2: string; + str3: string; + static create(properties?: Object): jspb.test.HasExtensions; + static encode(message: (jspb.test.HasExtensions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.HasExtensions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.HasExtensions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.HasExtensions; + static verify(message: (jspb.test.HasExtensions|Object)): string; + } - /** - * Verifies a SpecialCases. - * @function - * @param {jspb.test.SpecialCases|Object} message SpecialCases or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.SpecialCases|Object)): string; - } + class Complex { + constructor(properties?: Object); + aString: string; + anOutOfOrderBool: boolean; + aNestedMessage: jspb.test.Complex.Nested; + aRepeatedMessage: jspb.test.Complex.Nested[]; + aRepeatedString: string[]; + static create(properties?: Object): jspb.test.Complex; + static encode(message: (jspb.test.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Complex; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Complex; + static verify(message: (jspb.test.Complex|Object)): string; + } - /** - * Constructs a new OptionalFields. - * @exports jspb.test.OptionalFields - * @constructor - * @param {Object} [properties] Properties to set - */ - class OptionalFields { + namespace Complex { - /** - * Constructs a new OptionalFields. - * @exports jspb.test.OptionalFields - * @constructor - * @param {Object} [properties] Properties to set - */ + class Nested { constructor(properties?: Object); - - /** - * OptionalFields aString. - * @type {string} - */ - aString: string; - - /** - * OptionalFields aBool. - * @type {boolean} - */ - aBool: boolean; - - /** - * OptionalFields aNestedMessage. - * @type {jspb.test.OptionalFields.Nested} - */ - aNestedMessage: jspb.test.OptionalFields.Nested; - - /** - * OptionalFields aRepeatedMessage. - * @type {Array.} - */ - aRepeatedMessage: jspb.test.OptionalFields.Nested[]; - - /** - * OptionalFields aRepeatedString. - * @type {Array.} - */ - aRepeatedString: string[]; - - /** - * Creates a new OptionalFields instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.OptionalFields} OptionalFields instance - */ - static create(properties?: Object): jspb.test.OptionalFields; - - /** - * Encodes the specified OptionalFields. - * @function - * @param {jspb.test.OptionalFields|Object} message OptionalFields or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.OptionalFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OptionalFields, length delimited. - * @param {jspb.test.OptionalFields|Object} message OptionalFields or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.OptionalFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a OptionalFields from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.OptionalFields} OptionalFields - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OptionalFields; - - /** - * Decodes a OptionalFields from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.OptionalFields} OptionalFields - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OptionalFields; - - /** - * Verifies a OptionalFields. - * @function - * @param {jspb.test.OptionalFields|Object} message OptionalFields or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.OptionalFields|Object)): string; - } - - - /** - * Constructs a new OptionalFields. - * @exports jspb.test.OptionalFields - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace OptionalFields { - - /** - * Constructs a new Nested. - * @exports jspb.test.OptionalFields.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - class Nested { - - /** - * Constructs a new Nested. - * @exports jspb.test.OptionalFields.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Nested anInt. - * @type {number} - */ - anInt: number; - - /** - * Creates a new Nested instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.OptionalFields.Nested} Nested instance - */ - static create(properties?: Object): jspb.test.OptionalFields.Nested; - - /** - * Encodes the specified Nested. - * @function - * @param {jspb.test.OptionalFields.Nested|Object} message Nested or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.OptionalFields.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Nested, length delimited. - * @param {jspb.test.OptionalFields.Nested|Object} message Nested or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.OptionalFields.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Nested from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.OptionalFields.Nested} Nested - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OptionalFields.Nested; - - /** - * Decodes a Nested from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.OptionalFields.Nested} Nested - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OptionalFields.Nested; - - /** - * Verifies a Nested. - * @function - * @param {jspb.test.OptionalFields.Nested|Object} message Nested or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.OptionalFields.Nested|Object)): string; - } + anInt: number; + static create(properties?: Object): jspb.test.Complex.Nested; + static encode(message: (jspb.test.Complex.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Complex.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Complex.Nested; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Complex.Nested; + static verify(message: (jspb.test.Complex.Nested|Object)): string; } + } - /** - * Constructs a new HasExtensions. - * @exports jspb.test.HasExtensions - * @constructor - * @param {Object} [properties] Properties to set - */ - class HasExtensions { - - /** - * Constructs a new HasExtensions. - * @exports jspb.test.HasExtensions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * HasExtensions str1. - * @type {string} - */ - str1: string; - - /** - * HasExtensions str2. - * @type {string} - */ - str2: string; - - /** - * HasExtensions str3. - * @type {string} - */ - str3: string; - - /** - * Creates a new HasExtensions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.HasExtensions} HasExtensions instance - */ - static create(properties?: Object): jspb.test.HasExtensions; - - /** - * Encodes the specified HasExtensions. - * @function - * @param {jspb.test.HasExtensions|Object} message HasExtensions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.HasExtensions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified HasExtensions, length delimited. - * @param {jspb.test.HasExtensions|Object} message HasExtensions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.HasExtensions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a HasExtensions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.HasExtensions} HasExtensions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.HasExtensions; - - /** - * Decodes a HasExtensions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.HasExtensions} HasExtensions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.HasExtensions; + class OuterMessage { + constructor(properties?: Object); + static create(properties?: Object): jspb.test.OuterMessage; + static encode(message: (jspb.test.OuterMessage|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.OuterMessage|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OuterMessage; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OuterMessage; + static verify(message: (jspb.test.OuterMessage|Object)): string; + } - /** - * Verifies a HasExtensions. - * @function - * @param {jspb.test.HasExtensions|Object} message HasExtensions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.HasExtensions|Object)): string; - } + namespace OuterMessage { - /** - * Constructs a new Complex. - * @exports jspb.test.Complex - * @constructor - * @param {Object} [properties] Properties to set - */ class Complex { - - /** - * Constructs a new Complex. - * @exports jspb.test.Complex - * @constructor - * @param {Object} [properties] Properties to set - */ constructor(properties?: Object); - - /** - * Complex aString. - * @type {string} - */ - aString: string; - - /** - * Complex anOutOfOrderBool. - * @type {boolean} - */ - anOutOfOrderBool: boolean; - - /** - * Complex aNestedMessage. - * @type {jspb.test.Complex.Nested} - */ - aNestedMessage: jspb.test.Complex.Nested; - - /** - * Complex aRepeatedMessage. - * @type {Array.} - */ - aRepeatedMessage: jspb.test.Complex.Nested[]; - - /** - * Complex aRepeatedString. - * @type {Array.} - */ - aRepeatedString: string[]; - - /** - * Creates a new Complex instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Complex} Complex instance - */ - static create(properties?: Object): jspb.test.Complex; - - /** - * Encodes the specified Complex. - * @function - * @param {jspb.test.Complex|Object} message Complex or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Complex, length delimited. - * @param {jspb.test.Complex|Object} message Complex or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Complex from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Complex} Complex - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Complex; - - /** - * Decodes a Complex from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Complex} Complex - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Complex; - - /** - * Verifies a Complex. - * @function - * @param {jspb.test.Complex|Object} message Complex or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Complex|Object)): string; + innerComplexField: number; + static create(properties?: Object): jspb.test.OuterMessage.Complex; + static encode(message: (jspb.test.OuterMessage.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.OuterMessage.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OuterMessage.Complex; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OuterMessage.Complex; + static verify(message: (jspb.test.OuterMessage.Complex|Object)): string; } + } + class IsExtension { + constructor(properties?: Object); + ext1: string; + static create(properties?: Object): jspb.test.IsExtension; + static encode(message: (jspb.test.IsExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.IsExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.IsExtension; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.IsExtension; + static verify(message: (jspb.test.IsExtension|Object)): string; + } - /** - * Constructs a new Complex. - * @exports jspb.test.Complex - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace Complex { - - /** - * Constructs a new Nested. - * @exports jspb.test.Complex.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - class Nested { - - /** - * Constructs a new Nested. - * @exports jspb.test.Complex.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Nested anInt. - * @type {number} - */ - anInt: number; + class IndirectExtension { + constructor(properties?: Object); + static create(properties?: Object): jspb.test.IndirectExtension; + static encode(message: (jspb.test.IndirectExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.IndirectExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.IndirectExtension; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.IndirectExtension; + static verify(message: (jspb.test.IndirectExtension|Object)): string; + } - /** - * Creates a new Nested instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Complex.Nested} Nested instance - */ - static create(properties?: Object): jspb.test.Complex.Nested; + class DefaultValues { + constructor(properties?: Object); + stringField: string; + boolField: boolean; + intField: (number|Long); + enumField: number; + emptyField: string; + bytesField: Uint8Array; + static create(properties?: Object): jspb.test.DefaultValues; + static encode(message: (jspb.test.DefaultValues|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.DefaultValues|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.DefaultValues; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.DefaultValues; + static verify(message: (jspb.test.DefaultValues|Object)): string; + } - /** - * Encodes the specified Nested. - * @function - * @param {jspb.test.Complex.Nested|Object} message Nested or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Complex.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class FloatingPointFields { + constructor(properties?: Object); + optionalFloatField: number; + requiredFloatField: number; + repeatedFloatField: number[]; + defaultFloatField: number; + optionalDoubleField: number; + requiredDoubleField: number; + repeatedDoubleField: number[]; + defaultDoubleField: number; + static create(properties?: Object): jspb.test.FloatingPointFields; + static encode(message: (jspb.test.FloatingPointFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.FloatingPointFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.FloatingPointFields; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.FloatingPointFields; + static verify(message: (jspb.test.FloatingPointFields|Object)): string; + } - /** - * Encodes the specified Nested, length delimited. - * @param {jspb.test.Complex.Nested|Object} message Nested or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Complex.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class TestClone { + constructor(properties?: Object); + str: string; + simple1: jspb.test.Simple1; + simple2: jspb.test.Simple1[]; + bytesField: Uint8Array; + unused: string; + static create(properties?: Object): jspb.test.TestClone; + static encode(message: (jspb.test.TestClone|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestClone|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestClone; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestClone; + static verify(message: (jspb.test.TestClone|Object)): string; + } - /** - * Decodes a Nested from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Complex.Nested} Nested - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Complex.Nested; + class CloneExtension { + constructor(properties?: Object); + ext: string; + static create(properties?: Object): jspb.test.CloneExtension; + static encode(message: (jspb.test.CloneExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.CloneExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.CloneExtension; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.CloneExtension; + static verify(message: (jspb.test.CloneExtension|Object)): string; + } - /** - * Decodes a Nested from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Complex.Nested} Nested - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Complex.Nested; + class TestGroup { + constructor(properties?: Object); + id: string; + requiredSimple: jspb.test.Simple2; + optionalSimple: jspb.test.Simple2; + static create(properties?: Object): jspb.test.TestGroup; + static encode(message: (jspb.test.TestGroup|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestGroup|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestGroup; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestGroup; + static verify(message: (jspb.test.TestGroup|Object)): string; + } - /** - * Verifies a Nested. - * @function - * @param {jspb.test.Complex.Nested|Object} message Nested or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Complex.Nested|Object)): string; - } - } + class TestReservedNames { + constructor(properties?: Object); + extension: number; + static create(properties?: Object): jspb.test.TestReservedNames; + static encode(message: (jspb.test.TestReservedNames|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestReservedNames|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestReservedNames; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestReservedNames; + static verify(message: (jspb.test.TestReservedNames|Object)): string; + } - /** - * Constructs a new OuterMessage. - * @exports jspb.test.OuterMessage - * @constructor - * @param {Object} [properties] Properties to set - */ - class OuterMessage { + class TestReservedNamesExtension { + constructor(properties?: Object); + static create(properties?: Object): jspb.test.TestReservedNamesExtension; + static encode(message: (jspb.test.TestReservedNamesExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestReservedNamesExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestReservedNamesExtension; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestReservedNamesExtension; + static verify(message: (jspb.test.TestReservedNamesExtension|Object)): string; + } - /** - * Constructs a new OuterMessage. - * @exports jspb.test.OuterMessage - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); + class TestMessageWithOneof { + constructor(properties?: Object); + pone: string; + pthree: string; + rone: jspb.test.TestMessageWithOneof; + rtwo: string; + normalField: boolean; + repeatedField: string[]; + aone: number; + atwo: number; + bone: number; + btwo: number; + partialOneof: (string|undefined); + recursiveOneof: (string|undefined); + defaultOneofA: (string|undefined); + defaultOneofB: (string|undefined); + static create(properties?: Object): jspb.test.TestMessageWithOneof; + static encode(message: (jspb.test.TestMessageWithOneof|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestMessageWithOneof|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestMessageWithOneof; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestMessageWithOneof; + static verify(message: (jspb.test.TestMessageWithOneof|Object)): string; + } - /** - * Creates a new OuterMessage instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.OuterMessage} OuterMessage instance - */ - static create(properties?: Object): jspb.test.OuterMessage; + class TestEndsWithBytes { + constructor(properties?: Object); + value: number; + data: Uint8Array; + static create(properties?: Object): jspb.test.TestEndsWithBytes; + static encode(message: (jspb.test.TestEndsWithBytes|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestEndsWithBytes|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestEndsWithBytes; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestEndsWithBytes; + static verify(message: (jspb.test.TestEndsWithBytes|Object)): string; + } - /** - * Encodes the specified OuterMessage. - * @function - * @param {jspb.test.OuterMessage|Object} message OuterMessage or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.OuterMessage|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class TestMapFieldsNoBinary { + constructor(properties?: Object); + mapStringString: string; + mapStringInt32: number; + mapStringInt64: (number|Long); + mapStringBool: boolean; + mapStringDouble: number; + mapStringEnum: number; + mapStringMsg: jspb.test.MapValueMessageNoBinary; + mapInt32String: string; + mapInt64String: string; + mapBoolString: string; + testMapFields: jspb.test.TestMapFieldsNoBinary; + mapStringTestmapfields: jspb.test.TestMapFieldsNoBinary; + static create(properties?: Object): jspb.test.TestMapFieldsNoBinary; + static encode(message: (jspb.test.TestMapFieldsNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.TestMapFieldsNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestMapFieldsNoBinary; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestMapFieldsNoBinary; + static verify(message: (jspb.test.TestMapFieldsNoBinary|Object)): string; + } - /** - * Encodes the specified OuterMessage, length delimited. - * @param {jspb.test.OuterMessage|Object} message OuterMessage or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.OuterMessage|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class MapValueMessageNoBinary { + constructor(properties?: Object); + foo: number; + static create(properties?: Object): jspb.test.MapValueMessageNoBinary; + static encode(message: (jspb.test.MapValueMessageNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.MapValueMessageNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.MapValueMessageNoBinary; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.MapValueMessageNoBinary; + static verify(message: (jspb.test.MapValueMessageNoBinary|Object)): string; + } - /** - * Decodes a OuterMessage from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.OuterMessage} OuterMessage - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OuterMessage; + class Deeply { + constructor(properties?: Object); + static create(properties?: Object): jspb.test.Deeply; + static encode(message: (jspb.test.Deeply|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Deeply|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Deeply; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Deeply; + static verify(message: (jspb.test.Deeply|Object)): string; + } - /** - * Decodes a OuterMessage from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.OuterMessage} OuterMessage - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OuterMessage; + namespace Deeply { - /** - * Verifies a OuterMessage. - * @function - * @param {jspb.test.OuterMessage|Object} message OuterMessage or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.OuterMessage|Object)): string; + class Nested { + constructor(properties?: Object); + static create(properties?: Object): jspb.test.Deeply.Nested; + static encode(message: (jspb.test.Deeply.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Deeply.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Deeply.Nested; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Deeply.Nested; + static verify(message: (jspb.test.Deeply.Nested|Object)): string; } + namespace Nested { - /** - * Constructs a new OuterMessage. - * @exports jspb.test.OuterMessage - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace OuterMessage { - - /** - * Constructs a new Complex. - * @exports jspb.test.OuterMessage.Complex - * @constructor - * @param {Object} [properties] Properties to set - */ - class Complex { - - /** - * Constructs a new Complex. - * @exports jspb.test.OuterMessage.Complex - * @constructor - * @param {Object} [properties] Properties to set - */ + class Message { constructor(properties?: Object); - - /** - * Complex innerComplexField. - * @type {number} - */ - innerComplexField: number; - - /** - * Creates a new Complex instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.OuterMessage.Complex} Complex instance - */ - static create(properties?: Object): jspb.test.OuterMessage.Complex; - - /** - * Encodes the specified Complex. - * @function - * @param {jspb.test.OuterMessage.Complex|Object} message Complex or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.OuterMessage.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Complex, length delimited. - * @param {jspb.test.OuterMessage.Complex|Object} message Complex or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.OuterMessage.Complex|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Complex from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.OuterMessage.Complex} Complex - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.OuterMessage.Complex; - - /** - * Decodes a Complex from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.OuterMessage.Complex} Complex - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.OuterMessage.Complex; - - /** - * Verifies a Complex. - * @function - * @param {jspb.test.OuterMessage.Complex|Object} message Complex or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.OuterMessage.Complex|Object)): string; + count: number; + static create(properties?: Object): jspb.test.Deeply.Nested.Message; + static encode(message: (jspb.test.Deeply.Nested.Message|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (jspb.test.Deeply.Nested.Message|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Deeply.Nested.Message; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Deeply.Nested.Message; + static verify(message: (jspb.test.Deeply.Nested.Message|Object)): string; } } + } + } +} - /** - * Constructs a new IsExtension. - * @exports jspb.test.IsExtension - * @constructor - * @param {Object} [properties] Properties to set - */ - class IsExtension { - - /** - * Constructs a new IsExtension. - * @exports jspb.test.IsExtension - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * IsExtension ext1. - * @type {string} - */ - ext1: string; - - /** - * Creates a new IsExtension instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.IsExtension} IsExtension instance - */ - static create(properties?: Object): jspb.test.IsExtension; - - /** - * Encodes the specified IsExtension. - * @function - * @param {jspb.test.IsExtension|Object} message IsExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.IsExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; +export namespace google { - /** - * Encodes the specified IsExtension, length delimited. - * @param {jspb.test.IsExtension|Object} message IsExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.IsExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; + namespace protobuf { - /** - * Decodes a IsExtension from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.IsExtension} IsExtension - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.IsExtension; + class FileDescriptorSet { + constructor(properties?: Object); + file: google.protobuf.FileDescriptorProto[]; + static create(properties?: Object): google.protobuf.FileDescriptorSet; + static encode(message: (google.protobuf.FileDescriptorSet|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.FileDescriptorSet|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + static verify(message: (google.protobuf.FileDescriptorSet|Object)): string; + } - /** - * Decodes a IsExtension from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.IsExtension} IsExtension - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.IsExtension; + class FileDescriptorProto { + constructor(properties?: Object); + name: string; + package: string; + dependency: string[]; + publicDependency: number[]; + weakDependency: number[]; + messageType: google.protobuf.DescriptorProto[]; + enumType: google.protobuf.EnumDescriptorProto[]; + service: google.protobuf.ServiceDescriptorProto[]; + extension: google.protobuf.FieldDescriptorProto[]; + options: google.protobuf.FileOptions; + sourceCodeInfo: google.protobuf.SourceCodeInfo; + syntax: string; + static create(properties?: Object): google.protobuf.FileDescriptorProto; + static encode(message: (google.protobuf.FileDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.FileDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + static verify(message: (google.protobuf.FileDescriptorProto|Object)): string; + } - /** - * Verifies a IsExtension. - * @function - * @param {jspb.test.IsExtension|Object} message IsExtension or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.IsExtension|Object)): string; - } + class DescriptorProto { + constructor(properties?: Object); + name: string; + field: google.protobuf.FieldDescriptorProto[]; + extension: google.protobuf.FieldDescriptorProto[]; + nestedType: google.protobuf.DescriptorProto[]; + enumType: google.protobuf.EnumDescriptorProto[]; + extensionRange: google.protobuf.DescriptorProto.ExtensionRange[]; + oneofDecl: google.protobuf.OneofDescriptorProto[]; + options: google.protobuf.MessageOptions; + reservedRange: google.protobuf.DescriptorProto.ReservedRange[]; + reservedName: string[]; + static create(properties?: Object): google.protobuf.DescriptorProto; + static encode(message: (google.protobuf.DescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.DescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + static verify(message: (google.protobuf.DescriptorProto|Object)): string; + } - /** - * Constructs a new IndirectExtension. - * @exports jspb.test.IndirectExtension - * @constructor - * @param {Object} [properties] Properties to set - */ - class IndirectExtension { + namespace DescriptorProto { - /** - * Constructs a new IndirectExtension. - * @exports jspb.test.IndirectExtension - * @constructor - * @param {Object} [properties] Properties to set - */ + class ExtensionRange { constructor(properties?: Object); - - /** - * Creates a new IndirectExtension instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.IndirectExtension} IndirectExtension instance - */ - static create(properties?: Object): jspb.test.IndirectExtension; - - /** - * Encodes the specified IndirectExtension. - * @function - * @param {jspb.test.IndirectExtension|Object} message IndirectExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.IndirectExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified IndirectExtension, length delimited. - * @param {jspb.test.IndirectExtension|Object} message IndirectExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.IndirectExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a IndirectExtension from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.IndirectExtension} IndirectExtension - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.IndirectExtension; - - /** - * Decodes a IndirectExtension from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.IndirectExtension} IndirectExtension - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.IndirectExtension; - - /** - * Verifies a IndirectExtension. - * @function - * @param {jspb.test.IndirectExtension|Object} message IndirectExtension or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.IndirectExtension|Object)): string; + start: number; + end: number; + static create(properties?: Object): google.protobuf.DescriptorProto.ExtensionRange; + static encode(message: (google.protobuf.DescriptorProto.ExtensionRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.DescriptorProto.ExtensionRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + static verify(message: (google.protobuf.DescriptorProto.ExtensionRange|Object)): string; } - /** - * Constructs a new DefaultValues. - * @exports jspb.test.DefaultValues - * @constructor - * @param {Object} [properties] Properties to set - */ - class DefaultValues { - - /** - * Constructs a new DefaultValues. - * @exports jspb.test.DefaultValues - * @constructor - * @param {Object} [properties] Properties to set - */ + class ReservedRange { constructor(properties?: Object); - - /** - * DefaultValues stringField. - * @type {string} - */ - stringField: string; - - /** - * DefaultValues boolField. - * @type {boolean} - */ - boolField: boolean; - - /** - * DefaultValues intField. - * @type {number|Long} - */ - intField: (number|Long); - - /** - * DefaultValues enumField. - * @type {number} - */ - enumField: number; - - /** - * DefaultValues emptyField. - * @type {string} - */ - emptyField: string; - - /** - * DefaultValues bytesField. - * @type {Uint8Array} - */ - bytesField: Uint8Array; - - /** - * Creates a new DefaultValues instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.DefaultValues} DefaultValues instance - */ - static create(properties?: Object): jspb.test.DefaultValues; - - /** - * Encodes the specified DefaultValues. - * @function - * @param {jspb.test.DefaultValues|Object} message DefaultValues or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.DefaultValues|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DefaultValues, length delimited. - * @param {jspb.test.DefaultValues|Object} message DefaultValues or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.DefaultValues|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DefaultValues from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.DefaultValues} DefaultValues - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.DefaultValues; - - /** - * Decodes a DefaultValues from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.DefaultValues} DefaultValues - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.DefaultValues; - - /** - * Verifies a DefaultValues. - * @function - * @param {jspb.test.DefaultValues|Object} message DefaultValues or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.DefaultValues|Object)): string; + start: number; + end: number; + static create(properties?: Object): google.protobuf.DescriptorProto.ReservedRange; + static encode(message: (google.protobuf.DescriptorProto.ReservedRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.DescriptorProto.ReservedRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + static verify(message: (google.protobuf.DescriptorProto.ReservedRange|Object)): string; } + } - /** - * Constructs a new FloatingPointFields. - * @exports jspb.test.FloatingPointFields - * @constructor - * @param {Object} [properties] Properties to set - */ - class FloatingPointFields { - - /** - * Constructs a new FloatingPointFields. - * @exports jspb.test.FloatingPointFields - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * FloatingPointFields optionalFloatField. - * @type {number} - */ - optionalFloatField: number; - - /** - * FloatingPointFields requiredFloatField. - * @type {number} - */ - requiredFloatField: number; - - /** - * FloatingPointFields repeatedFloatField. - * @type {Array.} - */ - repeatedFloatField: number[]; - - /** - * FloatingPointFields defaultFloatField. - * @type {number} - */ - defaultFloatField: number; - - /** - * FloatingPointFields optionalDoubleField. - * @type {number} - */ - optionalDoubleField: number; - - /** - * FloatingPointFields requiredDoubleField. - * @type {number} - */ - requiredDoubleField: number; - - /** - * FloatingPointFields repeatedDoubleField. - * @type {Array.} - */ - repeatedDoubleField: number[]; - - /** - * FloatingPointFields defaultDoubleField. - * @type {number} - */ - defaultDoubleField: number; - - /** - * Creates a new FloatingPointFields instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.FloatingPointFields} FloatingPointFields instance - */ - static create(properties?: Object): jspb.test.FloatingPointFields; - - /** - * Encodes the specified FloatingPointFields. - * @function - * @param {jspb.test.FloatingPointFields|Object} message FloatingPointFields or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.FloatingPointFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FloatingPointFields, length delimited. - * @param {jspb.test.FloatingPointFields|Object} message FloatingPointFields or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.FloatingPointFields|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FloatingPointFields from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.FloatingPointFields} FloatingPointFields - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.FloatingPointFields; - - /** - * Decodes a FloatingPointFields from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.FloatingPointFields} FloatingPointFields - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.FloatingPointFields; + class FieldDescriptorProto { + constructor(properties?: Object); + name: string; + number: number; + label: number; + type: number; + typeName: string; + extendee: string; + defaultValue: string; + oneofIndex: number; + jsonName: string; + options: google.protobuf.FieldOptions; + static create(properties?: Object): google.protobuf.FieldDescriptorProto; + static encode(message: (google.protobuf.FieldDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.FieldDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + static verify(message: (google.protobuf.FieldDescriptorProto|Object)): string; + } - /** - * Verifies a FloatingPointFields. - * @function - * @param {jspb.test.FloatingPointFields|Object} message FloatingPointFields or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.FloatingPointFields|Object)): string; - } + class OneofDescriptorProto { + constructor(properties?: Object); + name: string; + options: google.protobuf.OneofOptions; + static create(properties?: Object): google.protobuf.OneofDescriptorProto; + static encode(message: (google.protobuf.OneofDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.OneofDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + static verify(message: (google.protobuf.OneofDescriptorProto|Object)): string; + } - /** - * Constructs a new TestClone. - * @exports jspb.test.TestClone - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestClone { + class EnumDescriptorProto { + constructor(properties?: Object); + name: string; + value: google.protobuf.EnumValueDescriptorProto[]; + options: google.protobuf.EnumOptions; + static create(properties?: Object): google.protobuf.EnumDescriptorProto; + static encode(message: (google.protobuf.EnumDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.EnumDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + static verify(message: (google.protobuf.EnumDescriptorProto|Object)): string; + } - /** - * Constructs a new TestClone. - * @exports jspb.test.TestClone - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); + class EnumValueDescriptorProto { + constructor(properties?: Object); + name: string; + number: number; + options: google.protobuf.EnumValueOptions; + static create(properties?: Object): google.protobuf.EnumValueDescriptorProto; + static encode(message: (google.protobuf.EnumValueDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.EnumValueDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + static verify(message: (google.protobuf.EnumValueDescriptorProto|Object)): string; + } - /** - * TestClone str. - * @type {string} - */ - str: string; + class ServiceDescriptorProto { + constructor(properties?: Object); + name: string; + method: google.protobuf.MethodDescriptorProto[]; + options: google.protobuf.ServiceOptions; + static create(properties?: Object): google.protobuf.ServiceDescriptorProto; + static encode(message: (google.protobuf.ServiceDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.ServiceDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + static verify(message: (google.protobuf.ServiceDescriptorProto|Object)): string; + } - /** - * TestClone simple1. - * @type {jspb.test.Simple1} - */ - simple1: jspb.test.Simple1; + class MethodDescriptorProto { + constructor(properties?: Object); + name: string; + inputType: string; + outputType: string; + options: google.protobuf.MethodOptions; + clientStreaming: boolean; + serverStreaming: boolean; + static create(properties?: Object): google.protobuf.MethodDescriptorProto; + static encode(message: (google.protobuf.MethodDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.MethodDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + static verify(message: (google.protobuf.MethodDescriptorProto|Object)): string; + } - /** - * TestClone simple2. - * @type {Array.} - */ - simple2: jspb.test.Simple1[]; + class FileOptions { + constructor(properties?: Object); + javaPackage: string; + javaOuterClassname: string; + javaMultipleFiles: boolean; + javaGenerateEqualsAndHash: boolean; + javaStringCheckUtf8: boolean; + optimizeFor: number; + goPackage: string; + ccGenericServices: boolean; + javaGenericServices: boolean; + pyGenericServices: boolean; + deprecated: boolean; + ccEnableArenas: boolean; + objcClassPrefix: string; + csharpNamespace: string; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.FileOptions; + static encode(message: (google.protobuf.FileOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.FileOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + static verify(message: (google.protobuf.FileOptions|Object)): string; + } - /** - * TestClone bytesField. - * @type {Uint8Array} - */ - bytesField: Uint8Array; + class MessageOptions { + constructor(properties?: Object); + messageSetWireFormat: boolean; + noStandardDescriptorAccessor: boolean; + deprecated: boolean; + mapEntry: boolean; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.MessageOptions; + static encode(message: (google.protobuf.MessageOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.MessageOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + static verify(message: (google.protobuf.MessageOptions|Object)): string; + } - /** - * TestClone unused. - * @type {string} - */ - unused: string; + class FieldOptions { + constructor(properties?: Object); + ctype: number; + packed: boolean; + jstype: number; + lazy: boolean; + deprecated: boolean; + weak: boolean; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.FieldOptions; + static encode(message: (google.protobuf.FieldOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.FieldOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + static verify(message: (google.protobuf.FieldOptions|Object)): string; + } - /** - * Creates a new TestClone instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestClone} TestClone instance - */ - static create(properties?: Object): jspb.test.TestClone; + class OneofOptions { + constructor(properties?: Object); + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.OneofOptions; + static encode(message: (google.protobuf.OneofOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.OneofOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + static verify(message: (google.protobuf.OneofOptions|Object)): string; + } - /** - * Encodes the specified TestClone. - * @function - * @param {jspb.test.TestClone|Object} message TestClone or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestClone|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class EnumOptions { + constructor(properties?: Object); + allowAlias: boolean; + deprecated: boolean; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.EnumOptions; + static encode(message: (google.protobuf.EnumOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.EnumOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + static verify(message: (google.protobuf.EnumOptions|Object)): string; + } - /** - * Encodes the specified TestClone, length delimited. - * @param {jspb.test.TestClone|Object} message TestClone or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestClone|Object), writer?: $protobuf.Writer): $protobuf.Writer; + class EnumValueOptions { + constructor(properties?: Object); + deprecated: boolean; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.EnumValueOptions; + static encode(message: (google.protobuf.EnumValueOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.EnumValueOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + static verify(message: (google.protobuf.EnumValueOptions|Object)): string; + } - /** - * Decodes a TestClone from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestClone} TestClone - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestClone; + class ServiceOptions { + constructor(properties?: Object); + deprecated: boolean; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.ServiceOptions; + static encode(message: (google.protobuf.ServiceOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.ServiceOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + static verify(message: (google.protobuf.ServiceOptions|Object)): string; + } - /** - * Decodes a TestClone from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestClone} TestClone - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestClone; + class MethodOptions { + constructor(properties?: Object); + deprecated: boolean; + idempotencyLevel: number; + uninterpretedOption: google.protobuf.UninterpretedOption[]; + static create(properties?: Object): google.protobuf.MethodOptions; + static encode(message: (google.protobuf.MethodOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.MethodOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + static verify(message: (google.protobuf.MethodOptions|Object)): string; + } - /** - * Verifies a TestClone. - * @function - * @param {jspb.test.TestClone|Object} message TestClone or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestClone|Object)): string; - } + class UninterpretedOption { + constructor(properties?: Object); + name: google.protobuf.UninterpretedOption.NamePart[]; + identifierValue: string; + positiveIntValue: (number|Long); + negativeIntValue: (number|Long); + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; + static create(properties?: Object): google.protobuf.UninterpretedOption; + static encode(message: (google.protobuf.UninterpretedOption|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.UninterpretedOption|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + static verify(message: (google.protobuf.UninterpretedOption|Object)): string; + } - /** - * Constructs a new CloneExtension. - * @exports jspb.test.CloneExtension - * @constructor - * @param {Object} [properties] Properties to set - */ - class CloneExtension { + namespace UninterpretedOption { - /** - * Constructs a new CloneExtension. - * @exports jspb.test.CloneExtension - * @constructor - * @param {Object} [properties] Properties to set - */ + class NamePart { constructor(properties?: Object); - - /** - * CloneExtension ext. - * @type {string} - */ - ext: string; - - /** - * Creates a new CloneExtension instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.CloneExtension} CloneExtension instance - */ - static create(properties?: Object): jspb.test.CloneExtension; - - /** - * Encodes the specified CloneExtension. - * @function - * @param {jspb.test.CloneExtension|Object} message CloneExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.CloneExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CloneExtension, length delimited. - * @param {jspb.test.CloneExtension|Object} message CloneExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.CloneExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CloneExtension from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.CloneExtension} CloneExtension - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.CloneExtension; - - /** - * Decodes a CloneExtension from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.CloneExtension} CloneExtension - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.CloneExtension; - - /** - * Verifies a CloneExtension. - * @function - * @param {jspb.test.CloneExtension|Object} message CloneExtension or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.CloneExtension|Object)): string; + namePart: string; + isExtension: boolean; + static create(properties?: Object): google.protobuf.UninterpretedOption.NamePart; + static encode(message: (google.protobuf.UninterpretedOption.NamePart|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.UninterpretedOption.NamePart|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + static verify(message: (google.protobuf.UninterpretedOption.NamePart|Object)): string; } + } - /** - * Constructs a new TestGroup. - * @exports jspb.test.TestGroup - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestGroup { - - /** - * Constructs a new TestGroup. - * @exports jspb.test.TestGroup - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * TestGroup id. - * @type {string} - */ - id: string; - - /** - * TestGroup requiredSimple. - * @type {jspb.test.Simple2} - */ - requiredSimple: jspb.test.Simple2; - - /** - * TestGroup optionalSimple. - * @type {jspb.test.Simple2} - */ - optionalSimple: jspb.test.Simple2; - - /** - * Creates a new TestGroup instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestGroup} TestGroup instance - */ - static create(properties?: Object): jspb.test.TestGroup; - - /** - * Encodes the specified TestGroup. - * @function - * @param {jspb.test.TestGroup|Object} message TestGroup or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestGroup|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TestGroup, length delimited. - * @param {jspb.test.TestGroup|Object} message TestGroup or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestGroup|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TestGroup from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestGroup} TestGroup - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestGroup; - - /** - * Decodes a TestGroup from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestGroup} TestGroup - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestGroup; - - /** - * Verifies a TestGroup. - * @function - * @param {jspb.test.TestGroup|Object} message TestGroup or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestGroup|Object)): string; - } + class SourceCodeInfo { + constructor(properties?: Object); + location: google.protobuf.SourceCodeInfo.Location[]; + static create(properties?: Object): google.protobuf.SourceCodeInfo; + static encode(message: (google.protobuf.SourceCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.SourceCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + static verify(message: (google.protobuf.SourceCodeInfo|Object)): string; + } - /** - * Constructs a new TestReservedNames. - * @exports jspb.test.TestReservedNames - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestReservedNames { + namespace SourceCodeInfo { - /** - * Constructs a new TestReservedNames. - * @exports jspb.test.TestReservedNames - * @constructor - * @param {Object} [properties] Properties to set - */ + class Location { constructor(properties?: Object); - - /** - * TestReservedNames extension. - * @type {number} - */ - extension: number; - - /** - * Creates a new TestReservedNames instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestReservedNames} TestReservedNames instance - */ - static create(properties?: Object): jspb.test.TestReservedNames; - - /** - * Encodes the specified TestReservedNames. - * @function - * @param {jspb.test.TestReservedNames|Object} message TestReservedNames or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestReservedNames|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TestReservedNames, length delimited. - * @param {jspb.test.TestReservedNames|Object} message TestReservedNames or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestReservedNames|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TestReservedNames from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestReservedNames} TestReservedNames - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestReservedNames; - - /** - * Decodes a TestReservedNames from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestReservedNames} TestReservedNames - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestReservedNames; - - /** - * Verifies a TestReservedNames. - * @function - * @param {jspb.test.TestReservedNames|Object} message TestReservedNames or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestReservedNames|Object)): string; + path: number[]; + span: number[]; + leadingComments: string; + trailingComments: string; + leadingDetachedComments: string[]; + static create(properties?: Object): google.protobuf.SourceCodeInfo.Location; + static encode(message: (google.protobuf.SourceCodeInfo.Location|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.SourceCodeInfo.Location|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + static verify(message: (google.protobuf.SourceCodeInfo.Location|Object)): string; } + } - /** - * Constructs a new TestReservedNamesExtension. - * @exports jspb.test.TestReservedNamesExtension - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestReservedNamesExtension { - - /** - * Constructs a new TestReservedNamesExtension. - * @exports jspb.test.TestReservedNamesExtension - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Creates a new TestReservedNamesExtension instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestReservedNamesExtension} TestReservedNamesExtension instance - */ - static create(properties?: Object): jspb.test.TestReservedNamesExtension; - - /** - * Encodes the specified TestReservedNamesExtension. - * @function - * @param {jspb.test.TestReservedNamesExtension|Object} message TestReservedNamesExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestReservedNamesExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TestReservedNamesExtension, length delimited. - * @param {jspb.test.TestReservedNamesExtension|Object} message TestReservedNamesExtension or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestReservedNamesExtension|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TestReservedNamesExtension from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestReservedNamesExtension} TestReservedNamesExtension - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestReservedNamesExtension; - - /** - * Decodes a TestReservedNamesExtension from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestReservedNamesExtension} TestReservedNamesExtension - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestReservedNamesExtension; - - /** - * Verifies a TestReservedNamesExtension. - * @function - * @param {jspb.test.TestReservedNamesExtension|Object} message TestReservedNamesExtension or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestReservedNamesExtension|Object)): string; - } + class GeneratedCodeInfo { + constructor(properties?: Object); + annotation: google.protobuf.GeneratedCodeInfo.Annotation[]; + static create(properties?: Object): google.protobuf.GeneratedCodeInfo; + static encode(message: (google.protobuf.GeneratedCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.GeneratedCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + static verify(message: (google.protobuf.GeneratedCodeInfo|Object)): string; + } - /** - * Constructs a new TestMessageWithOneof. - * @exports jspb.test.TestMessageWithOneof - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestMessageWithOneof { + namespace GeneratedCodeInfo { - /** - * Constructs a new TestMessageWithOneof. - * @exports jspb.test.TestMessageWithOneof - * @constructor - * @param {Object} [properties] Properties to set - */ + class Annotation { constructor(properties?: Object); - - /** - * TestMessageWithOneof pone. - * @type {string} - */ - pone: string; - - /** - * TestMessageWithOneof pthree. - * @type {string} - */ - pthree: string; - - /** - * TestMessageWithOneof rone. - * @type {jspb.test.TestMessageWithOneof} - */ - rone: jspb.test.TestMessageWithOneof; - - /** - * TestMessageWithOneof rtwo. - * @type {string} - */ - rtwo: string; - - /** - * TestMessageWithOneof normalField. - * @type {boolean} - */ - normalField: boolean; - - /** - * TestMessageWithOneof repeatedField. - * @type {Array.} - */ - repeatedField: string[]; - - /** - * TestMessageWithOneof aone. - * @type {number} - */ - aone: number; - - /** - * TestMessageWithOneof atwo. - * @type {number} - */ - atwo: number; - - /** - * TestMessageWithOneof bone. - * @type {number} - */ - bone: number; - - /** - * TestMessageWithOneof btwo. - * @type {number} - */ - btwo: number; - - /** - * TestMessageWithOneof partialOneof. - * @name jspb.test.TestMessageWithOneof#partialOneof - * @type {string|undefined} - */ - partialOneof: (string|undefined); - - /** - * TestMessageWithOneof recursiveOneof. - * @name jspb.test.TestMessageWithOneof#recursiveOneof - * @type {string|undefined} - */ - recursiveOneof: (string|undefined); - - /** - * TestMessageWithOneof defaultOneofA. - * @name jspb.test.TestMessageWithOneof#defaultOneofA - * @type {string|undefined} - */ - defaultOneofA: (string|undefined); - - /** - * TestMessageWithOneof defaultOneofB. - * @name jspb.test.TestMessageWithOneof#defaultOneofB - * @type {string|undefined} - */ - defaultOneofB: (string|undefined); - - /** - * Creates a new TestMessageWithOneof instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestMessageWithOneof} TestMessageWithOneof instance - */ - static create(properties?: Object): jspb.test.TestMessageWithOneof; - - /** - * Encodes the specified TestMessageWithOneof. - * @function - * @param {jspb.test.TestMessageWithOneof|Object} message TestMessageWithOneof or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestMessageWithOneof|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TestMessageWithOneof, length delimited. - * @param {jspb.test.TestMessageWithOneof|Object} message TestMessageWithOneof or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestMessageWithOneof|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TestMessageWithOneof from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestMessageWithOneof} TestMessageWithOneof - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestMessageWithOneof; - - /** - * Decodes a TestMessageWithOneof from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestMessageWithOneof} TestMessageWithOneof - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestMessageWithOneof; - - /** - * Verifies a TestMessageWithOneof. - * @function - * @param {jspb.test.TestMessageWithOneof|Object} message TestMessageWithOneof or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestMessageWithOneof|Object)): string; - } - - /** - * Constructs a new TestEndsWithBytes. - * @exports jspb.test.TestEndsWithBytes - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestEndsWithBytes { - - /** - * Constructs a new TestEndsWithBytes. - * @exports jspb.test.TestEndsWithBytes - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * TestEndsWithBytes value. - * @type {number} - */ - value: number; - - /** - * TestEndsWithBytes data. - * @type {Uint8Array} - */ - data: Uint8Array; - - /** - * Creates a new TestEndsWithBytes instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestEndsWithBytes} TestEndsWithBytes instance - */ - static create(properties?: Object): jspb.test.TestEndsWithBytes; - - /** - * Encodes the specified TestEndsWithBytes. - * @function - * @param {jspb.test.TestEndsWithBytes|Object} message TestEndsWithBytes or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestEndsWithBytes|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TestEndsWithBytes, length delimited. - * @param {jspb.test.TestEndsWithBytes|Object} message TestEndsWithBytes or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestEndsWithBytes|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TestEndsWithBytes from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestEndsWithBytes} TestEndsWithBytes - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestEndsWithBytes; - - /** - * Decodes a TestEndsWithBytes from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestEndsWithBytes} TestEndsWithBytes - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestEndsWithBytes; - - /** - * Verifies a TestEndsWithBytes. - * @function - * @param {jspb.test.TestEndsWithBytes|Object} message TestEndsWithBytes or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestEndsWithBytes|Object)): string; - } - - /** - * Constructs a new TestMapFieldsNoBinary. - * @exports jspb.test.TestMapFieldsNoBinary - * @constructor - * @param {Object} [properties] Properties to set - */ - class TestMapFieldsNoBinary { - - /** - * Constructs a new TestMapFieldsNoBinary. - * @exports jspb.test.TestMapFieldsNoBinary - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * TestMapFieldsNoBinary mapStringString. - * @type {string} - */ - mapStringString: string; - - /** - * TestMapFieldsNoBinary mapStringInt32. - * @type {number} - */ - mapStringInt32: number; - - /** - * TestMapFieldsNoBinary mapStringInt64. - * @type {number|Long} - */ - mapStringInt64: (number|Long); - - /** - * TestMapFieldsNoBinary mapStringBool. - * @type {boolean} - */ - mapStringBool: boolean; - - /** - * TestMapFieldsNoBinary mapStringDouble. - * @type {number} - */ - mapStringDouble: number; - - /** - * TestMapFieldsNoBinary mapStringEnum. - * @type {number} - */ - mapStringEnum: number; - - /** - * TestMapFieldsNoBinary mapStringMsg. - * @type {jspb.test.MapValueMessageNoBinary} - */ - mapStringMsg: jspb.test.MapValueMessageNoBinary; - - /** - * TestMapFieldsNoBinary mapInt32String. - * @type {string} - */ - mapInt32String: string; - - /** - * TestMapFieldsNoBinary mapInt64String. - * @type {string} - */ - mapInt64String: string; - - /** - * TestMapFieldsNoBinary mapBoolString. - * @type {string} - */ - mapBoolString: string; - - /** - * TestMapFieldsNoBinary testMapFields. - * @type {jspb.test.TestMapFieldsNoBinary} - */ - testMapFields: jspb.test.TestMapFieldsNoBinary; - - /** - * TestMapFieldsNoBinary mapStringTestmapfields. - * @type {jspb.test.TestMapFieldsNoBinary} - */ - mapStringTestmapfields: jspb.test.TestMapFieldsNoBinary; - - /** - * Creates a new TestMapFieldsNoBinary instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.TestMapFieldsNoBinary} TestMapFieldsNoBinary instance - */ - static create(properties?: Object): jspb.test.TestMapFieldsNoBinary; - - /** - * Encodes the specified TestMapFieldsNoBinary. - * @function - * @param {jspb.test.TestMapFieldsNoBinary|Object} message TestMapFieldsNoBinary or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.TestMapFieldsNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TestMapFieldsNoBinary, length delimited. - * @param {jspb.test.TestMapFieldsNoBinary|Object} message TestMapFieldsNoBinary or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.TestMapFieldsNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TestMapFieldsNoBinary from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.TestMapFieldsNoBinary} TestMapFieldsNoBinary - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.TestMapFieldsNoBinary; - - /** - * Decodes a TestMapFieldsNoBinary from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.TestMapFieldsNoBinary} TestMapFieldsNoBinary - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.TestMapFieldsNoBinary; - - /** - * Verifies a TestMapFieldsNoBinary. - * @function - * @param {jspb.test.TestMapFieldsNoBinary|Object} message TestMapFieldsNoBinary or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.TestMapFieldsNoBinary|Object)): string; - } - - /** - * Constructs a new MapValueMessageNoBinary. - * @exports jspb.test.MapValueMessageNoBinary - * @constructor - * @param {Object} [properties] Properties to set - */ - class MapValueMessageNoBinary { - - /** - * Constructs a new MapValueMessageNoBinary. - * @exports jspb.test.MapValueMessageNoBinary - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * MapValueMessageNoBinary foo. - * @type {number} - */ - foo: number; - - /** - * Creates a new MapValueMessageNoBinary instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.MapValueMessageNoBinary} MapValueMessageNoBinary instance - */ - static create(properties?: Object): jspb.test.MapValueMessageNoBinary; - - /** - * Encodes the specified MapValueMessageNoBinary. - * @function - * @param {jspb.test.MapValueMessageNoBinary|Object} message MapValueMessageNoBinary or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.MapValueMessageNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MapValueMessageNoBinary, length delimited. - * @param {jspb.test.MapValueMessageNoBinary|Object} message MapValueMessageNoBinary or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.MapValueMessageNoBinary|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MapValueMessageNoBinary from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.MapValueMessageNoBinary} MapValueMessageNoBinary - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.MapValueMessageNoBinary; - - /** - * Decodes a MapValueMessageNoBinary from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.MapValueMessageNoBinary} MapValueMessageNoBinary - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.MapValueMessageNoBinary; - - /** - * Verifies a MapValueMessageNoBinary. - * @function - * @param {jspb.test.MapValueMessageNoBinary|Object} message MapValueMessageNoBinary or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.MapValueMessageNoBinary|Object)): string; - } - - /** - * Constructs a new Deeply. - * @exports jspb.test.Deeply - * @constructor - * @param {Object} [properties] Properties to set - */ - class Deeply { - - /** - * Constructs a new Deeply. - * @exports jspb.test.Deeply - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Creates a new Deeply instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Deeply} Deeply instance - */ - static create(properties?: Object): jspb.test.Deeply; - - /** - * Encodes the specified Deeply. - * @function - * @param {jspb.test.Deeply|Object} message Deeply or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Deeply|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Deeply, length delimited. - * @param {jspb.test.Deeply|Object} message Deeply or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Deeply|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Deeply from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Deeply} Deeply - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Deeply; - - /** - * Decodes a Deeply from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Deeply} Deeply - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Deeply; - - /** - * Verifies a Deeply. - * @function - * @param {jspb.test.Deeply|Object} message Deeply or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Deeply|Object)): string; - } - - - /** - * Constructs a new Deeply. - * @exports jspb.test.Deeply - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace Deeply { - - /** - * Constructs a new Nested. - * @exports jspb.test.Deeply.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - class Nested { - - /** - * Constructs a new Nested. - * @exports jspb.test.Deeply.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Creates a new Nested instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Deeply.Nested} Nested instance - */ - static create(properties?: Object): jspb.test.Deeply.Nested; - - /** - * Encodes the specified Nested. - * @function - * @param {jspb.test.Deeply.Nested|Object} message Nested or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Deeply.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Nested, length delimited. - * @param {jspb.test.Deeply.Nested|Object} message Nested or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Deeply.Nested|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Nested from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Deeply.Nested} Nested - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Deeply.Nested; - - /** - * Decodes a Nested from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Deeply.Nested} Nested - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Deeply.Nested; - - /** - * Verifies a Nested. - * @function - * @param {jspb.test.Deeply.Nested|Object} message Nested or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Deeply.Nested|Object)): string; - } - - - /** - * Constructs a new Nested. - * @exports jspb.test.Deeply.Nested - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace Nested { - - /** - * Constructs a new Message. - * @exports jspb.test.Deeply.Nested.Message - * @constructor - * @param {Object} [properties] Properties to set - */ - class Message { - - /** - * Constructs a new Message. - * @exports jspb.test.Deeply.Nested.Message - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Message count. - * @type {number} - */ - count: number; - - /** - * Creates a new Message instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {jspb.test.Deeply.Nested.Message} Message instance - */ - static create(properties?: Object): jspb.test.Deeply.Nested.Message; - - /** - * Encodes the specified Message. - * @function - * @param {jspb.test.Deeply.Nested.Message|Object} message Message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (jspb.test.Deeply.Nested.Message|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Message, length delimited. - * @param {jspb.test.Deeply.Nested.Message|Object} message Message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (jspb.test.Deeply.Nested.Message|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Message from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {jspb.test.Deeply.Nested.Message} Message - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): jspb.test.Deeply.Nested.Message; - - /** - * Decodes a Message from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {jspb.test.Deeply.Nested.Message} Message - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): jspb.test.Deeply.Nested.Message; - - /** - * Verifies a Message. - * @function - * @param {jspb.test.Deeply.Nested.Message|Object} message Message or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (jspb.test.Deeply.Nested.Message|Object)): string; - } - } - } - } - } - - /** - * Namespace google. - * @exports google - * @namespace - */ - namespace google { - - /** - * Namespace protobuf. - * @exports google.protobuf - * @namespace - */ - namespace protobuf { - - /** - * Constructs a new FileDescriptorSet. - * @exports google.protobuf.FileDescriptorSet - * @constructor - * @param {Object} [properties] Properties to set - */ - class FileDescriptorSet { - - /** - * Constructs a new FileDescriptorSet. - * @exports google.protobuf.FileDescriptorSet - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * FileDescriptorSet file. - * @type {Array.} - */ - file: google.protobuf.FileDescriptorProto[]; - - /** - * Creates a new FileDescriptorSet instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance - */ - static create(properties?: Object): google.protobuf.FileDescriptorSet; - - /** - * Encodes the specified FileDescriptorSet. - * @function - * @param {google.protobuf.FileDescriptorSet|Object} message FileDescriptorSet or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.FileDescriptorSet|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileDescriptorSet, length delimited. - * @param {google.protobuf.FileDescriptorSet|Object} message FileDescriptorSet or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.FileDescriptorSet|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileDescriptorSet from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; - - /** - * Decodes a FileDescriptorSet from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; - - /** - * Verifies a FileDescriptorSet. - * @function - * @param {google.protobuf.FileDescriptorSet|Object} message FileDescriptorSet or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.FileDescriptorSet|Object)): string; - } - - /** - * Constructs a new FileDescriptorProto. - * @exports google.protobuf.FileDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class FileDescriptorProto { - - /** - * Constructs a new FileDescriptorProto. - * @exports google.protobuf.FileDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * FileDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * FileDescriptorProto package. - * @name google.protobuf.FileDescriptorProto#package - * @type {string} - */ - package: string; - - /** - * FileDescriptorProto dependency. - * @type {Array.} - */ - dependency: string[]; - - /** - * FileDescriptorProto publicDependency. - * @type {Array.} - */ - publicDependency: number[]; - - /** - * FileDescriptorProto weakDependency. - * @type {Array.} - */ - weakDependency: number[]; - - /** - * FileDescriptorProto messageType. - * @type {Array.} - */ - messageType: google.protobuf.DescriptorProto[]; - - /** - * FileDescriptorProto enumType. - * @type {Array.} - */ - enumType: google.protobuf.EnumDescriptorProto[]; - - /** - * FileDescriptorProto service. - * @type {Array.} - */ - service: google.protobuf.ServiceDescriptorProto[]; - - /** - * FileDescriptorProto extension. - * @type {Array.} - */ - extension: google.protobuf.FieldDescriptorProto[]; - - /** - * FileDescriptorProto options. - * @type {google.protobuf.FileOptions} - */ - options: google.protobuf.FileOptions; - - /** - * FileDescriptorProto sourceCodeInfo. - * @type {google.protobuf.SourceCodeInfo} - */ - sourceCodeInfo: google.protobuf.SourceCodeInfo; - - /** - * FileDescriptorProto syntax. - * @type {string} - */ - syntax: string; - - /** - * Creates a new FileDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.FileDescriptorProto; - - /** - * Encodes the specified FileDescriptorProto. - * @function - * @param {google.protobuf.FileDescriptorProto|Object} message FileDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.FileDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileDescriptorProto, length delimited. - * @param {google.protobuf.FileDescriptorProto|Object} message FileDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.FileDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; - - /** - * Decodes a FileDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; - - /** - * Verifies a FileDescriptorProto. - * @function - * @param {google.protobuf.FileDescriptorProto|Object} message FileDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.FileDescriptorProto|Object)): string; - } - - /** - * Constructs a new DescriptorProto. - * @exports google.protobuf.DescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class DescriptorProto { - - /** - * Constructs a new DescriptorProto. - * @exports google.protobuf.DescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * DescriptorProto name. - * @type {string} - */ - name: string; - - /** - * DescriptorProto field. - * @type {Array.} - */ - field: google.protobuf.FieldDescriptorProto[]; - - /** - * DescriptorProto extension. - * @type {Array.} - */ - extension: google.protobuf.FieldDescriptorProto[]; - - /** - * DescriptorProto nestedType. - * @type {Array.} - */ - nestedType: google.protobuf.DescriptorProto[]; - - /** - * DescriptorProto enumType. - * @type {Array.} - */ - enumType: google.protobuf.EnumDescriptorProto[]; - - /** - * DescriptorProto extensionRange. - * @type {Array.} - */ - extensionRange: google.protobuf.DescriptorProto.ExtensionRange[]; - - /** - * DescriptorProto oneofDecl. - * @type {Array.} - */ - oneofDecl: google.protobuf.OneofDescriptorProto[]; - - /** - * DescriptorProto options. - * @type {google.protobuf.MessageOptions} - */ - options: google.protobuf.MessageOptions; - - /** - * DescriptorProto reservedRange. - * @type {Array.} - */ - reservedRange: google.protobuf.DescriptorProto.ReservedRange[]; - - /** - * DescriptorProto reservedName. - * @type {Array.} - */ - reservedName: string[]; - - /** - * Creates a new DescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto} DescriptorProto instance - */ - static create(properties?: Object): google.protobuf.DescriptorProto; - - /** - * Encodes the specified DescriptorProto. - * @function - * @param {google.protobuf.DescriptorProto|Object} message DescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.DescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DescriptorProto, length delimited. - * @param {google.protobuf.DescriptorProto|Object} message DescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.DescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto} DescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; - - /** - * Decodes a DescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto} DescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; - - /** - * Verifies a DescriptorProto. - * @function - * @param {google.protobuf.DescriptorProto|Object} message DescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.DescriptorProto|Object)): string; - } - - - /** - * Constructs a new DescriptorProto. - * @exports google.protobuf.DescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace DescriptorProto { - - /** - * Constructs a new ExtensionRange. - * @exports google.protobuf.DescriptorProto.ExtensionRange - * @constructor - * @param {Object} [properties] Properties to set - */ - class ExtensionRange { - - /** - * Constructs a new ExtensionRange. - * @exports google.protobuf.DescriptorProto.ExtensionRange - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * ExtensionRange start. - * @type {number} - */ - start: number; - - /** - * ExtensionRange end. - * @type {number} - */ - end: number; - - /** - * Creates a new ExtensionRange instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance - */ - static create(properties?: Object): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Encodes the specified ExtensionRange. - * @function - * @param {google.protobuf.DescriptorProto.ExtensionRange|Object} message ExtensionRange or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.DescriptorProto.ExtensionRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExtensionRange, length delimited. - * @param {google.protobuf.DescriptorProto.ExtensionRange|Object} message ExtensionRange or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.DescriptorProto.ExtensionRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ExtensionRange from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Decodes a ExtensionRange from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Verifies a ExtensionRange. - * @function - * @param {google.protobuf.DescriptorProto.ExtensionRange|Object} message ExtensionRange or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.DescriptorProto.ExtensionRange|Object)): string; - } - - /** - * Constructs a new ReservedRange. - * @exports google.protobuf.DescriptorProto.ReservedRange - * @constructor - * @param {Object} [properties] Properties to set - */ - class ReservedRange { - - /** - * Constructs a new ReservedRange. - * @exports google.protobuf.DescriptorProto.ReservedRange - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * ReservedRange start. - * @type {number} - */ - start: number; - - /** - * ReservedRange end. - * @type {number} - */ - end: number; - - /** - * Creates a new ReservedRange instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance - */ - static create(properties?: Object): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Encodes the specified ReservedRange. - * @function - * @param {google.protobuf.DescriptorProto.ReservedRange|Object} message ReservedRange or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.DescriptorProto.ReservedRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReservedRange, length delimited. - * @param {google.protobuf.DescriptorProto.ReservedRange|Object} message ReservedRange or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.DescriptorProto.ReservedRange|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReservedRange from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Decodes a ReservedRange from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Verifies a ReservedRange. - * @function - * @param {google.protobuf.DescriptorProto.ReservedRange|Object} message ReservedRange or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.DescriptorProto.ReservedRange|Object)): string; - } - } - - /** - * Constructs a new FieldDescriptorProto. - * @exports google.protobuf.FieldDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class FieldDescriptorProto { - - /** - * Constructs a new FieldDescriptorProto. - * @exports google.protobuf.FieldDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * FieldDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * FieldDescriptorProto number. - * @type {number} - */ - number: number; - - /** - * FieldDescriptorProto label. - * @type {number} - */ - label: number; - - /** - * FieldDescriptorProto type. - * @type {number} - */ - type: number; - - /** - * FieldDescriptorProto typeName. - * @type {string} - */ - typeName: string; - - /** - * FieldDescriptorProto extendee. - * @type {string} - */ - extendee: string; - - /** - * FieldDescriptorProto defaultValue. - * @type {string} - */ - defaultValue: string; - - /** - * FieldDescriptorProto oneofIndex. - * @type {number} - */ - oneofIndex: number; - - /** - * FieldDescriptorProto jsonName. - * @type {string} - */ - jsonName: string; - - /** - * FieldDescriptorProto options. - * @type {google.protobuf.FieldOptions} - */ - options: google.protobuf.FieldOptions; - - /** - * Creates a new FieldDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.FieldDescriptorProto; - - /** - * Encodes the specified FieldDescriptorProto. - * @function - * @param {google.protobuf.FieldDescriptorProto|Object} message FieldDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.FieldDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldDescriptorProto, length delimited. - * @param {google.protobuf.FieldDescriptorProto|Object} message FieldDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.FieldDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; - - /** - * Decodes a FieldDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; - - /** - * Verifies a FieldDescriptorProto. - * @function - * @param {google.protobuf.FieldDescriptorProto|Object} message FieldDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.FieldDescriptorProto|Object)): string; - } - - /** - * Constructs a new OneofDescriptorProto. - * @exports google.protobuf.OneofDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class OneofDescriptorProto { - - /** - * Constructs a new OneofDescriptorProto. - * @exports google.protobuf.OneofDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * OneofDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * OneofDescriptorProto options. - * @type {google.protobuf.OneofOptions} - */ - options: google.protobuf.OneofOptions; - - /** - * Creates a new OneofDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.OneofDescriptorProto; - - /** - * Encodes the specified OneofDescriptorProto. - * @function - * @param {google.protobuf.OneofDescriptorProto|Object} message OneofDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.OneofDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OneofDescriptorProto, length delimited. - * @param {google.protobuf.OneofDescriptorProto|Object} message OneofDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.OneofDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a OneofDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; - - /** - * Decodes a OneofDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; - - /** - * Verifies a OneofDescriptorProto. - * @function - * @param {google.protobuf.OneofDescriptorProto|Object} message OneofDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.OneofDescriptorProto|Object)): string; - } - - /** - * Constructs a new EnumDescriptorProto. - * @exports google.protobuf.EnumDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class EnumDescriptorProto { - - /** - * Constructs a new EnumDescriptorProto. - * @exports google.protobuf.EnumDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * EnumDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * EnumDescriptorProto value. - * @type {Array.} - */ - value: google.protobuf.EnumValueDescriptorProto[]; - - /** - * EnumDescriptorProto options. - * @type {google.protobuf.EnumOptions} - */ - options: google.protobuf.EnumOptions; - - /** - * Creates a new EnumDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.EnumDescriptorProto; - - /** - * Encodes the specified EnumDescriptorProto. - * @function - * @param {google.protobuf.EnumDescriptorProto|Object} message EnumDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.EnumDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumDescriptorProto, length delimited. - * @param {google.protobuf.EnumDescriptorProto|Object} message EnumDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.EnumDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a EnumDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; - - /** - * Decodes a EnumDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; - - /** - * Verifies a EnumDescriptorProto. - * @function - * @param {google.protobuf.EnumDescriptorProto|Object} message EnumDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.EnumDescriptorProto|Object)): string; - } - - /** - * Constructs a new EnumValueDescriptorProto. - * @exports google.protobuf.EnumValueDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class EnumValueDescriptorProto { - - /** - * Constructs a new EnumValueDescriptorProto. - * @exports google.protobuf.EnumValueDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * EnumValueDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * EnumValueDescriptorProto number. - * @type {number} - */ - number: number; - - /** - * EnumValueDescriptorProto options. - * @type {google.protobuf.EnumValueOptions} - */ - options: google.protobuf.EnumValueOptions; - - /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.EnumValueDescriptorProto; - - /** - * Encodes the specified EnumValueDescriptorProto. - * @function - * @param {google.protobuf.EnumValueDescriptorProto|Object} message EnumValueDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.EnumValueDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumValueDescriptorProto, length delimited. - * @param {google.protobuf.EnumValueDescriptorProto|Object} message EnumValueDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.EnumValueDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a EnumValueDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; - - /** - * Decodes a EnumValueDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; - - /** - * Verifies a EnumValueDescriptorProto. - * @function - * @param {google.protobuf.EnumValueDescriptorProto|Object} message EnumValueDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.EnumValueDescriptorProto|Object)): string; - } - - /** - * Constructs a new ServiceDescriptorProto. - * @exports google.protobuf.ServiceDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class ServiceDescriptorProto { - - /** - * Constructs a new ServiceDescriptorProto. - * @exports google.protobuf.ServiceDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * ServiceDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * ServiceDescriptorProto method. - * @type {Array.} - */ - method: google.protobuf.MethodDescriptorProto[]; - - /** - * ServiceDescriptorProto options. - * @type {google.protobuf.ServiceOptions} - */ - options: google.protobuf.ServiceOptions; - - /** - * Creates a new ServiceDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.ServiceDescriptorProto; - - /** - * Encodes the specified ServiceDescriptorProto. - * @function - * @param {google.protobuf.ServiceDescriptorProto|Object} message ServiceDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.ServiceDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ServiceDescriptorProto, length delimited. - * @param {google.protobuf.ServiceDescriptorProto|Object} message ServiceDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.ServiceDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ServiceDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; - - /** - * Decodes a ServiceDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; - - /** - * Verifies a ServiceDescriptorProto. - * @function - * @param {google.protobuf.ServiceDescriptorProto|Object} message ServiceDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.ServiceDescriptorProto|Object)): string; - } - - /** - * Constructs a new MethodDescriptorProto. - * @exports google.protobuf.MethodDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - class MethodDescriptorProto { - - /** - * Constructs a new MethodDescriptorProto. - * @exports google.protobuf.MethodDescriptorProto - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * MethodDescriptorProto name. - * @type {string} - */ - name: string; - - /** - * MethodDescriptorProto inputType. - * @type {string} - */ - inputType: string; - - /** - * MethodDescriptorProto outputType. - * @type {string} - */ - outputType: string; - - /** - * MethodDescriptorProto options. - * @type {google.protobuf.MethodOptions} - */ - options: google.protobuf.MethodOptions; - - /** - * MethodDescriptorProto clientStreaming. - * @type {boolean} - */ - clientStreaming: boolean; - - /** - * MethodDescriptorProto serverStreaming. - * @type {boolean} - */ - serverStreaming: boolean; - - /** - * Creates a new MethodDescriptorProto instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance - */ - static create(properties?: Object): google.protobuf.MethodDescriptorProto; - - /** - * Encodes the specified MethodDescriptorProto. - * @function - * @param {google.protobuf.MethodDescriptorProto|Object} message MethodDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.MethodDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodDescriptorProto, length delimited. - * @param {google.protobuf.MethodDescriptorProto|Object} message MethodDescriptorProto or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.MethodDescriptorProto|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodDescriptorProto from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; - - /** - * Decodes a MethodDescriptorProto from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; - - /** - * Verifies a MethodDescriptorProto. - * @function - * @param {google.protobuf.MethodDescriptorProto|Object} message MethodDescriptorProto or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.MethodDescriptorProto|Object)): string; - } - - /** - * Constructs a new FileOptions. - * @exports google.protobuf.FileOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class FileOptions { - - /** - * Constructs a new FileOptions. - * @exports google.protobuf.FileOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * FileOptions javaPackage. - * @type {string} - */ - javaPackage: string; - - /** - * FileOptions javaOuterClassname. - * @type {string} - */ - javaOuterClassname: string; - - /** - * FileOptions javaMultipleFiles. - * @type {boolean} - */ - javaMultipleFiles: boolean; - - /** - * FileOptions javaGenerateEqualsAndHash. - * @type {boolean} - */ - javaGenerateEqualsAndHash: boolean; - - /** - * FileOptions javaStringCheckUtf8. - * @type {boolean} - */ - javaStringCheckUtf8: boolean; - - /** - * FileOptions optimizeFor. - * @type {number} - */ - optimizeFor: number; - - /** - * FileOptions goPackage. - * @type {string} - */ - goPackage: string; - - /** - * FileOptions ccGenericServices. - * @type {boolean} - */ - ccGenericServices: boolean; - - /** - * FileOptions javaGenericServices. - * @type {boolean} - */ - javaGenericServices: boolean; - - /** - * FileOptions pyGenericServices. - * @type {boolean} - */ - pyGenericServices: boolean; - - /** - * FileOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * FileOptions ccEnableArenas. - * @type {boolean} - */ - ccEnableArenas: boolean; - - /** - * FileOptions objcClassPrefix. - * @type {string} - */ - objcClassPrefix: string; - - /** - * FileOptions csharpNamespace. - * @type {string} - */ - csharpNamespace: string; - - /** - * FileOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new FileOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.FileOptions} FileOptions instance - */ - static create(properties?: Object): google.protobuf.FileOptions; - - /** - * Encodes the specified FileOptions. - * @function - * @param {google.protobuf.FileOptions|Object} message FileOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.FileOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileOptions, length delimited. - * @param {google.protobuf.FileOptions|Object} message FileOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.FileOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileOptions} FileOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; - - /** - * Decodes a FileOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.FileOptions} FileOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; - - /** - * Verifies a FileOptions. - * @function - * @param {google.protobuf.FileOptions|Object} message FileOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.FileOptions|Object)): string; - } - - /** - * Constructs a new MessageOptions. - * @exports google.protobuf.MessageOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class MessageOptions { - - /** - * Constructs a new MessageOptions. - * @exports google.protobuf.MessageOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * MessageOptions messageSetWireFormat. - * @type {boolean} - */ - messageSetWireFormat: boolean; - - /** - * MessageOptions noStandardDescriptorAccessor. - * @type {boolean} - */ - noStandardDescriptorAccessor: boolean; - - /** - * MessageOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * MessageOptions mapEntry. - * @type {boolean} - */ - mapEntry: boolean; - - /** - * MessageOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new MessageOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.MessageOptions} MessageOptions instance - */ - static create(properties?: Object): google.protobuf.MessageOptions; - - /** - * Encodes the specified MessageOptions. - * @function - * @param {google.protobuf.MessageOptions|Object} message MessageOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.MessageOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MessageOptions, length delimited. - * @param {google.protobuf.MessageOptions|Object} message MessageOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.MessageOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MessageOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MessageOptions} MessageOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; - - /** - * Decodes a MessageOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.MessageOptions} MessageOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; - - /** - * Verifies a MessageOptions. - * @function - * @param {google.protobuf.MessageOptions|Object} message MessageOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.MessageOptions|Object)): string; - } - - /** - * Constructs a new FieldOptions. - * @exports google.protobuf.FieldOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class FieldOptions { - - /** - * Constructs a new FieldOptions. - * @exports google.protobuf.FieldOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * FieldOptions ctype. - * @type {number} - */ - ctype: number; - - /** - * FieldOptions packed. - * @type {boolean} - */ - packed: boolean; - - /** - * FieldOptions jstype. - * @type {number} - */ - jstype: number; - - /** - * FieldOptions lazy. - * @type {boolean} - */ - lazy: boolean; - - /** - * FieldOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * FieldOptions weak. - * @type {boolean} - */ - weak: boolean; - - /** - * FieldOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new FieldOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.FieldOptions} FieldOptions instance - */ - static create(properties?: Object): google.protobuf.FieldOptions; - - /** - * Encodes the specified FieldOptions. - * @function - * @param {google.protobuf.FieldOptions|Object} message FieldOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.FieldOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldOptions, length delimited. - * @param {google.protobuf.FieldOptions|Object} message FieldOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.FieldOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions} FieldOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; - - /** - * Decodes a FieldOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions} FieldOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; - - /** - * Verifies a FieldOptions. - * @function - * @param {google.protobuf.FieldOptions|Object} message FieldOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.FieldOptions|Object)): string; - } - - /** - * Constructs a new OneofOptions. - * @exports google.protobuf.OneofOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class OneofOptions { - - /** - * Constructs a new OneofOptions. - * @exports google.protobuf.OneofOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * OneofOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new OneofOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.OneofOptions} OneofOptions instance - */ - static create(properties?: Object): google.protobuf.OneofOptions; - - /** - * Encodes the specified OneofOptions. - * @function - * @param {google.protobuf.OneofOptions|Object} message OneofOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.OneofOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OneofOptions, length delimited. - * @param {google.protobuf.OneofOptions|Object} message OneofOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.OneofOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a OneofOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofOptions} OneofOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; - - /** - * Decodes a OneofOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.OneofOptions} OneofOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; - - /** - * Verifies a OneofOptions. - * @function - * @param {google.protobuf.OneofOptions|Object} message OneofOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.OneofOptions|Object)): string; - } - - /** - * Constructs a new EnumOptions. - * @exports google.protobuf.EnumOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class EnumOptions { - - /** - * Constructs a new EnumOptions. - * @exports google.protobuf.EnumOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * EnumOptions allowAlias. - * @type {boolean} - */ - allowAlias: boolean; - - /** - * EnumOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * EnumOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new EnumOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.EnumOptions} EnumOptions instance - */ - static create(properties?: Object): google.protobuf.EnumOptions; - - /** - * Encodes the specified EnumOptions. - * @function - * @param {google.protobuf.EnumOptions|Object} message EnumOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.EnumOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumOptions, length delimited. - * @param {google.protobuf.EnumOptions|Object} message EnumOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.EnumOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a EnumOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumOptions} EnumOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; - - /** - * Decodes a EnumOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.EnumOptions} EnumOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; - - /** - * Verifies a EnumOptions. - * @function - * @param {google.protobuf.EnumOptions|Object} message EnumOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.EnumOptions|Object)): string; - } - - /** - * Constructs a new EnumValueOptions. - * @exports google.protobuf.EnumValueOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class EnumValueOptions { - - /** - * Constructs a new EnumValueOptions. - * @exports google.protobuf.EnumValueOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * EnumValueOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * EnumValueOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new EnumValueOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance - */ - static create(properties?: Object): google.protobuf.EnumValueOptions; - - /** - * Encodes the specified EnumValueOptions. - * @function - * @param {google.protobuf.EnumValueOptions|Object} message EnumValueOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.EnumValueOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumValueOptions, length delimited. - * @param {google.protobuf.EnumValueOptions|Object} message EnumValueOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.EnumValueOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a EnumValueOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; - - /** - * Decodes a EnumValueOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; - - /** - * Verifies a EnumValueOptions. - * @function - * @param {google.protobuf.EnumValueOptions|Object} message EnumValueOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.EnumValueOptions|Object)): string; - } - - /** - * Constructs a new ServiceOptions. - * @exports google.protobuf.ServiceOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class ServiceOptions { - - /** - * Constructs a new ServiceOptions. - * @exports google.protobuf.ServiceOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * ServiceOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * ServiceOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new ServiceOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.ServiceOptions} ServiceOptions instance - */ - static create(properties?: Object): google.protobuf.ServiceOptions; - - /** - * Encodes the specified ServiceOptions. - * @function - * @param {google.protobuf.ServiceOptions|Object} message ServiceOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.ServiceOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ServiceOptions, length delimited. - * @param {google.protobuf.ServiceOptions|Object} message ServiceOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.ServiceOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ServiceOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceOptions} ServiceOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; - - /** - * Decodes a ServiceOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.ServiceOptions} ServiceOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; - - /** - * Verifies a ServiceOptions. - * @function - * @param {google.protobuf.ServiceOptions|Object} message ServiceOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.ServiceOptions|Object)): string; - } - - /** - * Constructs a new MethodOptions. - * @exports google.protobuf.MethodOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - class MethodOptions { - - /** - * Constructs a new MethodOptions. - * @exports google.protobuf.MethodOptions - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * MethodOptions deprecated. - * @type {boolean} - */ - deprecated: boolean; - - /** - * MethodOptions idempotencyLevel. - * @type {number} - */ - idempotencyLevel: number; - - /** - * MethodOptions uninterpretedOption. - * @type {Array.} - */ - uninterpretedOption: google.protobuf.UninterpretedOption[]; - - /** - * Creates a new MethodOptions instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.MethodOptions} MethodOptions instance - */ - static create(properties?: Object): google.protobuf.MethodOptions; - - /** - * Encodes the specified MethodOptions. - * @function - * @param {google.protobuf.MethodOptions|Object} message MethodOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.MethodOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodOptions, length delimited. - * @param {google.protobuf.MethodOptions|Object} message MethodOptions or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.MethodOptions|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodOptions from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodOptions} MethodOptions - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; - - /** - * Decodes a MethodOptions from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.MethodOptions} MethodOptions - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; - - /** - * Verifies a MethodOptions. - * @function - * @param {google.protobuf.MethodOptions|Object} message MethodOptions or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.MethodOptions|Object)): string; - } - - /** - * Constructs a new UninterpretedOption. - * @exports google.protobuf.UninterpretedOption - * @constructor - * @param {Object} [properties] Properties to set - */ - class UninterpretedOption { - - /** - * Constructs a new UninterpretedOption. - * @exports google.protobuf.UninterpretedOption - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * UninterpretedOption name. - * @type {Array.} - */ - name: google.protobuf.UninterpretedOption.NamePart[]; - - /** - * UninterpretedOption identifierValue. - * @type {string} - */ - identifierValue: string; - - /** - * UninterpretedOption positiveIntValue. - * @type {number|Long} - */ - positiveIntValue: (number|Long); - - /** - * UninterpretedOption negativeIntValue. - * @type {number|Long} - */ - negativeIntValue: (number|Long); - - /** - * UninterpretedOption doubleValue. - * @type {number} - */ - doubleValue: number; - - /** - * UninterpretedOption stringValue. - * @type {Uint8Array} - */ - stringValue: Uint8Array; - - /** - * UninterpretedOption aggregateValue. - * @type {string} - */ - aggregateValue: string; - - /** - * Creates a new UninterpretedOption instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance - */ - static create(properties?: Object): google.protobuf.UninterpretedOption; - - /** - * Encodes the specified UninterpretedOption. - * @function - * @param {google.protobuf.UninterpretedOption|Object} message UninterpretedOption or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.UninterpretedOption|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UninterpretedOption, length delimited. - * @param {google.protobuf.UninterpretedOption|Object} message UninterpretedOption or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.UninterpretedOption|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UninterpretedOption from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; - - /** - * Decodes a UninterpretedOption from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; - - /** - * Verifies a UninterpretedOption. - * @function - * @param {google.protobuf.UninterpretedOption|Object} message UninterpretedOption or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.UninterpretedOption|Object)): string; - } - - - /** - * Constructs a new UninterpretedOption. - * @exports google.protobuf.UninterpretedOption - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace UninterpretedOption { - - /** - * Constructs a new NamePart. - * @exports google.protobuf.UninterpretedOption.NamePart - * @constructor - * @param {Object} [properties] Properties to set - */ - class NamePart { - - /** - * Constructs a new NamePart. - * @exports google.protobuf.UninterpretedOption.NamePart - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * NamePart namePart. - * @type {string} - */ - namePart: string; - - /** - * NamePart isExtension. - * @type {boolean} - */ - isExtension: boolean; - - /** - * Creates a new NamePart instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance - */ - static create(properties?: Object): google.protobuf.UninterpretedOption.NamePart; - - /** - * Encodes the specified NamePart. - * @function - * @param {google.protobuf.UninterpretedOption.NamePart|Object} message NamePart or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.UninterpretedOption.NamePart|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NamePart, length delimited. - * @param {google.protobuf.UninterpretedOption.NamePart|Object} message NamePart or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.UninterpretedOption.NamePart|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NamePart from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; - - /** - * Decodes a NamePart from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; - - /** - * Verifies a NamePart. - * @function - * @param {google.protobuf.UninterpretedOption.NamePart|Object} message NamePart or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.UninterpretedOption.NamePart|Object)): string; - } - } - - /** - * Constructs a new SourceCodeInfo. - * @exports google.protobuf.SourceCodeInfo - * @constructor - * @param {Object} [properties] Properties to set - */ - class SourceCodeInfo { - - /** - * Constructs a new SourceCodeInfo. - * @exports google.protobuf.SourceCodeInfo - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * SourceCodeInfo location. - * @type {Array.} - */ - location: google.protobuf.SourceCodeInfo.Location[]; - - /** - * Creates a new SourceCodeInfo instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance - */ - static create(properties?: Object): google.protobuf.SourceCodeInfo; - - /** - * Encodes the specified SourceCodeInfo. - * @function - * @param {google.protobuf.SourceCodeInfo|Object} message SourceCodeInfo or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.SourceCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SourceCodeInfo, length delimited. - * @param {google.protobuf.SourceCodeInfo|Object} message SourceCodeInfo or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.SourceCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SourceCodeInfo from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; - - /** - * Decodes a SourceCodeInfo from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; - - /** - * Verifies a SourceCodeInfo. - * @function - * @param {google.protobuf.SourceCodeInfo|Object} message SourceCodeInfo or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.SourceCodeInfo|Object)): string; - } - - - /** - * Constructs a new SourceCodeInfo. - * @exports google.protobuf.SourceCodeInfo - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace SourceCodeInfo { - - /** - * Constructs a new Location. - * @exports google.protobuf.SourceCodeInfo.Location - * @constructor - * @param {Object} [properties] Properties to set - */ - class Location { - - /** - * Constructs a new Location. - * @exports google.protobuf.SourceCodeInfo.Location - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Location path. - * @type {Array.} - */ - path: number[]; - - /** - * Location span. - * @type {Array.} - */ - span: number[]; - - /** - * Location leadingComments. - * @type {string} - */ - leadingComments: string; - - /** - * Location trailingComments. - * @type {string} - */ - trailingComments: string; - - /** - * Location leadingDetachedComments. - * @type {Array.} - */ - leadingDetachedComments: string[]; - - /** - * Creates a new Location instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo.Location} Location instance - */ - static create(properties?: Object): google.protobuf.SourceCodeInfo.Location; - - /** - * Encodes the specified Location. - * @function - * @param {google.protobuf.SourceCodeInfo.Location|Object} message Location or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.SourceCodeInfo.Location|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Location, length delimited. - * @param {google.protobuf.SourceCodeInfo.Location|Object} message Location or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.SourceCodeInfo.Location|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Location from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo.Location} Location - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; - - /** - * Decodes a Location from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo.Location} Location - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; - - /** - * Verifies a Location. - * @function - * @param {google.protobuf.SourceCodeInfo.Location|Object} message Location or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.SourceCodeInfo.Location|Object)): string; - } - } - - /** - * Constructs a new GeneratedCodeInfo. - * @exports google.protobuf.GeneratedCodeInfo - * @constructor - * @param {Object} [properties] Properties to set - */ - class GeneratedCodeInfo { - - /** - * Constructs a new GeneratedCodeInfo. - * @exports google.protobuf.GeneratedCodeInfo - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * GeneratedCodeInfo annotation. - * @type {Array.} - */ - annotation: google.protobuf.GeneratedCodeInfo.Annotation[]; - - /** - * Creates a new GeneratedCodeInfo instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance - */ - static create(properties?: Object): google.protobuf.GeneratedCodeInfo; - - /** - * Encodes the specified GeneratedCodeInfo. - * @function - * @param {google.protobuf.GeneratedCodeInfo|Object} message GeneratedCodeInfo or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.GeneratedCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GeneratedCodeInfo, length delimited. - * @param {google.protobuf.GeneratedCodeInfo|Object} message GeneratedCodeInfo or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.GeneratedCodeInfo|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GeneratedCodeInfo from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; - - /** - * Decodes a GeneratedCodeInfo from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; - - /** - * Verifies a GeneratedCodeInfo. - * @function - * @param {google.protobuf.GeneratedCodeInfo|Object} message GeneratedCodeInfo or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.GeneratedCodeInfo|Object)): string; - } - - - /** - * Constructs a new GeneratedCodeInfo. - * @exports google.protobuf.GeneratedCodeInfo - * @constructor - * @param {Object} [properties] Properties to set - */ - namespace GeneratedCodeInfo { - - /** - * Constructs a new Annotation. - * @exports google.protobuf.GeneratedCodeInfo.Annotation - * @constructor - * @param {Object} [properties] Properties to set - */ - class Annotation { - - /** - * Constructs a new Annotation. - * @exports google.protobuf.GeneratedCodeInfo.Annotation - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Annotation path. - * @type {Array.} - */ - path: number[]; - - /** - * Annotation sourceFile. - * @type {string} - */ - sourceFile: string; - - /** - * Annotation begin. - * @type {number} - */ - begin: number; - - /** - * Annotation end. - * @type {number} - */ - end: number; - - /** - * Creates a new Annotation instance using the specified properties. - * @param {Object} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance - */ - static create(properties?: Object): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Encodes the specified Annotation. - * @function - * @param {google.protobuf.GeneratedCodeInfo.Annotation|Object} message Annotation or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encode(message: (google.protobuf.GeneratedCodeInfo.Annotation|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Annotation, length delimited. - * @param {google.protobuf.GeneratedCodeInfo.Annotation|Object} message Annotation or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.GeneratedCodeInfo.Annotation|Object), writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Annotation from the specified reader or buffer. - * @function - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - */ - static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Decodes a Annotation from the specified reader or buffer, length delimited. - * @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - */ - static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Verifies a Annotation. - * @function - * @param {google.protobuf.GeneratedCodeInfo.Annotation|Object} message Annotation or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.GeneratedCodeInfo.Annotation|Object)): string; - } + path: number[]; + sourceFile: string; + begin: number; + end: number; + static create(properties?: Object): google.protobuf.GeneratedCodeInfo.Annotation; + static encode(message: (google.protobuf.GeneratedCodeInfo.Annotation|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static encodeDelimited(message: (google.protobuf.GeneratedCodeInfo.Annotation|Object), writer?: $protobuf.Writer): $protobuf.Writer; + static decode(readerOrBuffer: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + static decodeDelimited(readerOrBuffer: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + static verify(message: (google.protobuf.GeneratedCodeInfo.Annotation|Object)): string; } } } diff --git a/tests/typescript.ts b/tests/typescript.ts index 8eac88f97..f5e967823 100644 --- a/tests/typescript.ts +++ b/tests/typescript.ts @@ -26,7 +26,7 @@ export class Hello extends protobuf.Message { return this; } } -protobuf.Class.create(root.lookup("Hello") as protobuf.Type, Hello); +protobuf.Class.create(root.lookupType("Hello"), Hello); var hello = new Hello();