From a83425049c9a78c5607bc35e8089e08ce78a741e Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Thu, 15 Dec 2016 02:51:48 +0100 Subject: [PATCH] Fix d.ts whitespace on empty lines, added tsd-jsdoc LICENSE [ci skip] --- lib/tsd-jsdoc/LICENSE | 21 ++ lib/tsd-jsdoc/publish.js | 49 ++-- types/protobuf.js.d.ts | 592 +++++++++++++++++++-------------------- 3 files changed, 345 insertions(+), 317 deletions(-) create mode 100644 lib/tsd-jsdoc/LICENSE diff --git a/lib/tsd-jsdoc/LICENSE b/lib/tsd-jsdoc/LICENSE new file mode 100644 index 000000000..e5aebc9f7 --- /dev/null +++ b/lib/tsd-jsdoc/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2016 Chad Engler + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/lib/tsd-jsdoc/publish.js b/lib/tsd-jsdoc/publish.js index 7e481f409..418528b22 100644 --- a/lib/tsd-jsdoc/publish.js +++ b/lib/tsd-jsdoc/publish.js @@ -80,7 +80,7 @@ exports.publish = function publish(taffy, opts) { while (queuedInterfaces.length) { var element = queuedInterfaces.shift(); begin(element); - writeVirtualInterface(element); + writeInterface(element); writeln(";"); } @@ -120,7 +120,11 @@ function write() { // writes one or multiple strings, followed by a new line function writeln() { - write(Array.prototype.slice.call(arguments).join(""), "\n"); + var s = Array.prototype.slice.call(arguments).join(""); + if (s) + write(s, "\n"); + else + out.write("\n"); indentWritten = false; } @@ -268,11 +272,22 @@ function writeFunctionSignature(element, isConstructor, isTypeDef) { } } +// writes (a typedef as) an interface +function writeInterface(element) { + writeln("interface ", element.name, " {"); + ++indent; + element.properties.forEach(function(property) { + writeln(property.name, ": ", getTypeOf(property), ";"); + }); + --indent; + writeln("}"); +} + // // Handlers // -// handles a single element / any +// handles a single element of any understood type function handleElement(element, parent) { if (seen[element.longname]) return; @@ -305,6 +320,12 @@ function handleNamespace(element, parent) { writeln("}"); } +// a filter function to remove any module references +function notAModuleReference(ref) { + return ref.indexOf("module:") === -1; +} + + // handles a class or class-like function handleClass(element, parent) { begin(element); @@ -319,9 +340,7 @@ function handleClass(element, parent) { // extended classes if (element.augments) { - var augments = element.augments.filter(function(aug) { - return aug.indexOf("module:") === -1; - }); + var augments = element.augments.filter(notAModuleReference); if (augments.length) write("extends ", augments[0], " "); } @@ -332,9 +351,7 @@ function handleClass(element, parent) { Array.prototype.push.apply(impls, element.implements); if (element.mixes) Array.prototype.push.apply(impls, element.mixes); - impls = impls.filter(function(imp) { - return imp.indexOf("module:") === -1; - }); + impls = impls.filter(notAModuleReference); if (impls.length) write("implements ", impls.join(", "), " "); @@ -359,7 +376,7 @@ function handleClass(element, parent) { if (innerClasses.length) { writeln(""); - writeln("module ", element.name, "{"); + writeln("module ", element.name, " {"); ++indent; innerClasses.forEach(function(inner) { handleClass(inner, element); @@ -424,16 +441,6 @@ function handleFunction(element, parent, isConstructor) { writeln(";"); } -function writeVirtualInterface(element) { - writeln("interface ", element.name, " {"); - ++indent; - element.properties.forEach(function(property) { - writeln(property.name, ": ", getTypeOf(property), ";"); - }); - --indent; - writeln("}"); -} - // handles a type definition (not a real type) function handleTypeDef(element, parent) { if (isInterface(element)) { @@ -441,7 +448,7 @@ function handleTypeDef(element, parent) { queuedInterfaces.push(element); else { begin(element); - writeVirtualInterface(element); + writeInterface(element); } } else { begin(element); diff --git a/types/protobuf.js.d.ts b/types/protobuf.js.d.ts index d896b7b78..e9ffff907 100644 --- a/types/protobuf.js.d.ts +++ b/types/protobuf.js.d.ts @@ -1,7 +1,7 @@ // $> pbts --name protobufjs --out types/protobuf.js.d.ts src -// Generated Thu, 15 Dec 2016 01:27:37 UTC +// Generated Thu, 15 Dec 2016 01:45:16 UTC declare module "protobufjs" { - + /** * Constructs a class instance, which is also a message prototype. * @classdesc Runtime class providing the tools to create your own custom classes. @@ -10,7 +10,7 @@ declare module "protobufjs" { * @abstract */ abstract class Class { - + /** * Constructs a new message prototype for the specified reflected type and sets up its constructor. * @param {Type} type Reflected message type @@ -18,7 +18,7 @@ declare module "protobufjs" { * @returns {Message} Message prototype */ static create(type: Type, ctor?: any): Message; - + /** * Encodes a message of this type. * @name Class#encode @@ -28,7 +28,7 @@ declare module "protobufjs" { * @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 @@ -38,7 +38,7 @@ declare module "protobufjs" { * @returns {Writer} Writer */ encodeDelimited(message: (Message|Object), writer?: Writer): Writer; - + /** * Decodes a message of this type. * @name Class#decode @@ -47,7 +47,7 @@ declare module "protobufjs" { * @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 @@ -56,7 +56,7 @@ declare module "protobufjs" { * @returns {Message} Decoded message */ decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; - + /** * Verifies a message of this type. * @name Class#verify @@ -66,7 +66,7 @@ declare module "protobufjs" { */ verify(message: (Message|Object)): string; } - + /** * Provides common type definitions. * Can also be used to provide additional google types or your own custom types. @@ -80,7 +80,7 @@ declare module "protobufjs" { * @property {Object} google/protobuf/timestamp.proto Timestamp */ function common(name: string, json: Object): void; - + /** * General purpose message decoder. * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from @@ -90,7 +90,7 @@ declare module "protobufjs" { * @property {GenerateDecoder} generate Generates a type specific decoder */ function decode(this: Type, readerOrBuffer: (Reader|Uint8Array), length?: number): Message; - + /** * Generates a decoder specific to the specified message type. * @typedef GenerateDecoder @@ -99,7 +99,7 @@ declare module "protobufjs" { * @returns {Codegen} Codegen instance */ type GenerateDecoder = (mtype: Type) => Codegen; - + /** * General purpose message encoder. * @param {Message|Object} message Runtime message or plain object to encode @@ -109,7 +109,7 @@ declare module "protobufjs" { * @property {GenerateEncoder} generate Generates a type specific encoder */ function encode(this: Type, message: (Message|Object), writer?: Writer): Writer; - + /** * Generates an {@link Encoder|encoder} specific to the specified message type. * @typedef GenerateEncoder @@ -118,7 +118,7 @@ declare module "protobufjs" { * @returns {Codegen} Codegen instance */ type GenerateEncoder = (mtype: Type) => Codegen; - + /** * Constructs a new enum instance. * @classdesc Reflected enum. @@ -129,7 +129,7 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ class Enum extends ReflectionObject { - + /** * Constructs a new enum instance. * @classdesc Reflected enum. @@ -140,13 +140,13 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, values?: { [k: string]: number }, options?: Object); - + /** * Enum values by name. * @type {Object.} */ values: { [k: string]: number }; - + /** * Enum values by id. * @name Enum#valuesById @@ -154,7 +154,7 @@ declare module "protobufjs" { * @readonly */ readonly valuesById: { [k: number]: string }; - + /** * Gets this enum's values by id. This is an alias of {@link Enum#valuesById}'s getter for use within non-ES5 environments. * @name Enum#getValuesById @@ -162,14 +162,14 @@ declare module "protobufjs" { * @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; - + /** * Creates an enum from JSON. * @param {string} name Enum name @@ -178,7 +178,7 @@ declare module "protobufjs" { * @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 @@ -188,7 +188,7 @@ declare module "protobufjs" { * @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 @@ -198,7 +198,7 @@ declare module "protobufjs" { */ remove(name: string): Enum; } - + /** * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. * @classdesc Reflected message field. @@ -212,7 +212,7 @@ declare module "protobufjs" { * @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. @@ -226,97 +226,97 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, id: number, type: string, rule?: (string|Object), extend?: (string|Object), options?: Object); - + /** * Field rule, if any. * @type {string|undefined} */ rule: (string|undefined); - + /** * Field type. * @type {string} */ type: string; - + /** * Unique field id. * @type {number} */ id: number; - + /** * 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; - + /** * Message this field belongs to. * @type {?Type} */ message: Type; - + /** * OneOf this field belongs to, if any, * @type {?OneOf} */ partOf: OneOf; - + /** * The field's default value. Only relevant when working with proto2. * @type {*} */ defaultValue: any; - + /** * Whether this field's value should be treated as a long. * @type {boolean} */ long: boolean; - + /** * Resolved type if not a basic type. * @type {?(Type|Enum)} */ resolvedType: (Type|Enum); - + /** * Sister-field within the extended type if a declaring extension field. * @type {?Field} */ extensionField: Field; - + /** * Sister-field within the declaring namespace if an extended field. * @type {?Field} */ declaringField: Field; - + /** * Determines whether this field is packed. Only relevant when repeated and working with proto2. * @name Field#packed @@ -324,7 +324,7 @@ declare module "protobufjs" { * @readonly */ readonly packed: boolean; - + /** * Determines whether this field is packed. This is an alias of {@link Field#packed}'s getter for use within non-ES5 environments. * @name Field#isPacked @@ -332,14 +332,14 @@ declare module "protobufjs" { * @returns {boolean} */ isPacked(): boolean; - + /** * 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; - + /** * Constructs a field from JSON. * @param {string} name Field name @@ -348,14 +348,14 @@ declare module "protobufjs" { * @throws {TypeError} If arguments are invalid */ static fromJSON(name: string, json: Object): Field; - + /** * Resolves this field's type references. * @returns {Field} `this` * @throws {Error} If any reference cannot be resolved */ resolve(): Field; - + /** * Converts a field value to JSON using the specified options. Note that this method does not account for repeated fields and must be called once for each repeated element instead. * @param {*} value Field value @@ -365,7 +365,7 @@ declare module "protobufjs" { */ jsonConvert(value: any, options?: { [k: string]: any }): any; } - + /** * A node-style callback as used by {@link load} and {@link Root#load}. * @typedef LoadCallback @@ -375,7 +375,7 @@ declare module "protobufjs" { * @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 @@ -384,7 +384,7 @@ declare module "protobufjs" { * @returns {undefined} */ 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 @@ -395,7 +395,7 @@ declare module "protobufjs" { * @variation 2 */ 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 @@ -406,7 +406,7 @@ declare module "protobufjs" { * @variation 3 */ 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 @@ -415,20 +415,20 @@ declare module "protobufjs" { * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid */ function loadSync(filename: (string|string[]), root?: Root): Root; - + /** * Named roots. * @name roots * @type {Object.} */ var roots: { [k: string]: Root }; - + /** * Reconfigures the library according to the environment. * @returns {undefined} */ function configure(): void; - + /** * Constructs a new map field instance. * @classdesc Reflected map field. @@ -441,7 +441,7 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ class MapField extends Field { - + /** * Constructs a new map field instance. * @classdesc Reflected map field. @@ -454,26 +454,26 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, id: number, keyType: string, type: string, options?: Object); - + /** * Key type. * @type {string} */ keyType: string; - + /** * Resolved key type if not a basic type. * @type {?ReflectionObject} */ resolvedKeyType: ReflectionObject; - + /** * Tests if the specified JSON object describes a map field. * @param {Object} json JSON object to test * @returns {boolean} `true` if the object describes a field */ static testJSON(json: Object): boolean; - + /** * Constructs a map field from JSON. * @param {string} name Field name @@ -483,7 +483,7 @@ declare module "protobufjs" { */ static fromJSON(name: string, json: Object): MapField; } - + /** * Constructs a new message instance. * @@ -496,7 +496,7 @@ declare module "protobufjs" { * @see {@link Class.create} */ abstract class Message extends Object { - + /** * Converts this message to a JSON object. * @param {Object.} [options] Conversion options @@ -514,7 +514,7 @@ declare module "protobufjs" { * @returns {Object.} JSON object */ asJSON(options?: { [k: string]: any }): { [k: string]: any }; - + /** * Reference to the reflected type. * @name Message.$type @@ -522,7 +522,7 @@ declare module "protobufjs" { * @readonly */ static readonly $type: Type; - + /** * Reference to the reflected type. * @name Message#$type @@ -530,7 +530,7 @@ declare module "protobufjs" { * @readonly */ readonly $type: Type; - + /** * Encodes a message of this type. * @param {Message|Object} message Message to encode @@ -538,7 +538,7 @@ declare module "protobufjs" { * @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 @@ -546,7 +546,7 @@ declare module "protobufjs" { * @returns {Writer} Writer */ static encodeDelimited(message: (Message|Object), writer?: Writer): Writer; - + /** * Decodes a message of this type. * @name Message.decode @@ -555,7 +555,7 @@ declare module "protobufjs" { * @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 @@ -564,7 +564,7 @@ declare module "protobufjs" { * @returns {Message} Decoded message */ static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Message; - + /** * Verifies a message of this type. * @name Message.verify @@ -574,7 +574,7 @@ declare module "protobufjs" { */ static verify(message: (Message|Object)): string; } - + /** * Constructs a new service method instance. * @classdesc Reflected service method. @@ -589,7 +589,7 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ class Method extends ReflectionObject { - + /** * Constructs a new service method instance. * @classdesc Reflected service method. @@ -604,56 +604,56 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, type: (string|undefined), requestType: string, responseType: string, requestStream?: (boolean|Object), responseStream?: (boolean|Object), options?: Object); - + /** * Method type. * @type {string} */ type: string; - + /** * Request type. * @type {string} */ requestType: string; - + /** * Whether requests are streamed or not. * @type {boolean|undefined} */ requestStream: (boolean|undefined); - + /** * Response type. * @type {string} */ responseType: string; - + /** * Whether responses are streamed or not. * @type {boolean|undefined} */ responseStream: (boolean|undefined); - + /** * Resolved request type. * @type {?Type} */ resolvedRequestType: Type; - + /** * Resolved response type. * @type {?Type} */ resolvedResponseType: Type; - + /** * Tests if the specified JSON object describes a service method. * @param {Object} json JSON object * @returns {boolean} `true` if the object describes a map field */ static testJSON(json: Object): boolean; - + /** * Constructs a service method from JSON. * @param {string} name Method name @@ -663,7 +663,7 @@ declare module "protobufjs" { */ static fromJSON(name: string, json: Object): Method; } - + /** * Constructs a new namespace instance. * @classdesc Reflected namespace and base class of all reflection objects containing nested objects. @@ -673,7 +673,7 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ class Namespace extends ReflectionObject { - + /** * Constructs a new namespace instance. * @classdesc Reflected namespace and base class of all reflection objects containing nested objects. @@ -683,13 +683,13 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, options?: Object); - + /** * 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 @@ -697,14 +697,14 @@ declare module "protobufjs" { * @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; - + /** * Constructs a namespace from JSON. * @param {string} name Namespace name @@ -713,7 +713,7 @@ declare module "protobufjs" { * @throws {TypeError} If arguments are invalid */ static fromJSON(name: string, json: Object): Namespace; - + /** * Converts an array of reflection objects to JSON. * @memberof Namespace @@ -721,21 +721,21 @@ declare module "protobufjs" { * @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; - + /** * 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; - + /** * Adds a nested object to this namespace. * @param {ReflectionObject} object Nested object to add @@ -744,7 +744,7 @@ declare module "protobufjs" { * @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 @@ -753,7 +753,7 @@ declare module "protobufjs" { * @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 @@ -761,13 +761,13 @@ declare module "protobufjs" { * @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; - + /** * Looks up the reflection object at the specified path, relative to this namespace. * @param {string|string[]} path Path to look up @@ -775,7 +775,7 @@ declare module "protobufjs" { * @returns {?ReflectionObject} Looked up object or `null` if none could be found */ 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} in that it throws instead of returning `null`. @@ -785,7 +785,7 @@ declare module "protobufjs" { * @throws {Error} If `path` does not point to a type */ lookupType: any; - + /** * Looks up the {@link Service|service} at the specified path, relative to this namespace. * Besides its signature, this methods differs from {@link Namespace#lookup} in that it throws instead of returning `null`. @@ -796,7 +796,7 @@ declare module "protobufjs" { */ lookupService: any; } - + /** * Constructs a new reflection object instance. * @classdesc Base class of all reflection objects. @@ -806,31 +806,31 @@ declare module "protobufjs" { * @abstract */ abstract class ReflectionObject { - + /** * Options. * @type {Object.|undefined} */ options: ({ [k: string]: any }|undefined); - + /** * Unique name within its namespace. * @type {string} */ name: string; - + /** * Parent namespace. * @type {?Namespace} */ parent: Namespace; - + /** * Whether already resolved or not. * @type {boolean} */ resolved: boolean; - + /** * Reference to the root namespace. * @name ReflectionObject#root @@ -838,7 +838,7 @@ declare module "protobufjs" { * @readonly */ readonly root: Root; - + /** * Full name including leading dot. * @name ReflectionObject#fullName @@ -846,7 +846,7 @@ declare module "protobufjs" { * @readonly */ readonly fullName: string; - + /** * Lets the specified constructor extend this class. * @memberof ReflectionObject @@ -855,41 +855,41 @@ declare module "protobufjs" { * @this ReflectionObject */ static extend(this: ReflectionObject, constructor: any): Object; - + /** * Converts this reflection object to its JSON representation. * @returns {Object} JSON object * @abstract */ toJSON(): Object; - + /** * 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; - + /** * 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; - + /** * Sets an option. * @param {string} name Option name @@ -898,7 +898,7 @@ declare module "protobufjs" { * @returns {ReflectionObject} `this` */ setOption(name: string, value: any, ifNotSet?: boolean): ReflectionObject; - + /** * Sets multiple options. * @param {Object.} options Options to set @@ -906,14 +906,14 @@ declare module "protobufjs" { * @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; } - + /** * Constructs a new oneof instance. * @classdesc Reflected oneof. @@ -924,7 +924,7 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ class OneOf extends ReflectionObject { - + /** * Constructs a new oneof instance. * @classdesc Reflected oneof. @@ -935,19 +935,19 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, fieldNames?: (string[]|Object), options?: Object); - + /** * Upper cased name for getter/setter calls. * @type {string} */ ucName: string; - + /** * 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 @@ -955,14 +955,14 @@ declare module "protobufjs" { * @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 @@ -971,14 +971,14 @@ declare module "protobufjs" { * @throws {TypeError} If arguments are invalid */ static fromJSON(name: string, json: Object): MapField; - + /** * Adds a field to this oneof. * @param {Field} field Field to add * @returns {OneOf} `this` */ add(field: Field): OneOf; - + /** * Removes a field from this oneof. * @param {Field} field Field to remove @@ -986,7 +986,7 @@ declare module "protobufjs" { */ remove(field: Field): OneOf; } - + /** * Result object returned from {@link parse}. * @typedef ParserResult @@ -1004,7 +1004,7 @@ declare module "protobufjs" { syntax: (string|undefined); root: Root; } - + /** * Parses the given .proto source and returns an object with the parsed contents. * @param {string} source Source contents @@ -1012,7 +1012,7 @@ declare module "protobufjs" { * @returns {ParserResult} Parser result */ function parse(source: string, root?: Root): ParserResult; - + /** * Constructs a new reader instance using the specified buffer. * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. @@ -1020,7 +1020,7 @@ declare module "protobufjs" { * @param {Uint8Array} buffer Buffer to read from */ class Reader { - + /** * Constructs a new reader instance using the specified buffer. * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. @@ -1028,56 +1028,56 @@ declare module "protobufjs" { * @param {Uint8Array} buffer Buffer to read from */ constructor(buffer: Uint8Array); - + /** * Read buffer. * @type {Uint8Array} */ buf: Uint8Array; - + /** * Read buffer position. * @type {number} */ pos: number; - + /** * Read buffer length. * @type {number} */ len: number; - + /** * Creates a new reader using the specified buffer. * @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 tag. * @returns {{id: number, wireType: number}} Field id and wire type */ tag(): Object; - + /** * Reads a varint as a signed 32 bit value. * @returns {number} Value read */ int32(): number; - + /** * Reads a varint as an unsigned 32 bit value. * @returns {number} Value read */ uint32(): 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 @@ -1085,7 +1085,7 @@ declare module "protobufjs" { * @returns {Long|number} Value read */ int64(): (Long|number); - + /** * Reads a varint as an unsigned 64 bit value. * @name Reader#uint64 @@ -1093,7 +1093,7 @@ declare module "protobufjs" { * @returns {Long|number} Value read */ uint64(): (Long|number); - + /** * Reads a zig-zag encoded varint as a signed 64 bit value. * @name Reader#sint64 @@ -1101,25 +1101,25 @@ declare module "protobufjs" { * @returns {Long|number} Value read */ sint64(): (Long|number); - + /** * 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 zig-zag encoded fixed 32 bits as a number. * @returns {number} Value read */ sfixed32(): number; - + /** * Reads fixed 64 bits. * @name Reader#fixed64 @@ -1127,7 +1127,7 @@ declare module "protobufjs" { * @returns {Long|number} Value read */ fixed64(): (Long|number); - + /** * Reads zig-zag encoded fixed 64 bits. * @name Reader#sfixed64 @@ -1135,54 +1135,54 @@ declare module "protobufjs" { * @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 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 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 next element of the specified wire type. * @param {number} wireType Wire type received * @returns {Reader} `this` */ skipType(wireType: number): Reader; - + /** * Resets this instance and frees all resources. * @param {Uint8Array} [buffer] New buffer for a new sequence of read operations * @returns {Reader} `this` */ reset(buffer?: Uint8Array): Reader; - + /** * Finishes the current sequence of read operations, frees all resources and returns the remaining buffer. * @param {Uint8Array} [buffer] New buffer for a new sequence of read operations @@ -1190,7 +1190,7 @@ declare module "protobufjs" { */ finish(buffer?: Uint8Array): Uint8Array; } - + /** * Constructs a new buffer reader instance. * @classdesc Wire format reader using node buffers. @@ -1199,7 +1199,7 @@ declare module "protobufjs" { * @param {Buffer} buffer Buffer to read from */ class BufferReader extends Reader { - + /** * Constructs a new buffer reader instance. * @classdesc Wire format reader using node buffers. @@ -1209,7 +1209,7 @@ declare module "protobufjs" { */ constructor(buffer: Buffer); } - + /** * Constructs a new root namespace instance. * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. @@ -1218,7 +1218,7 @@ declare module "protobufjs" { * @param {Object} [options] Top level options */ class Root extends Namespace { - + /** * Constructs a new root namespace instance. * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. @@ -1227,19 +1227,19 @@ declare module "protobufjs" { * @param {Object} [options] Top level options */ constructor(options?: Object); - + /** * Deferred extension fields. * @type {Field[]} */ deferred: Field[]; - + /** * Resolved file names of loaded files. * @type {string[]} */ files: string[]; - + /** * Loads a JSON definition into a root namespace. * @param {*} json JSON definition @@ -1247,7 +1247,7 @@ declare module "protobufjs" { * @returns {Root} Root namespace */ static fromJSON(json: 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. @@ -1257,7 +1257,7 @@ declare module "protobufjs" { * @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 @@ -1265,7 +1265,7 @@ declare module "protobufjs" { * @returns {undefined} */ load(filename: (string|string[]), callback: LoadCallback): void; - + /** * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. * @name Root#load @@ -1275,7 +1275,7 @@ declare module "protobufjs" { * @variation 2 */ load(filename: (string|string[])): 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 @@ -1284,13 +1284,13 @@ declare module "protobufjs" { */ loadSync(filename: (string|string[])): Root; } - + /** * Streaming RPC helpers. * @namespace */ module rpc { - + /** * Constructs a new RPC service instance. * @classdesc An RPC service as returned by {@link Service#create}. @@ -1300,7 +1300,7 @@ declare module "protobufjs" { * @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}. @@ -1310,13 +1310,13 @@ declare module "protobufjs" { * @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. @@ -1325,7 +1325,7 @@ declare module "protobufjs" { end(endedByRPC?: boolean): rpc.Service; } } - + /** * Constructs a new service instance. * @classdesc Reflected service. @@ -1336,7 +1336,7 @@ declare module "protobufjs" { * @throws {TypeError} If arguments are invalid */ class Service extends Namespace { - + /** * Constructs a new service instance. * @classdesc Reflected service. @@ -1347,13 +1347,13 @@ declare module "protobufjs" { * @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 @@ -1361,14 +1361,14 @@ declare module "protobufjs" { * @readonly */ readonly methodsArray: Method[]; - + /** * Tests if the specified JSON object describes a service. * @param {Object} json JSON object to test * @returns {boolean} `true` if the object describes a service */ static testJSON(json: Object): boolean; - + /** * Constructs a service from JSON. * @param {string} name Service name @@ -1377,7 +1377,7 @@ declare module "protobufjs" { * @throws {TypeError} If arguments are invalid */ static fromJSON(name: string, json: Object): Service; - + /** * Creates a runtime service using the specified rpc implementation. * @param {function(Method, Uint8Array, function)} rpcImpl RPC implementation ({@link RPCImpl|see}) @@ -1387,7 +1387,7 @@ declare module "protobufjs" { */ 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 @@ -1398,7 +1398,7 @@ declare module "protobufjs" { * @returns {undefined} */ type RPCImpl = (method: Method, requestData: Uint8Array, callback: RPCCallback) => void; - + /** * Node-style callback as used by {@link RPCImpl}. * @typedef RPCCallback @@ -1408,7 +1408,7 @@ declare module "protobufjs" { * @returns {undefined} */ type RPCCallback = (error: Error, responseData?: Uint8Array) => void; - + /** * Handle object returned from {@link tokenize}. * @typedef {Object} TokenizerHandle @@ -1425,14 +1425,14 @@ declare module "protobufjs" { push: () => any; skip: () => any; } - + /** * Tokenizes the given .proto source and returns an object with useful utility functions. * @param {string} source Source contents * @returns {TokenizerHandle} Tokenizer handle */ function tokenize(source: string): TokenizerHandle; - + /** * Constructs a new reflected message type instance. * @classdesc Reflected message type. @@ -1442,7 +1442,7 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ class Type extends Namespace { - + /** * Constructs a new reflected message type instance. * @classdesc Reflected message type. @@ -1452,31 +1452,31 @@ declare module "protobufjs" { * @param {Object} [options] Declared options */ constructor(name: string, options?: Object); - + /** * 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[][]; - + /** * Message fields by id. * @name Type#fieldsById @@ -1484,7 +1484,7 @@ declare module "protobufjs" { * @readonly */ readonly fieldsById: { [k: number]: Field }; - + /** * Fields of this message as an array for iteration. * @name Type#fieldsArray @@ -1492,7 +1492,7 @@ declare module "protobufjs" { * @readonly */ readonly fieldsArray: Field[]; - + /** * Repeated fields of this message as an array for iteration. * @name Type#repeatedFieldsArray @@ -1500,7 +1500,7 @@ declare module "protobufjs" { * @readonly */ readonly repeatedFieldsArray: Field[]; - + /** * Oneofs of this message as an array for iteration. * @name Type#oneofsArray @@ -1508,21 +1508,21 @@ declare module "protobufjs" { * @readonly */ readonly oneofsArray: OneOf[]; - + /** * The registered constructor, if any registered, otherwise a generic constructor. * @name Type#ctor * @type {Class} */ ctor: Class; - + /** * 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 type from JSON. * @param {string} name Message name @@ -1530,7 +1530,7 @@ declare module "protobufjs" { * @returns {Type} Created message type */ static fromJSON(name: string, json: Object): Type; - + /** * Adds a nested object to this type. * @param {ReflectionObject} object Nested object to add @@ -1539,7 +1539,7 @@ declare module "protobufjs" { * @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; - + /** * Removes a nested object from this type. * @param {ReflectionObject} object Nested object to remove @@ -1548,14 +1548,14 @@ declare module "protobufjs" { * @throws {Error} If `object` is not a member of this type */ remove(object: ReflectionObject): Type; - + /** * Creates a new message of this type using the specified properties. * @param {Object|*} [properties] Properties to set * @returns {Message} Runtime message */ create(properties?: (Object|any)): Message; - + /** * Encodes a message of this type. * @param {Message|Object} message Message instance or plain object @@ -1563,7 +1563,7 @@ declare module "protobufjs" { * @returns {Writer} writer */ encode(message: (Message|Object), writer?: Writer): Writer; - + /** * Encodes a message of this type preceeded by its byte length as a varint. * @param {Message|Object} message Message instance or plain object @@ -1571,7 +1571,7 @@ declare module "protobufjs" { * @returns {Writer} writer */ encodeDelimited(message: (Message|Object), writer?: Writer): Writer; - + /** * Decodes a message of this type. * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from @@ -1579,14 +1579,14 @@ declare module "protobufjs" { * @returns {Message} Decoded message */ decode(readerOrBuffer: (Reader|Uint8Array), length?: number): 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; - + /** * Verifies that field values are valid and that required fields are present. * @param {Message|Object} message Message to verify @@ -1594,44 +1594,44 @@ declare module "protobufjs" { */ verify(message: (Message|Object)): string; } - + /** * Common type constants. * @namespace */ module types { - + /** * Basic type wire types. * @type {Object.} */ var basic: { [k: string]: number }; - + /** * Basic type defaults. * @type {Object.} */ var defaults: { [k: string]: any }; - + /** * Basic long type wire types. * @type {Object.} */ var long: { [k: string]: number }; - + /** * Allowed types for map keys with their associated wire type. * @type {Object.} */ var mapKey: { [k: string]: number }; - + /** * Allowed types for packed repeated fields with their associated wire type. * @type {Object.} */ var packed: { [k: string]: number }; } - + /** * A codegen instance as returned by {@link codegen}, that also is a sprintf-like appender function. * @typedef Codegen @@ -1643,7 +1643,7 @@ declare module "protobufjs" { * @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 @@ -1653,7 +1653,7 @@ declare module "protobufjs" { * @returns {undefined} */ type FetchCallback = (error: Error, contents?: string) => void; - + /** * Any compatible Long instance. * @typedef Long @@ -1667,7 +1667,7 @@ declare module "protobufjs" { high: number; unsigned: boolean; } - + /** * An allocator as used by {@link util.pool}. * @typedef PoolAllocator @@ -1676,7 +1676,7 @@ declare module "protobufjs" { * @returns {Uint8Array} Buffer */ type PoolAllocator = (size: number) => Uint8Array; - + /** * A slicer as used by {@link util.pool}. * @typedef PoolSlicer @@ -1687,13 +1687,13 @@ declare module "protobufjs" { * @this {Uint8Array} */ type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array; - + /** * Various utility functions. * @namespace */ module util { - + /** * Returns a promise from a node-style callback function. * @memberof util @@ -1703,21 +1703,21 @@ declare module "protobufjs" { * @returns {Promise<*>} Promisified function */ function asPromise(fn: () => any, ctx: Object, params: any): Promise; - + /** * A minimal base64 implementation for number arrays. * @memberof util * @namespace */ module 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 @@ -1726,7 +1726,7 @@ declare module "protobufjs" { * @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 @@ -1737,7 +1737,7 @@ declare module "protobufjs" { */ function decode(string: string, buffer: Uint8Array, offset: number): number; } - + /** * A closure for generating functions programmatically. * @memberof util @@ -1749,7 +1749,7 @@ declare module "protobufjs" { * @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. @@ -1757,7 +1757,7 @@ declare module "protobufjs" { * @constructor */ class EventEmitter { - + /** * Constructs a new event emitter instance. * @classdesc A minimal event emitter. @@ -1765,7 +1765,7 @@ declare module "protobufjs" { * @constructor */ constructor(); - + /** * Registers an event listener. * @param {string} evt Event name @@ -1774,7 +1774,7 @@ declare module "protobufjs" { * @returns {util.EventEmitter} `this` */ on(evt: string, fn: () => any, ctx?: Object): util.EventEmitter; - + /** * Removes an event listener or any matching listeners if arguments are omitted. * @param {string} [evt] Event name. Removes all listeners if omitted. @@ -1782,7 +1782,7 @@ declare module "protobufjs" { * @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 @@ -1791,7 +1791,7 @@ declare module "protobufjs" { */ emit(evt: string, args: any): util.EventEmitter; } - + /** * Fetches the contents of a file. * @memberof util @@ -1800,7 +1800,7 @@ declare module "protobufjs" { * @returns {Promise|undefined} A Promise if `callback` has been omitted */ function fetch(path: string, callback?: FetchCallback): (Promise|undefined); - + /** * Node's fs module if available. * @name fs @@ -1808,7 +1808,7 @@ declare module "protobufjs" { * @type {Object} */ var fs: Object; - + /** * Constructs new long bits. * @classdesc Helper class for working with the low and high bits of a 64 bit value. @@ -1818,7 +1818,7 @@ declare module "protobufjs" { * @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. @@ -1828,107 +1828,107 @@ declare module "protobufjs" { * @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; - + /** * 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 */ module 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 @@ -1938,7 +1938,7 @@ declare module "protobufjs" { */ function resolve(originPath: string, includePath: string, alreadyNormalized?: boolean): string; } - + /** * A general purpose buffer pool. * @memberof util @@ -1949,28 +1949,28 @@ declare module "protobufjs" { * @returns {PoolAllocator} Pooled allocator */ function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator; - + /** * Whether running within node or not. * @memberof util * @type {boolean} */ var isNode: boolean; - + /** * Optional buffer class to use. * If you assign any compatible buffer implementation to this property, the library will use it. * @type {*} */ var Buffer: any; - + /** * Optional Long class to use. * If you assign any compatible long implementation to this property, the library will use it. * @type {*} */ var Long: any; - + /** * Tests if the specified value is an integer. * @function @@ -1978,28 +1978,28 @@ declare module "protobufjs" { * @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 @@ -2007,7 +2007,7 @@ declare module "protobufjs" { * @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 @@ -2015,7 +2015,7 @@ declare module "protobufjs" { * @returns {boolean} `true` if not equal */ function longNeq(a: (number|Long), b: (number|Long)): boolean; - + /** * Defines the specified properties on the specified target. Also adds getters and setters for non-ES5 environments. * @param {Object} target Target object @@ -2023,7 +2023,7 @@ declare module "protobufjs" { * @returns {undefined} */ function props(target: Object, descriptors: Object): void; - + /** * Defines the specified property on the specified target. Also adds getters and setters for non-ES5 environments. * @param {Object} target Target object @@ -2032,34 +2032,34 @@ declare module "protobufjs" { * @returns {undefined} */ function prop(target: Object, key: string, descriptor: Object): 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 */ module 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 @@ -2068,7 +2068,7 @@ declare module "protobufjs" { * @returns {string} String read */ function read(buffer: Uint8Array, start: number, end: number): string; - + /** * Writes a string as UTF8 bytes. * @param {string} string Source string @@ -2078,14 +2078,14 @@ declare module "protobufjs" { */ function write(string: string, buffer: Uint8Array, offset: number): number; } - + /** * 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 @@ -2094,28 +2094,28 @@ declare module "protobufjs" { * @returns {Object} Destination object */ function merge(dst: Object, src: Object, ifNotSet?: boolean): Object; - + /** * 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 a string to camel case notation. * @param {string} str String to convert * @returns {string} Converted string */ function camelCase(str: string): string; - + /** * Converts a string to underscore notation. * @param {string} str String to convert * @returns {string} Converted string */ function underScore(str: string): string; - + /** * Creates a new buffer of whatever type supported by the environment. * @param {number} [size=0] Buffer size @@ -2123,7 +2123,7 @@ declare module "protobufjs" { */ function newBuffer(size?: number): Uint8Array; } - + /** * General purpose message verifier. * @param {Message|Object} message Runtime message or plain object to verify @@ -2132,7 +2132,7 @@ declare module "protobufjs" { * @property {GenerateVerifier} generate Generates a type specific verifier */ function verify(this: Type, message: (Message|Object)): string; - + /** * Generates a verifier specific to the specified message type. * @typedef GenerateVerifier @@ -2141,58 +2141,58 @@ declare module "protobufjs" { * @returns {Codegen} Codegen instance */ type GenerateVerifier = (mtype: Type) => Codegen; - + /** * Constructs a new writer instance. * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. * @constructor */ class Writer { - + /** * Constructs a new writer instance. * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. * @constructor */ constructor(); - + /** * Current length. * @type {number} */ len: number; - + /** * Operations head. * @type {Object} */ head: Object; - + /** * Operations tail * @type {Object} */ tail: Object; - + /** * Linked forked states. * @type {?Object} */ states: Object; - + /** * Creates a new writer. * @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; - + /** * Pushes a new operation to the queue. * @param {function(Uint8Array, number, *)} fn Function to call @@ -2201,7 +2201,7 @@ declare module "protobufjs" { * @returns {Writer} `this` */ push(fn: () => any, len: number, val: number): Writer; - + /** * Writes a tag. * @param {number} id Field id @@ -2209,14 +2209,14 @@ declare module "protobufjs" { * @returns {Writer} `this` */ tag(id: number, wireType: 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 @@ -2224,14 +2224,14 @@ declare module "protobufjs" { * @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 an unsigned 64 bit value as a varint. * @param {Long|number|string} value Value to write @@ -2239,7 +2239,7 @@ declare module "protobufjs" { * @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 @@ -2248,7 +2248,7 @@ declare module "protobufjs" { * @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 @@ -2256,28 +2256,28 @@ declare module "protobufjs" { * @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 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 64 bit value as fixed 64 bits. * @param {Long|number|string} value Value to write @@ -2285,7 +2285,7 @@ declare module "protobufjs" { * @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 @@ -2293,7 +2293,7 @@ declare module "protobufjs" { * @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 @@ -2301,7 +2301,7 @@ declare module "protobufjs" { * @returns {Writer} `this` */ float(value: number): Writer; - + /** * Writes a double (64 bit float). * @function @@ -2309,48 +2309,48 @@ declare module "protobufjs" { * @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 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#}, {@link Writer#reset} or {@link Writer#finish} 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 to the last state and appends the fork state's current write length as a varint followed by its operations. * @param {number} [id] Id with wire type 2 to prepend as a tag where applicable * @returns {Writer} `this` */ ldelim(id?: number): Writer; - + /** * Finishes the current sequence of write operations and frees all resources. * @returns {Uint8Array} Finished buffer */ finish(): Uint8Array; } - + /** * Constructs a new buffer writer instance. * @classdesc Wire format writer using node buffers. @@ -2359,7 +2359,7 @@ declare module "protobufjs" { * @constructor */ class BufferWriter extends Writer { - + /** * Constructs a new buffer writer instance. * @classdesc Wire format writer using node buffers. @@ -2368,7 +2368,7 @@ declare module "protobufjs" { * @constructor */ constructor(); - + /** * Allocates a buffer of the specified size. * @param {number} size Buffer size