wildfire chat server source initial submit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
syntax = "proto3";
|
||||
|
||||
/// message comment
|
||||
message TestMessage {
|
||||
/// field comment
|
||||
string testField = 1;
|
||||
|
||||
/// map field comment
|
||||
map<string, string> testMap = 2;
|
||||
|
||||
/// oneof field comment
|
||||
oneof testOneof {
|
||||
/// oneof string comment
|
||||
string testOneofString = 3;
|
||||
/// oneof bool comment
|
||||
bool testOneofBool = 4;
|
||||
}
|
||||
}
|
||||
|
||||
/// service comment
|
||||
service TestService {
|
||||
/// method comment
|
||||
rpc testMethod(TestMessage) returns (TestMessage) {}
|
||||
}
|
||||
|
||||
/// enum comment
|
||||
enum TestEnum {
|
||||
/// enum value comment
|
||||
VALUE = 1;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* File with alternate comment syntax.
|
||||
* This file uses double slash and regular star-slash comment styles for doc
|
||||
* strings.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
// Message with
|
||||
// a
|
||||
// multi-line comment.
|
||||
message Test1 {
|
||||
|
||||
/**
|
||||
* Field with a doc-block comment.
|
||||
*/
|
||||
string field1 = 1;
|
||||
|
||||
// Field with a single-line comment starting with two slashes.
|
||||
uint32 field2 = 2;
|
||||
|
||||
/// Field with a single-line comment starting with three slashes.
|
||||
bool field3 = 3;
|
||||
|
||||
/* Field with a single-line slash-star comment. */
|
||||
bool field4 = 4;
|
||||
|
||||
bool field5 = 5; // Field with a trailing single-line two-slash comment.
|
||||
|
||||
bool field6 = 6; /// Field with a trailing single-line three-slash comment.
|
||||
|
||||
bool field7 = 7; /* Field with a trailing single-line slash-star comment. */
|
||||
|
||||
bool field8 = 8;
|
||||
|
||||
// Field with a
|
||||
// multi-line comment.
|
||||
bool field9 = 9;
|
||||
|
||||
/**
|
||||
* Field with a
|
||||
* multi-line doc-block comment.
|
||||
*/
|
||||
string field10 = 10;
|
||||
}
|
||||
|
||||
/* Message
|
||||
with
|
||||
a multiline plain slash-star
|
||||
comment.
|
||||
*/
|
||||
message Test2 {
|
||||
}
|
||||
|
||||
/*
|
||||
* Message
|
||||
* with
|
||||
* a
|
||||
* comment and stars.
|
||||
*/
|
||||
enum Test3 {
|
||||
|
||||
/** Value with a comment. */
|
||||
ONE = 1;
|
||||
|
||||
// Value with a single-line comment.
|
||||
TWO = 2;
|
||||
|
||||
/// Value with a triple-slash comment.
|
||||
THREE = 3; // ignored
|
||||
|
||||
FOUR = 4; /// Other value with a comment.
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
import * as $protobuf from "../..";
|
||||
export interface ITest1 {
|
||||
field1?: (string|null);
|
||||
field2?: (number|null);
|
||||
field3?: (boolean|null);
|
||||
}
|
||||
|
||||
export class Test1 implements ITest1 {
|
||||
constructor(properties?: ITest1);
|
||||
public field1: string;
|
||||
public field2: number;
|
||||
public field3: boolean;
|
||||
public static create(properties?: ITest1): Test1;
|
||||
public static encode(message: ITest1, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: ITest1, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Test1;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Test1;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): Test1;
|
||||
public static toObject(message: Test1, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export interface ITest2 {
|
||||
}
|
||||
|
||||
export class Test2 implements ITest2 {
|
||||
constructor(properties?: ITest2);
|
||||
public static create(properties?: ITest2): Test2;
|
||||
public static encode(message: ITest2, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: ITest2, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Test2;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Test2;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): Test2;
|
||||
public static toObject(message: Test2, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export enum Test3 {
|
||||
ONE = 1,
|
||||
TWO = 2,
|
||||
THREE = 3,
|
||||
FOUR = 4
|
||||
}
|
||||
Executable
+425
@@ -0,0 +1,425 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
"use strict";
|
||||
|
||||
var $protobuf = require("../../minimal");
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
var $root = $protobuf.roots.test_comments || ($protobuf.roots.test_comments = {});
|
||||
|
||||
$root.Test1 = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Test1.
|
||||
* @exports ITest1
|
||||
* @interface ITest1
|
||||
* @property {string|null} [field1] Field with a comment.
|
||||
* @property {number|null} [field2] Test1 field2
|
||||
* @property {boolean|null} [field3] Field with a comment and a <a href="http://example.com/foo/">link</a>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Test1.
|
||||
* @exports Test1
|
||||
* @classdesc Message
|
||||
* with
|
||||
* a
|
||||
* comment.
|
||||
* @implements ITest1
|
||||
* @constructor
|
||||
* @param {ITest1=} [properties] Properties to set
|
||||
*/
|
||||
function Test1(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Field with a comment.
|
||||
* @member {string} field1
|
||||
* @memberof Test1
|
||||
* @instance
|
||||
*/
|
||||
Test1.prototype.field1 = "";
|
||||
|
||||
/**
|
||||
* Test1 field2.
|
||||
* @member {number} field2
|
||||
* @memberof Test1
|
||||
* @instance
|
||||
*/
|
||||
Test1.prototype.field2 = 0;
|
||||
|
||||
/**
|
||||
* Field with a comment and a <a href="http://example.com/foo/">link</a>
|
||||
* @member {boolean} field3
|
||||
* @memberof Test1
|
||||
* @instance
|
||||
*/
|
||||
Test1.prototype.field3 = false;
|
||||
|
||||
/**
|
||||
* Creates a new Test1 instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {ITest1=} [properties] Properties to set
|
||||
* @returns {Test1} Test1 instance
|
||||
*/
|
||||
Test1.create = function create(properties) {
|
||||
return new Test1(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Test1 message. Does not implicitly {@link Test1.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {ITest1} message Test1 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Test1.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.field1 != null && message.hasOwnProperty("field1"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.field1);
|
||||
if (message.field2 != null && message.hasOwnProperty("field2"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.field2);
|
||||
if (message.field3 != null && message.hasOwnProperty("field3"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.field3);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Test1 message, length delimited. Does not implicitly {@link Test1.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {ITest1} message Test1 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Test1.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Test1 message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Test1} Test1
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Test1.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Test1();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.field1 = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.field2 = reader.uint32();
|
||||
break;
|
||||
case 3:
|
||||
message.field3 = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Test1 message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Test1} Test1
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Test1.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a Test1 message.
|
||||
* @function verify
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
Test1.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.field1 != null && message.hasOwnProperty("field1"))
|
||||
if (!$util.isString(message.field1))
|
||||
return "field1: string expected";
|
||||
if (message.field2 != null && message.hasOwnProperty("field2"))
|
||||
if (!$util.isInteger(message.field2))
|
||||
return "field2: integer expected";
|
||||
if (message.field3 != null && message.hasOwnProperty("field3"))
|
||||
if (typeof message.field3 !== "boolean")
|
||||
return "field3: boolean expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Test1 message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Test1} Test1
|
||||
*/
|
||||
Test1.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Test1)
|
||||
return object;
|
||||
var message = new $root.Test1();
|
||||
if (object.field1 != null)
|
||||
message.field1 = String(object.field1);
|
||||
if (object.field2 != null)
|
||||
message.field2 = object.field2 >>> 0;
|
||||
if (object.field3 != null)
|
||||
message.field3 = Boolean(object.field3);
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a Test1 message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Test1
|
||||
* @static
|
||||
* @param {Test1} message Test1
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
Test1.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults) {
|
||||
object.field1 = "";
|
||||
object.field2 = 0;
|
||||
object.field3 = false;
|
||||
}
|
||||
if (message.field1 != null && message.hasOwnProperty("field1"))
|
||||
object.field1 = message.field1;
|
||||
if (message.field2 != null && message.hasOwnProperty("field2"))
|
||||
object.field2 = message.field2;
|
||||
if (message.field3 != null && message.hasOwnProperty("field3"))
|
||||
object.field3 = message.field3;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Test1 to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Test1
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
Test1.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return Test1;
|
||||
})();
|
||||
|
||||
$root.Test2 = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Test2.
|
||||
* @exports ITest2
|
||||
* @interface ITest2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Test2.
|
||||
* @exports Test2
|
||||
* @classdesc Represents a Test2.
|
||||
* @implements ITest2
|
||||
* @constructor
|
||||
* @param {ITest2=} [properties] Properties to set
|
||||
*/
|
||||
function Test2(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Test2 instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {ITest2=} [properties] Properties to set
|
||||
* @returns {Test2} Test2 instance
|
||||
*/
|
||||
Test2.create = function create(properties) {
|
||||
return new Test2(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Test2 message. Does not implicitly {@link Test2.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {ITest2} message Test2 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Test2.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Test2 message, length delimited. Does not implicitly {@link Test2.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {ITest2} message Test2 message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Test2.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Test2 message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Test2} Test2
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Test2.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Test2();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Test2 message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Test2} Test2
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Test2.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a Test2 message.
|
||||
* @function verify
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
Test2.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Test2 message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Test2} Test2
|
||||
*/
|
||||
Test2.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Test2)
|
||||
return object;
|
||||
return new $root.Test2();
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a Test2 message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Test2
|
||||
* @static
|
||||
* @param {Test2} message Test2
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
Test2.toObject = function toObject() {
|
||||
return {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Test2 to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Test2
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
Test2.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return Test2;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Test3 enum.
|
||||
* @exports Test3
|
||||
* @enum {string}
|
||||
* @property {number} ONE=1 Value with a comment.
|
||||
* @property {number} TWO=2 TWO value
|
||||
* @property {number} THREE=3 Preferred value with a comment.
|
||||
* @property {number} FOUR=4 Other value with a comment.
|
||||
*/
|
||||
$root.Test3 = (function() {
|
||||
var valuesById = {}, values = Object.create(valuesById);
|
||||
values[valuesById[1] = "ONE"] = 1;
|
||||
values[valuesById[2] = "TWO"] = 2;
|
||||
values[valuesById[3] = "THREE"] = 3;
|
||||
values[valuesById[4] = "FOUR"] = 4;
|
||||
return values;
|
||||
})();
|
||||
|
||||
module.exports = $root;
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* File with a comment. (TODO)
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
/**
|
||||
* Message
|
||||
* with
|
||||
a
|
||||
** comment.
|
||||
*/
|
||||
message Test1 { /// not a valid comment
|
||||
|
||||
/**
|
||||
* Field with a comment.
|
||||
*/
|
||||
string field1 = 1;
|
||||
|
||||
// Field with no comment.
|
||||
uint32 field2 = 2;
|
||||
|
||||
bool field3 = 3; /// Field with a comment and a <a href="http://example.com/foo/">link</a>
|
||||
}
|
||||
|
||||
// Message
|
||||
// with
|
||||
// no
|
||||
// comment.
|
||||
message Test2 {
|
||||
}
|
||||
|
||||
/*
|
||||
* Message
|
||||
* with
|
||||
* no
|
||||
* comment
|
||||
*/
|
||||
enum Test3 {
|
||||
|
||||
/** Value with a comment. */
|
||||
ONE = 1;
|
||||
|
||||
// Value with no comment.
|
||||
TWO = 2;
|
||||
|
||||
/// Preferred value with a comment.
|
||||
THREE = 3; /// Value with a comment.
|
||||
|
||||
FOUR = 4; /// Other value with a comment.
|
||||
}
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"nested": {
|
||||
"Something": {
|
||||
"fields": {}
|
||||
},
|
||||
"google": {
|
||||
"nested": {
|
||||
"protobuf": {
|
||||
"nested": {
|
||||
"Any": {
|
||||
"fields": {
|
||||
"type_url": {
|
||||
"type": "string",
|
||||
"id": 1
|
||||
},
|
||||
"value": {
|
||||
"type": "bytes",
|
||||
"id": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"Duration": {
|
||||
"fields": {
|
||||
"seconds": {
|
||||
"type": "int64",
|
||||
"id": 1
|
||||
},
|
||||
"nanos": {
|
||||
"type": "int32",
|
||||
"id": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"Empty": {
|
||||
"fields": {}
|
||||
},
|
||||
"Struct": {
|
||||
"fields": {
|
||||
"fields": {
|
||||
"keyType": "string",
|
||||
"type": "Value",
|
||||
"id": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"Value": {
|
||||
"oneofs": {
|
||||
"kind": {
|
||||
"oneof": [
|
||||
"nullValue",
|
||||
"numberValue",
|
||||
"stringValue",
|
||||
"boolValue",
|
||||
"structValue",
|
||||
"listValue"
|
||||
]
|
||||
}
|
||||
},
|
||||
"fields": {
|
||||
"nullValue": {
|
||||
"type": "NullValue",
|
||||
"id": 1
|
||||
},
|
||||
"numberValue": {
|
||||
"type": "double",
|
||||
"id": 2
|
||||
},
|
||||
"stringValue": {
|
||||
"type": "string",
|
||||
"id": 3
|
||||
},
|
||||
"boolValue": {
|
||||
"type": "bool",
|
||||
"id": 4
|
||||
},
|
||||
"structValue": {
|
||||
"type": "Struct",
|
||||
"id": 5
|
||||
},
|
||||
"listValue": {
|
||||
"type": "ListValue",
|
||||
"id": 6
|
||||
}
|
||||
}
|
||||
},
|
||||
"NullValue": {
|
||||
"values": {
|
||||
"NULL_VALUE": 0
|
||||
}
|
||||
},
|
||||
"ListValue": {
|
||||
"fields": {
|
||||
"values": {
|
||||
"rule": "repeated",
|
||||
"type": "Value",
|
||||
"id": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"Timestamp": {
|
||||
"fields": {
|
||||
"seconds": {
|
||||
"type": "int64",
|
||||
"id": 1
|
||||
},
|
||||
"nanos": {
|
||||
"type": "int32",
|
||||
"id": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
message Something {
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import * as $protobuf from "../..";
|
||||
export interface IMessage {
|
||||
stringVal?: (string|null);
|
||||
stringRepeated?: (string[]|null);
|
||||
uint64Val?: (number|Long|null);
|
||||
uint64Repeated?: ((number|Long)[]|null);
|
||||
bytesVal?: (Uint8Array|null);
|
||||
bytesRepeated?: (Uint8Array[]|null);
|
||||
enumVal?: (Message.SomeEnum|null);
|
||||
enumRepeated?: (Message.SomeEnum[]|null);
|
||||
int64Map?: ({ [k: string]: (number|Long) }|null);
|
||||
}
|
||||
|
||||
export class Message implements IMessage {
|
||||
constructor(properties?: IMessage);
|
||||
public stringVal: string;
|
||||
public stringRepeated: string[];
|
||||
public uint64Val: (number|Long);
|
||||
public uint64Repeated: (number|Long)[];
|
||||
public bytesVal: Uint8Array;
|
||||
public bytesRepeated: Uint8Array[];
|
||||
public enumVal: Message.SomeEnum;
|
||||
public enumRepeated: Message.SomeEnum[];
|
||||
public int64Map: { [k: string]: (number|Long) };
|
||||
public static create(properties?: IMessage): Message;
|
||||
public static encode(message: IMessage, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMessage, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Message;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Message;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): Message;
|
||||
public static toObject(message: Message, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export namespace Message {
|
||||
|
||||
enum SomeEnum {
|
||||
ONE = 1,
|
||||
TWO = 2
|
||||
}
|
||||
}
|
||||
Executable
+568
@@ -0,0 +1,568 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
"use strict";
|
||||
|
||||
var $protobuf = require("../../minimal");
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
var $root = $protobuf.roots.test_convert || ($protobuf.roots.test_convert = {});
|
||||
|
||||
$root.Message = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Message.
|
||||
* @exports IMessage
|
||||
* @interface IMessage
|
||||
* @property {string|null} [stringVal] Message stringVal
|
||||
* @property {Array.<string>|null} [stringRepeated] Message stringRepeated
|
||||
* @property {number|Long|null} [uint64Val] Message uint64Val
|
||||
* @property {Array.<number|Long>|null} [uint64Repeated] Message uint64Repeated
|
||||
* @property {Uint8Array|null} [bytesVal] Message bytesVal
|
||||
* @property {Array.<Uint8Array>|null} [bytesRepeated] Message bytesRepeated
|
||||
* @property {Message.SomeEnum|null} [enumVal] Message enumVal
|
||||
* @property {Array.<Message.SomeEnum>|null} [enumRepeated] Message enumRepeated
|
||||
* @property {Object.<string,number|Long>|null} [int64Map] Message int64Map
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Message.
|
||||
* @exports Message
|
||||
* @classdesc Represents a Message.
|
||||
* @implements IMessage
|
||||
* @constructor
|
||||
* @param {IMessage=} [properties] Properties to set
|
||||
*/
|
||||
function Message(properties) {
|
||||
this.stringRepeated = [];
|
||||
this.uint64Repeated = [];
|
||||
this.bytesRepeated = [];
|
||||
this.enumRepeated = [];
|
||||
this.int64Map = {};
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Message stringVal.
|
||||
* @member {string} stringVal
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.stringVal = "";
|
||||
|
||||
/**
|
||||
* Message stringRepeated.
|
||||
* @member {Array.<string>} stringRepeated
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.stringRepeated = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Message uint64Val.
|
||||
* @member {number|Long} uint64Val
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.uint64Val = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
|
||||
|
||||
/**
|
||||
* Message uint64Repeated.
|
||||
* @member {Array.<number|Long>} uint64Repeated
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.uint64Repeated = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Message bytesVal.
|
||||
* @member {Uint8Array} bytesVal
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.bytesVal = $util.newBuffer([]);
|
||||
|
||||
/**
|
||||
* Message bytesRepeated.
|
||||
* @member {Array.<Uint8Array>} bytesRepeated
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.bytesRepeated = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Message enumVal.
|
||||
* @member {Message.SomeEnum} enumVal
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.enumVal = 1;
|
||||
|
||||
/**
|
||||
* Message enumRepeated.
|
||||
* @member {Array.<Message.SomeEnum>} enumRepeated
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.enumRepeated = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Message int64Map.
|
||||
* @member {Object.<string,number|Long>} int64Map
|
||||
* @memberof Message
|
||||
* @instance
|
||||
*/
|
||||
Message.prototype.int64Map = $util.emptyObject;
|
||||
|
||||
/**
|
||||
* Creates a new Message instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {IMessage=} [properties] Properties to set
|
||||
* @returns {Message} Message instance
|
||||
*/
|
||||
Message.create = function create(properties) {
|
||||
return new Message(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Message message. Does not implicitly {@link Message.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {IMessage} message Message message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Message.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.stringVal != null && message.hasOwnProperty("stringVal"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.stringVal);
|
||||
if (message.stringRepeated != null && message.stringRepeated.length)
|
||||
for (var i = 0; i < message.stringRepeated.length; ++i)
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.stringRepeated[i]);
|
||||
if (message.uint64Val != null && message.hasOwnProperty("uint64Val"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Val);
|
||||
if (message.uint64Repeated != null && message.uint64Repeated.length) {
|
||||
writer.uint32(/* id 4, wireType 2 =*/34).fork();
|
||||
for (var i = 0; i < message.uint64Repeated.length; ++i)
|
||||
writer.uint64(message.uint64Repeated[i]);
|
||||
writer.ldelim();
|
||||
}
|
||||
if (message.bytesVal != null && message.hasOwnProperty("bytesVal"))
|
||||
writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.bytesVal);
|
||||
if (message.bytesRepeated != null && message.bytesRepeated.length)
|
||||
for (var i = 0; i < message.bytesRepeated.length; ++i)
|
||||
writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.bytesRepeated[i]);
|
||||
if (message.enumVal != null && message.hasOwnProperty("enumVal"))
|
||||
writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enumVal);
|
||||
if (message.enumRepeated != null && message.enumRepeated.length) {
|
||||
writer.uint32(/* id 8, wireType 2 =*/66).fork();
|
||||
for (var i = 0; i < message.enumRepeated.length; ++i)
|
||||
writer.int32(message.enumRepeated[i]);
|
||||
writer.ldelim();
|
||||
}
|
||||
if (message.int64Map != null && message.hasOwnProperty("int64Map"))
|
||||
for (var keys = Object.keys(message.int64Map), i = 0; i < keys.length; ++i)
|
||||
writer.uint32(/* id 9, wireType 2 =*/74).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 0 =*/16).int64(message.int64Map[keys[i]]).ldelim();
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Message message, length delimited. Does not implicitly {@link Message.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {IMessage} message Message message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Message.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Message message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Message} Message
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Message.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Message(), key;
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.stringVal = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
if (!(message.stringRepeated && message.stringRepeated.length))
|
||||
message.stringRepeated = [];
|
||||
message.stringRepeated.push(reader.string());
|
||||
break;
|
||||
case 3:
|
||||
message.uint64Val = reader.uint64();
|
||||
break;
|
||||
case 4:
|
||||
if (!(message.uint64Repeated && message.uint64Repeated.length))
|
||||
message.uint64Repeated = [];
|
||||
if ((tag & 7) === 2) {
|
||||
var end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2)
|
||||
message.uint64Repeated.push(reader.uint64());
|
||||
} else
|
||||
message.uint64Repeated.push(reader.uint64());
|
||||
break;
|
||||
case 5:
|
||||
message.bytesVal = reader.bytes();
|
||||
break;
|
||||
case 6:
|
||||
if (!(message.bytesRepeated && message.bytesRepeated.length))
|
||||
message.bytesRepeated = [];
|
||||
message.bytesRepeated.push(reader.bytes());
|
||||
break;
|
||||
case 7:
|
||||
message.enumVal = reader.int32();
|
||||
break;
|
||||
case 8:
|
||||
if (!(message.enumRepeated && message.enumRepeated.length))
|
||||
message.enumRepeated = [];
|
||||
if ((tag & 7) === 2) {
|
||||
var end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2)
|
||||
message.enumRepeated.push(reader.int32());
|
||||
} else
|
||||
message.enumRepeated.push(reader.int32());
|
||||
break;
|
||||
case 9:
|
||||
reader.skip().pos++;
|
||||
if (message.int64Map === $util.emptyObject)
|
||||
message.int64Map = {};
|
||||
key = reader.string();
|
||||
reader.pos++;
|
||||
message.int64Map[key] = reader.int64();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Message message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Message} Message
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Message.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a Message message.
|
||||
* @function verify
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
Message.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.stringVal != null && message.hasOwnProperty("stringVal"))
|
||||
if (!$util.isString(message.stringVal))
|
||||
return "stringVal: string expected";
|
||||
if (message.stringRepeated != null && message.hasOwnProperty("stringRepeated")) {
|
||||
if (!Array.isArray(message.stringRepeated))
|
||||
return "stringRepeated: array expected";
|
||||
for (var i = 0; i < message.stringRepeated.length; ++i)
|
||||
if (!$util.isString(message.stringRepeated[i]))
|
||||
return "stringRepeated: string[] expected";
|
||||
}
|
||||
if (message.uint64Val != null && message.hasOwnProperty("uint64Val"))
|
||||
if (!$util.isInteger(message.uint64Val) && !(message.uint64Val && $util.isInteger(message.uint64Val.low) && $util.isInteger(message.uint64Val.high)))
|
||||
return "uint64Val: integer|Long expected";
|
||||
if (message.uint64Repeated != null && message.hasOwnProperty("uint64Repeated")) {
|
||||
if (!Array.isArray(message.uint64Repeated))
|
||||
return "uint64Repeated: array expected";
|
||||
for (var i = 0; i < message.uint64Repeated.length; ++i)
|
||||
if (!$util.isInteger(message.uint64Repeated[i]) && !(message.uint64Repeated[i] && $util.isInteger(message.uint64Repeated[i].low) && $util.isInteger(message.uint64Repeated[i].high)))
|
||||
return "uint64Repeated: integer|Long[] expected";
|
||||
}
|
||||
if (message.bytesVal != null && message.hasOwnProperty("bytesVal"))
|
||||
if (!(message.bytesVal && typeof message.bytesVal.length === "number" || $util.isString(message.bytesVal)))
|
||||
return "bytesVal: buffer expected";
|
||||
if (message.bytesRepeated != null && message.hasOwnProperty("bytesRepeated")) {
|
||||
if (!Array.isArray(message.bytesRepeated))
|
||||
return "bytesRepeated: array expected";
|
||||
for (var i = 0; i < message.bytesRepeated.length; ++i)
|
||||
if (!(message.bytesRepeated[i] && typeof message.bytesRepeated[i].length === "number" || $util.isString(message.bytesRepeated[i])))
|
||||
return "bytesRepeated: buffer[] expected";
|
||||
}
|
||||
if (message.enumVal != null && message.hasOwnProperty("enumVal"))
|
||||
switch (message.enumVal) {
|
||||
default:
|
||||
return "enumVal: enum value expected";
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
if (message.enumRepeated != null && message.hasOwnProperty("enumRepeated")) {
|
||||
if (!Array.isArray(message.enumRepeated))
|
||||
return "enumRepeated: array expected";
|
||||
for (var i = 0; i < message.enumRepeated.length; ++i)
|
||||
switch (message.enumRepeated[i]) {
|
||||
default:
|
||||
return "enumRepeated: enum value[] expected";
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (message.int64Map != null && message.hasOwnProperty("int64Map")) {
|
||||
if (!$util.isObject(message.int64Map))
|
||||
return "int64Map: object expected";
|
||||
var key = Object.keys(message.int64Map);
|
||||
for (var i = 0; i < key.length; ++i)
|
||||
if (!$util.isInteger(message.int64Map[key[i]]) && !(message.int64Map[key[i]] && $util.isInteger(message.int64Map[key[i]].low) && $util.isInteger(message.int64Map[key[i]].high)))
|
||||
return "int64Map: integer|Long{k:string} expected";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Message message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Message} Message
|
||||
*/
|
||||
Message.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Message)
|
||||
return object;
|
||||
var message = new $root.Message();
|
||||
if (object.stringVal != null)
|
||||
message.stringVal = String(object.stringVal);
|
||||
if (object.stringRepeated) {
|
||||
if (!Array.isArray(object.stringRepeated))
|
||||
throw TypeError(".Message.stringRepeated: array expected");
|
||||
message.stringRepeated = [];
|
||||
for (var i = 0; i < object.stringRepeated.length; ++i)
|
||||
message.stringRepeated[i] = String(object.stringRepeated[i]);
|
||||
}
|
||||
if (object.uint64Val != null)
|
||||
if ($util.Long)
|
||||
(message.uint64Val = $util.Long.fromValue(object.uint64Val)).unsigned = true;
|
||||
else if (typeof object.uint64Val === "string")
|
||||
message.uint64Val = parseInt(object.uint64Val, 10);
|
||||
else if (typeof object.uint64Val === "number")
|
||||
message.uint64Val = object.uint64Val;
|
||||
else if (typeof object.uint64Val === "object")
|
||||
message.uint64Val = new $util.LongBits(object.uint64Val.low >>> 0, object.uint64Val.high >>> 0).toNumber(true);
|
||||
if (object.uint64Repeated) {
|
||||
if (!Array.isArray(object.uint64Repeated))
|
||||
throw TypeError(".Message.uint64Repeated: array expected");
|
||||
message.uint64Repeated = [];
|
||||
for (var i = 0; i < object.uint64Repeated.length; ++i)
|
||||
if ($util.Long)
|
||||
(message.uint64Repeated[i] = $util.Long.fromValue(object.uint64Repeated[i])).unsigned = true;
|
||||
else if (typeof object.uint64Repeated[i] === "string")
|
||||
message.uint64Repeated[i] = parseInt(object.uint64Repeated[i], 10);
|
||||
else if (typeof object.uint64Repeated[i] === "number")
|
||||
message.uint64Repeated[i] = object.uint64Repeated[i];
|
||||
else if (typeof object.uint64Repeated[i] === "object")
|
||||
message.uint64Repeated[i] = new $util.LongBits(object.uint64Repeated[i].low >>> 0, object.uint64Repeated[i].high >>> 0).toNumber(true);
|
||||
}
|
||||
if (object.bytesVal != null)
|
||||
if (typeof object.bytesVal === "string")
|
||||
$util.base64.decode(object.bytesVal, message.bytesVal = $util.newBuffer($util.base64.length(object.bytesVal)), 0);
|
||||
else if (object.bytesVal.length)
|
||||
message.bytesVal = object.bytesVal;
|
||||
if (object.bytesRepeated) {
|
||||
if (!Array.isArray(object.bytesRepeated))
|
||||
throw TypeError(".Message.bytesRepeated: array expected");
|
||||
message.bytesRepeated = [];
|
||||
for (var i = 0; i < object.bytesRepeated.length; ++i)
|
||||
if (typeof object.bytesRepeated[i] === "string")
|
||||
$util.base64.decode(object.bytesRepeated[i], message.bytesRepeated[i] = $util.newBuffer($util.base64.length(object.bytesRepeated[i])), 0);
|
||||
else if (object.bytesRepeated[i].length)
|
||||
message.bytesRepeated[i] = object.bytesRepeated[i];
|
||||
}
|
||||
switch (object.enumVal) {
|
||||
case "ONE":
|
||||
case 1:
|
||||
message.enumVal = 1;
|
||||
break;
|
||||
case "TWO":
|
||||
case 2:
|
||||
message.enumVal = 2;
|
||||
break;
|
||||
}
|
||||
if (object.enumRepeated) {
|
||||
if (!Array.isArray(object.enumRepeated))
|
||||
throw TypeError(".Message.enumRepeated: array expected");
|
||||
message.enumRepeated = [];
|
||||
for (var i = 0; i < object.enumRepeated.length; ++i)
|
||||
switch (object.enumRepeated[i]) {
|
||||
default:
|
||||
case "ONE":
|
||||
case 1:
|
||||
message.enumRepeated[i] = 1;
|
||||
break;
|
||||
case "TWO":
|
||||
case 2:
|
||||
message.enumRepeated[i] = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (object.int64Map) {
|
||||
if (typeof object.int64Map !== "object")
|
||||
throw TypeError(".Message.int64Map: object expected");
|
||||
message.int64Map = {};
|
||||
for (var keys = Object.keys(object.int64Map), i = 0; i < keys.length; ++i)
|
||||
if ($util.Long)
|
||||
(message.int64Map[keys[i]] = $util.Long.fromValue(object.int64Map[keys[i]])).unsigned = false;
|
||||
else if (typeof object.int64Map[keys[i]] === "string")
|
||||
message.int64Map[keys[i]] = parseInt(object.int64Map[keys[i]], 10);
|
||||
else if (typeof object.int64Map[keys[i]] === "number")
|
||||
message.int64Map[keys[i]] = object.int64Map[keys[i]];
|
||||
else if (typeof object.int64Map[keys[i]] === "object")
|
||||
message.int64Map[keys[i]] = new $util.LongBits(object.int64Map[keys[i]].low >>> 0, object.int64Map[keys[i]].high >>> 0).toNumber();
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a Message message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Message
|
||||
* @static
|
||||
* @param {Message} message Message
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
Message.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.arrays || options.defaults) {
|
||||
object.stringRepeated = [];
|
||||
object.uint64Repeated = [];
|
||||
object.bytesRepeated = [];
|
||||
object.enumRepeated = [];
|
||||
}
|
||||
if (options.objects || options.defaults)
|
||||
object.int64Map = {};
|
||||
if (options.defaults) {
|
||||
object.stringVal = "";
|
||||
if ($util.Long) {
|
||||
var long = new $util.Long(0, 0, true);
|
||||
object.uint64Val = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
||||
} else
|
||||
object.uint64Val = options.longs === String ? "0" : 0;
|
||||
if (options.bytes === String)
|
||||
object.bytesVal = "";
|
||||
else {
|
||||
object.bytesVal = [];
|
||||
if (options.bytes !== Array)
|
||||
object.bytesVal = $util.newBuffer(object.bytesVal);
|
||||
}
|
||||
object.enumVal = options.enums === String ? "ONE" : 1;
|
||||
}
|
||||
if (message.stringVal != null && message.hasOwnProperty("stringVal"))
|
||||
object.stringVal = message.stringVal;
|
||||
if (message.stringRepeated && message.stringRepeated.length) {
|
||||
object.stringRepeated = [];
|
||||
for (var j = 0; j < message.stringRepeated.length; ++j)
|
||||
object.stringRepeated[j] = message.stringRepeated[j];
|
||||
}
|
||||
if (message.uint64Val != null && message.hasOwnProperty("uint64Val"))
|
||||
if (typeof message.uint64Val === "number")
|
||||
object.uint64Val = options.longs === String ? String(message.uint64Val) : message.uint64Val;
|
||||
else
|
||||
object.uint64Val = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Val) : options.longs === Number ? new $util.LongBits(message.uint64Val.low >>> 0, message.uint64Val.high >>> 0).toNumber(true) : message.uint64Val;
|
||||
if (message.uint64Repeated && message.uint64Repeated.length) {
|
||||
object.uint64Repeated = [];
|
||||
for (var j = 0; j < message.uint64Repeated.length; ++j)
|
||||
if (typeof message.uint64Repeated[j] === "number")
|
||||
object.uint64Repeated[j] = options.longs === String ? String(message.uint64Repeated[j]) : message.uint64Repeated[j];
|
||||
else
|
||||
object.uint64Repeated[j] = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Repeated[j]) : options.longs === Number ? new $util.LongBits(message.uint64Repeated[j].low >>> 0, message.uint64Repeated[j].high >>> 0).toNumber(true) : message.uint64Repeated[j];
|
||||
}
|
||||
if (message.bytesVal != null && message.hasOwnProperty("bytesVal"))
|
||||
object.bytesVal = options.bytes === String ? $util.base64.encode(message.bytesVal, 0, message.bytesVal.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesVal) : message.bytesVal;
|
||||
if (message.bytesRepeated && message.bytesRepeated.length) {
|
||||
object.bytesRepeated = [];
|
||||
for (var j = 0; j < message.bytesRepeated.length; ++j)
|
||||
object.bytesRepeated[j] = options.bytes === String ? $util.base64.encode(message.bytesRepeated[j], 0, message.bytesRepeated[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesRepeated[j]) : message.bytesRepeated[j];
|
||||
}
|
||||
if (message.enumVal != null && message.hasOwnProperty("enumVal"))
|
||||
object.enumVal = options.enums === String ? $root.Message.SomeEnum[message.enumVal] : message.enumVal;
|
||||
if (message.enumRepeated && message.enumRepeated.length) {
|
||||
object.enumRepeated = [];
|
||||
for (var j = 0; j < message.enumRepeated.length; ++j)
|
||||
object.enumRepeated[j] = options.enums === String ? $root.Message.SomeEnum[message.enumRepeated[j]] : message.enumRepeated[j];
|
||||
}
|
||||
var keys2;
|
||||
if (message.int64Map && (keys2 = Object.keys(message.int64Map)).length) {
|
||||
object.int64Map = {};
|
||||
for (var j = 0; j < keys2.length; ++j)
|
||||
if (typeof message.int64Map[keys2[j]] === "number")
|
||||
object.int64Map[keys2[j]] = options.longs === String ? String(message.int64Map[keys2[j]]) : message.int64Map[keys2[j]];
|
||||
else
|
||||
object.int64Map[keys2[j]] = options.longs === String ? $util.Long.prototype.toString.call(message.int64Map[keys2[j]]) : options.longs === Number ? new $util.LongBits(message.int64Map[keys2[j]].low >>> 0, message.int64Map[keys2[j]].high >>> 0).toNumber() : message.int64Map[keys2[j]];
|
||||
}
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Message to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Message
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
Message.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
/**
|
||||
* SomeEnum enum.
|
||||
* @name Message.SomeEnum
|
||||
* @enum {string}
|
||||
* @property {number} ONE=1 ONE value
|
||||
* @property {number} TWO=2 TWO value
|
||||
*/
|
||||
Message.SomeEnum = (function() {
|
||||
var valuesById = {}, values = Object.create(valuesById);
|
||||
values[valuesById[1] = "ONE"] = 1;
|
||||
values[valuesById[2] = "TWO"] = 2;
|
||||
return values;
|
||||
})();
|
||||
|
||||
return Message;
|
||||
})();
|
||||
|
||||
module.exports = $root;
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message Message {
|
||||
|
||||
string string_val = 1;
|
||||
repeated string string_repeated = 2;
|
||||
|
||||
uint64 uint64_val = 3;
|
||||
repeated uint64 uint64_repeated = 4;
|
||||
|
||||
bytes bytes_val = 5;
|
||||
repeated bytes bytes_repeated = 6;
|
||||
|
||||
SomeEnum enum_val = 7;
|
||||
repeated SomeEnum enum_repeated = 8;
|
||||
|
||||
enum SomeEnum {
|
||||
ONE = 1;
|
||||
TWO = 2;
|
||||
}
|
||||
|
||||
map<string,int64> int64_map = 9;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
Copyright 2014, Google Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,816 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Author: [email protected] (Kenton Varda)
|
||||
// Based on original Protocol Buffers design by
|
||||
// Sanjay Ghemawat, Jeff Dean, and others.
|
||||
//
|
||||
// The messages in this file describe the definitions found in .proto files.
|
||||
// A valid .proto file can be translated directly to a FileDescriptorProto
|
||||
// without any other information (e.g. without reading its imports).
|
||||
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package google.protobuf;
|
||||
option go_package = "descriptor";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "DescriptorProtos";
|
||||
option csharp_namespace = "Google.Protobuf.Reflection";
|
||||
option objc_class_prefix = "GPB";
|
||||
|
||||
// descriptor.proto must be optimized for speed because reflection-based
|
||||
// algorithms don't work during bootstrapping.
|
||||
option optimize_for = SPEED;
|
||||
|
||||
// The protocol compiler can output a FileDescriptorSet containing the .proto
|
||||
// files it parses.
|
||||
message FileDescriptorSet {
|
||||
repeated FileDescriptorProto file = 1;
|
||||
}
|
||||
|
||||
// Describes a complete .proto file.
|
||||
message FileDescriptorProto {
|
||||
optional string name = 1; // file name, relative to root of source tree
|
||||
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||
|
||||
// Names of files imported by this file.
|
||||
repeated string dependency = 3;
|
||||
// Indexes of the public imported files in the dependency list above.
|
||||
repeated int32 public_dependency = 10;
|
||||
// Indexes of the weak imported files in the dependency list.
|
||||
// For Google-internal migration only. Do not use.
|
||||
repeated int32 weak_dependency = 11;
|
||||
|
||||
// All top-level definitions in this file.
|
||||
repeated DescriptorProto message_type = 4;
|
||||
repeated EnumDescriptorProto enum_type = 5;
|
||||
repeated ServiceDescriptorProto service = 6;
|
||||
repeated FieldDescriptorProto extension = 7;
|
||||
|
||||
optional FileOptions options = 8;
|
||||
|
||||
// This field contains optional information about the original source code.
|
||||
// You may safely remove this entire field without harming runtime
|
||||
// functionality of the descriptors -- the information is needed only by
|
||||
// development tools.
|
||||
optional SourceCodeInfo source_code_info = 9;
|
||||
|
||||
// The syntax of the proto file.
|
||||
// The supported values are "proto2" and "proto3".
|
||||
optional string syntax = 12;
|
||||
}
|
||||
|
||||
// Describes a message type.
|
||||
message DescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
repeated FieldDescriptorProto field = 2;
|
||||
repeated FieldDescriptorProto extension = 6;
|
||||
|
||||
repeated DescriptorProto nested_type = 3;
|
||||
repeated EnumDescriptorProto enum_type = 4;
|
||||
|
||||
message ExtensionRange {
|
||||
optional int32 start = 1;
|
||||
optional int32 end = 2;
|
||||
}
|
||||
repeated ExtensionRange extension_range = 5;
|
||||
|
||||
repeated OneofDescriptorProto oneof_decl = 8;
|
||||
|
||||
optional MessageOptions options = 7;
|
||||
|
||||
// Range of reserved tag numbers. Reserved tag numbers may not be used by
|
||||
// fields or extension ranges in the same message. Reserved ranges may
|
||||
// not overlap.
|
||||
message ReservedRange {
|
||||
optional int32 start = 1; // Inclusive.
|
||||
optional int32 end = 2; // Exclusive.
|
||||
}
|
||||
repeated ReservedRange reserved_range = 9;
|
||||
// Reserved field names, which may not be used by fields in the same message.
|
||||
// A given name may only be reserved once.
|
||||
repeated string reserved_name = 10;
|
||||
}
|
||||
|
||||
// Describes a field within a message.
|
||||
message FieldDescriptorProto {
|
||||
enum Type {
|
||||
// 0 is reserved for errors.
|
||||
// Order is weird for historical reasons.
|
||||
TYPE_DOUBLE = 1;
|
||||
TYPE_FLOAT = 2;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||
// negative values are likely.
|
||||
TYPE_INT64 = 3;
|
||||
TYPE_UINT64 = 4;
|
||||
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||
// negative values are likely.
|
||||
TYPE_INT32 = 5;
|
||||
TYPE_FIXED64 = 6;
|
||||
TYPE_FIXED32 = 7;
|
||||
TYPE_BOOL = 8;
|
||||
TYPE_STRING = 9;
|
||||
TYPE_GROUP = 10; // Tag-delimited aggregate.
|
||||
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||
|
||||
// New in version 2.
|
||||
TYPE_BYTES = 12;
|
||||
TYPE_UINT32 = 13;
|
||||
TYPE_ENUM = 14;
|
||||
TYPE_SFIXED32 = 15;
|
||||
TYPE_SFIXED64 = 16;
|
||||
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||
};
|
||||
|
||||
enum Label {
|
||||
// 0 is reserved for errors
|
||||
LABEL_OPTIONAL = 1;
|
||||
LABEL_REQUIRED = 2;
|
||||
LABEL_REPEATED = 3;
|
||||
};
|
||||
|
||||
optional string name = 1;
|
||||
optional int32 number = 3;
|
||||
optional Label label = 4;
|
||||
|
||||
// If type_name is set, this need not be set. If both this and type_name
|
||||
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
|
||||
optional Type type = 5;
|
||||
|
||||
// For message and enum types, this is the name of the type. If the name
|
||||
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
||||
// rules are used to find the type (i.e. first the nested types within this
|
||||
// message are searched, then within the parent, on up to the root
|
||||
// namespace).
|
||||
optional string type_name = 6;
|
||||
|
||||
// For extensions, this is the name of the type being extended. It is
|
||||
// resolved in the same manner as type_name.
|
||||
optional string extendee = 2;
|
||||
|
||||
// For numeric types, contains the original text representation of the value.
|
||||
// For booleans, "true" or "false".
|
||||
// For strings, contains the default text contents (not escaped in any way).
|
||||
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
||||
// TODO(kenton): Base-64 encode?
|
||||
optional string default_value = 7;
|
||||
|
||||
// If set, gives the index of a oneof in the containing type's oneof_decl
|
||||
// list. This field is a member of that oneof.
|
||||
optional int32 oneof_index = 9;
|
||||
|
||||
// JSON name of this field. The value is set by protocol compiler. If the
|
||||
// user has set a "json_name" option on this field, that option's value
|
||||
// will be used. Otherwise, it's deduced from the field's name by converting
|
||||
// it to camelCase.
|
||||
optional string json_name = 10;
|
||||
|
||||
optional FieldOptions options = 8;
|
||||
}
|
||||
|
||||
// Describes a oneof.
|
||||
message OneofDescriptorProto {
|
||||
optional string name = 1;
|
||||
optional OneofOptions options = 2;
|
||||
}
|
||||
|
||||
// Describes an enum type.
|
||||
message EnumDescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
repeated EnumValueDescriptorProto value = 2;
|
||||
|
||||
optional EnumOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a value within an enum.
|
||||
message EnumValueDescriptorProto {
|
||||
optional string name = 1;
|
||||
optional int32 number = 2;
|
||||
|
||||
optional EnumValueOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a service.
|
||||
message ServiceDescriptorProto {
|
||||
optional string name = 1;
|
||||
repeated MethodDescriptorProto method = 2;
|
||||
|
||||
optional ServiceOptions options = 3;
|
||||
}
|
||||
|
||||
// Describes a method of a service.
|
||||
message MethodDescriptorProto {
|
||||
optional string name = 1;
|
||||
|
||||
// Input and output type names. These are resolved in the same way as
|
||||
// FieldDescriptorProto.type_name, but must refer to a message type.
|
||||
optional string input_type = 2;
|
||||
optional string output_type = 3;
|
||||
|
||||
optional MethodOptions options = 4;
|
||||
|
||||
// Identifies if client streams multiple client messages
|
||||
optional bool client_streaming = 5 [default=false];
|
||||
// Identifies if server streams multiple server messages
|
||||
optional bool server_streaming = 6 [default=false];
|
||||
}
|
||||
|
||||
|
||||
// ===================================================================
|
||||
// Options
|
||||
|
||||
// Each of the definitions above may have "options" attached. These are
|
||||
// just annotations which may cause code to be generated slightly differently
|
||||
// or may contain hints for code that manipulates protocol messages.
|
||||
//
|
||||
// Clients may define custom options as extensions of the *Options messages.
|
||||
// These extensions may not yet be known at parsing time, so the parser cannot
|
||||
// store the values in them. Instead it stores them in a field in the *Options
|
||||
// message called uninterpreted_option. This field must have the same name
|
||||
// across all *Options messages. We then use this field to populate the
|
||||
// extensions when we build a descriptor, at which point all protos have been
|
||||
// parsed and so all extensions are known.
|
||||
//
|
||||
// Extension numbers for custom options may be chosen as follows:
|
||||
// * For options which will only be used within a single application or
|
||||
// organization, or for experimental options, use field numbers 50000
|
||||
// through 99999. It is up to you to ensure that you do not use the
|
||||
// same number for multiple options.
|
||||
// * For options which will be published and used publicly by multiple
|
||||
// independent entities, e-mail [email protected]
|
||||
// to reserve extension numbers. Simply provide your project name (e.g.
|
||||
// Objective-C plugin) and your project website (if available) -- there's no
|
||||
// need to explain how you intend to use them. Usually you only need one
|
||||
// extension number. You can declare multiple options with only one extension
|
||||
// number by putting them in a sub-message. See the Custom Options section of
|
||||
// the docs for examples:
|
||||
// https://developers.google.com/protocol-buffers/docs/proto#options
|
||||
// If this turns out to be popular, a web service will be set up
|
||||
// to automatically assign option numbers.
|
||||
|
||||
|
||||
message FileOptions {
|
||||
|
||||
// Sets the Java package where classes generated from this .proto will be
|
||||
// placed. By default, the proto package is used, but this is often
|
||||
// inappropriate because proto packages do not normally start with backwards
|
||||
// domain names.
|
||||
optional string java_package = 1;
|
||||
|
||||
|
||||
// If set, all the classes from the .proto file are wrapped in a single
|
||||
// outer class with the given name. This applies to both Proto1
|
||||
// (equivalent to the old "--one_java_file" option) and Proto2 (where
|
||||
// a .proto always translates to a single class, but you may want to
|
||||
// explicitly choose the class name).
|
||||
optional string java_outer_classname = 8;
|
||||
|
||||
// If set true, then the Java code generator will generate a separate .java
|
||||
// file for each top-level message, enum, and service defined in the .proto
|
||||
// file. Thus, these types will *not* be nested inside the outer class
|
||||
// named by java_outer_classname. However, the outer class will still be
|
||||
// generated to contain the file's getDescriptor() method as well as any
|
||||
// top-level extensions defined in the file.
|
||||
optional bool java_multiple_files = 10 [default=false];
|
||||
|
||||
// This option does nothing.
|
||||
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
|
||||
|
||||
// If set true, then the Java2 code generator will generate code that
|
||||
// throws an exception whenever an attempt is made to assign a non-UTF-8
|
||||
// byte sequence to a string field.
|
||||
// Message reflection will do the same.
|
||||
// However, an extension field still accepts non-UTF-8 byte sequences.
|
||||
// This option has no effect on when used with the lite runtime.
|
||||
optional bool java_string_check_utf8 = 27 [default=false];
|
||||
|
||||
|
||||
// Generated classes can be optimized for speed or code size.
|
||||
enum OptimizeMode {
|
||||
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||
// etc.
|
||||
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||
}
|
||||
optional OptimizeMode optimize_for = 9 [default=SPEED];
|
||||
|
||||
// Sets the Go package where structs generated from this .proto will be
|
||||
// placed. If omitted, the Go package will be derived from the following:
|
||||
// - The basename of the package import path, if provided.
|
||||
// - Otherwise, the package statement in the .proto file, if present.
|
||||
// - Otherwise, the basename of the .proto file, without extension.
|
||||
optional string go_package = 11;
|
||||
|
||||
|
||||
|
||||
// Should generic services be generated in each language? "Generic" services
|
||||
// are not specific to any particular RPC system. They are generated by the
|
||||
// main code generators in each language (without additional plugins).
|
||||
// Generic services were the only kind of service generation supported by
|
||||
// early versions of google.protobuf.
|
||||
//
|
||||
// Generic services are now considered deprecated in favor of using plugins
|
||||
// that generate code specific to your particular RPC system. Therefore,
|
||||
// these default to false. Old code which depends on generic services should
|
||||
// explicitly set them to true.
|
||||
optional bool cc_generic_services = 16 [default=false];
|
||||
optional bool java_generic_services = 17 [default=false];
|
||||
optional bool py_generic_services = 18 [default=false];
|
||||
|
||||
// Is this file deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for everything in the file, or it will be completely ignored; in the very
|
||||
// least, this is a formalization for deprecating files.
|
||||
optional bool deprecated = 23 [default=false];
|
||||
|
||||
// Enables the use of arenas for the proto messages in this file. This applies
|
||||
// only to generated classes for C++.
|
||||
optional bool cc_enable_arenas = 31 [default=false];
|
||||
|
||||
|
||||
// Sets the objective c class prefix which is prepended to all objective c
|
||||
// generated classes from this .proto. There is no default.
|
||||
optional string objc_class_prefix = 36;
|
||||
|
||||
// Namespace for generated classes; defaults to the package.
|
||||
optional string csharp_namespace = 37;
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
|
||||
reserved 38;
|
||||
}
|
||||
|
||||
message MessageOptions {
|
||||
// Set true to use the old proto1 MessageSet wire format for extensions.
|
||||
// This is provided for backwards-compatibility with the MessageSet wire
|
||||
// format. You should not use this for any other reason: It's less
|
||||
// efficient, has fewer features, and is more complicated.
|
||||
//
|
||||
// The message must be defined exactly as follows:
|
||||
// message Foo {
|
||||
// option message_set_wire_format = true;
|
||||
// extensions 4 to max;
|
||||
// }
|
||||
// Note that the message cannot have any defined fields; MessageSets only
|
||||
// have extensions.
|
||||
//
|
||||
// All extensions of your type must be singular messages; e.g. they cannot
|
||||
// be int32s, enums, or repeated messages.
|
||||
//
|
||||
// Because this is an option, the above two restrictions are not enforced by
|
||||
// the protocol compiler.
|
||||
optional bool message_set_wire_format = 1 [default=false];
|
||||
|
||||
// Disables the generation of the standard "descriptor()" accessor, which can
|
||||
// conflict with a field of the same name. This is meant to make migration
|
||||
// from proto1 easier; new code should avoid fields named "descriptor".
|
||||
optional bool no_standard_descriptor_accessor = 2 [default=false];
|
||||
|
||||
// Is this message deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the message, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating messages.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
|
||||
// Whether the message is an automatically generated map entry type for the
|
||||
// maps field.
|
||||
//
|
||||
// For maps fields:
|
||||
// map<KeyType, ValueType> map_field = 1;
|
||||
// The parsed descriptor looks like:
|
||||
// message MapFieldEntry {
|
||||
// option map_entry = true;
|
||||
// optional KeyType key = 1;
|
||||
// optional ValueType value = 2;
|
||||
// }
|
||||
// repeated MapFieldEntry map_field = 1;
|
||||
//
|
||||
// Implementations may choose not to generate the map_entry=true message, but
|
||||
// use a native map in the target language to hold the keys and values.
|
||||
// The reflection APIs in such implementions still need to work as
|
||||
// if the field is a repeated message field.
|
||||
//
|
||||
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||
// instead. The option should only be implicitly set by the proto compiler
|
||||
// parser.
|
||||
optional bool map_entry = 7;
|
||||
|
||||
reserved 8; // javalite_serializable
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message FieldOptions {
|
||||
// The ctype option instructs the C++ code generator to use a different
|
||||
// representation of the field than it normally would. See the specific
|
||||
// options below. This option is not yet implemented in the open source
|
||||
// release -- sorry, we'll try to include it in a future version!
|
||||
optional CType ctype = 1 [default = STRING];
|
||||
enum CType {
|
||||
// Default mode.
|
||||
STRING = 0;
|
||||
|
||||
CORD = 1;
|
||||
|
||||
STRING_PIECE = 2;
|
||||
}
|
||||
// The packed option can be enabled for repeated primitive fields to enable
|
||||
// a more efficient representation on the wire. Rather than repeatedly
|
||||
// writing the tag and type for each element, the entire array is encoded as
|
||||
// a single length-delimited blob. In proto3, only explicit setting it to
|
||||
// false will avoid using packed encoding.
|
||||
optional bool packed = 2;
|
||||
|
||||
// The jstype option determines the JavaScript type used for values of the
|
||||
// field. The option is permitted only for 64 bit integral and fixed types
|
||||
// (int64, uint64, sint64, fixed64, sfixed64). By default these types are
|
||||
// represented as JavaScript strings. This avoids loss of precision that can
|
||||
// happen when a large value is converted to a floating point JavaScript
|
||||
// numbers. Specifying JS_NUMBER for the jstype causes the generated
|
||||
// JavaScript code to use the JavaScript "number" type instead of strings.
|
||||
// This option is an enum to permit additional types to be added,
|
||||
// e.g. goog.math.Integer.
|
||||
optional JSType jstype = 6 [default = JS_NORMAL];
|
||||
enum JSType {
|
||||
// Use the default type.
|
||||
JS_NORMAL = 0;
|
||||
|
||||
// Use JavaScript strings.
|
||||
JS_STRING = 1;
|
||||
|
||||
// Use JavaScript numbers.
|
||||
JS_NUMBER = 2;
|
||||
}
|
||||
|
||||
// Should this field be parsed lazily? Lazy applies only to message-type
|
||||
// fields. It means that when the outer message is initially parsed, the
|
||||
// inner message's contents will not be parsed but instead stored in encoded
|
||||
// form. The inner message will actually be parsed when it is first accessed.
|
||||
//
|
||||
// This is only a hint. Implementations are free to choose whether to use
|
||||
// eager or lazy parsing regardless of the value of this option. However,
|
||||
// setting this option true suggests that the protocol author believes that
|
||||
// using lazy parsing on this field is worth the additional bookkeeping
|
||||
// overhead typically needed to implement it.
|
||||
//
|
||||
// This option does not affect the public interface of any generated code;
|
||||
// all method signatures remain the same. Furthermore, thread-safety of the
|
||||
// interface is not affected by this option; const methods remain safe to
|
||||
// call from multiple threads concurrently, while non-const methods continue
|
||||
// to require exclusive access.
|
||||
//
|
||||
//
|
||||
// Note that implementations may choose not to check required fields within
|
||||
// a lazy sub-message. That is, calling IsInitialized() on the outer message
|
||||
// may return true even if the inner message has missing required fields.
|
||||
// This is necessary because otherwise the inner message would have to be
|
||||
// parsed in order to perform the check, defeating the purpose of lazy
|
||||
// parsing. An implementation which chooses not to check required fields
|
||||
// must be consistent about it. That is, for any particular sub-message, the
|
||||
// implementation must either *always* check its required fields, or *never*
|
||||
// check its required fields, regardless of whether or not the message has
|
||||
// been parsed.
|
||||
optional bool lazy = 5 [default=false];
|
||||
|
||||
// Is this field deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for accessors, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating fields.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
|
||||
// For Google-internal migration only. Do not use.
|
||||
optional bool weak = 10 [default=false];
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
|
||||
reserved 4; // removed jtype
|
||||
}
|
||||
|
||||
message OneofOptions {
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message EnumOptions {
|
||||
|
||||
// Set this option to true to allow mapping different tag names to the same
|
||||
// value.
|
||||
optional bool allow_alias = 2;
|
||||
|
||||
// Is this enum deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum, or it will be completely ignored; in the very least, this
|
||||
// is a formalization for deprecating enums.
|
||||
optional bool deprecated = 3 [default=false];
|
||||
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message EnumValueOptions {
|
||||
// Is this enum value deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the enum value, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating enum values.
|
||||
optional bool deprecated = 1 [default=false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message ServiceOptions {
|
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||
// we were already using them long before we decided to release Protocol
|
||||
// Buffers.
|
||||
|
||||
// Is this service deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the service, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating services.
|
||||
optional bool deprecated = 33 [default=false];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
message MethodOptions {
|
||||
|
||||
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||
// we were already using them long before we decided to release Protocol
|
||||
// Buffers.
|
||||
|
||||
// Is this method deprecated?
|
||||
// Depending on the target platform, this can emit Deprecated annotations
|
||||
// for the method, or it will be completely ignored; in the very least,
|
||||
// this is a formalization for deprecating methods.
|
||||
optional bool deprecated = 33 [default=false];
|
||||
|
||||
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
||||
// or neither? HTTP based RPC implementation may choose GET verb for safe
|
||||
// methods, and PUT verb for idempotent methods instead of the default POST.
|
||||
enum IdempotencyLevel {
|
||||
IDEMPOTENCY_UNKNOWN = 0;
|
||||
NO_SIDE_EFFECTS = 1; // implies idempotent
|
||||
IDEMPOTENT = 2; // idempotent, but may have side effects
|
||||
}
|
||||
optional IdempotencyLevel idempotency_level =
|
||||
34 [default=IDEMPOTENCY_UNKNOWN];
|
||||
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
repeated UninterpretedOption uninterpreted_option = 999;
|
||||
|
||||
// Clients can define custom options in extensions of this message. See above.
|
||||
extensions 1000 to max;
|
||||
}
|
||||
|
||||
|
||||
// A message representing a option the parser does not recognize. This only
|
||||
// appears in options protos created by the compiler::Parser class.
|
||||
// DescriptorPool resolves these when building Descriptor objects. Therefore,
|
||||
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
||||
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
||||
// in them.
|
||||
message UninterpretedOption {
|
||||
// The name of the uninterpreted option. Each string represents a segment in
|
||||
// a dot-separated name. is_extension is true iff a segment represents an
|
||||
// extension (denoted with parentheses in options specs in .proto files).
|
||||
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
|
||||
// "foo.(bar.baz).qux".
|
||||
message NamePart {
|
||||
required string name_part = 1;
|
||||
required bool is_extension = 2;
|
||||
}
|
||||
repeated NamePart name = 2;
|
||||
|
||||
// The value of the uninterpreted option, in whatever type the tokenizer
|
||||
// identified it as during parsing. Exactly one of these should be set.
|
||||
optional string identifier_value = 3;
|
||||
optional uint64 positive_int_value = 4;
|
||||
optional int64 negative_int_value = 5;
|
||||
optional double double_value = 6;
|
||||
optional bytes string_value = 7;
|
||||
optional string aggregate_value = 8;
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// Optional source code info
|
||||
|
||||
// Encapsulates information about the original source file from which a
|
||||
// FileDescriptorProto was generated.
|
||||
message SourceCodeInfo {
|
||||
// A Location identifies a piece of source code in a .proto file which
|
||||
// corresponds to a particular definition. This information is intended
|
||||
// to be useful to IDEs, code indexers, documentation generators, and similar
|
||||
// tools.
|
||||
//
|
||||
// For example, say we have a file like:
|
||||
// message Foo {
|
||||
// optional string foo = 1;
|
||||
// }
|
||||
// Let's look at just the field definition:
|
||||
// optional string foo = 1;
|
||||
// ^ ^^ ^^ ^ ^^^
|
||||
// a bc de f ghi
|
||||
// We have the following locations:
|
||||
// span path represents
|
||||
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
||||
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
||||
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
||||
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
||||
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
||||
//
|
||||
// Notes:
|
||||
// - A location may refer to a repeated field itself (i.e. not to any
|
||||
// particular index within it). This is used whenever a set of elements are
|
||||
// logically enclosed in a single code segment. For example, an entire
|
||||
// extend block (possibly containing multiple extension definitions) will
|
||||
// have an outer location whose path refers to the "extensions" repeated
|
||||
// field without an index.
|
||||
// - Multiple locations may have the same path. This happens when a single
|
||||
// logical declaration is spread out across multiple places. The most
|
||||
// obvious example is the "extend" block again -- there may be multiple
|
||||
// extend blocks in the same scope, each of which will have the same path.
|
||||
// - A location's span is not always a subset of its parent's span. For
|
||||
// example, the "extendee" of an extension declaration appears at the
|
||||
// beginning of the "extend" block and is shared by all extensions within
|
||||
// the block.
|
||||
// - Just because a location's span is a subset of some other location's span
|
||||
// does not mean that it is a descendent. For example, a "group" defines
|
||||
// both a type and a field in a single declaration. Thus, the locations
|
||||
// corresponding to the type and field and their components will overlap.
|
||||
// - Code which tries to interpret locations should probably be designed to
|
||||
// ignore those that it doesn't understand, as more types of locations could
|
||||
// be recorded in the future.
|
||||
repeated Location location = 1;
|
||||
message Location {
|
||||
// Identifies which part of the FileDescriptorProto was defined at this
|
||||
// location.
|
||||
//
|
||||
// Each element is a field number or an index. They form a path from
|
||||
// the root FileDescriptorProto to the place where the definition. For
|
||||
// example, this path:
|
||||
// [ 4, 3, 2, 7, 1 ]
|
||||
// refers to:
|
||||
// file.message_type(3) // 4, 3
|
||||
// .field(7) // 2, 7
|
||||
// .name() // 1
|
||||
// This is because FileDescriptorProto.message_type has field number 4:
|
||||
// repeated DescriptorProto message_type = 4;
|
||||
// and DescriptorProto.field has field number 2:
|
||||
// repeated FieldDescriptorProto field = 2;
|
||||
// and FieldDescriptorProto.name has field number 1:
|
||||
// optional string name = 1;
|
||||
//
|
||||
// Thus, the above path gives the location of a field name. If we removed
|
||||
// the last element:
|
||||
// [ 4, 3, 2, 7 ]
|
||||
// this path refers to the whole field declaration (from the beginning
|
||||
// of the label to the terminating semicolon).
|
||||
repeated int32 path = 1 [packed=true];
|
||||
|
||||
// Always has exactly three or four elements: start line, start column,
|
||||
// end line (optional, otherwise assumed same as start line), end column.
|
||||
// These are packed into a single field for efficiency. Note that line
|
||||
// and column numbers are zero-based -- typically you will want to add
|
||||
// 1 to each before displaying to a user.
|
||||
repeated int32 span = 2 [packed=true];
|
||||
|
||||
// If this SourceCodeInfo represents a complete declaration, these are any
|
||||
// comments appearing before and after the declaration which appear to be
|
||||
// attached to the declaration.
|
||||
//
|
||||
// A series of line comments appearing on consecutive lines, with no other
|
||||
// tokens appearing on those lines, will be treated as a single comment.
|
||||
//
|
||||
// leading_detached_comments will keep paragraphs of comments that appear
|
||||
// before (but not connected to) the current element. Each paragraph,
|
||||
// separated by empty lines, will be one comment element in the repeated
|
||||
// field.
|
||||
//
|
||||
// Only the comment content is provided; comment markers (e.g. //) are
|
||||
// stripped out. For block comments, leading whitespace and an asterisk
|
||||
// will be stripped from the beginning of each line other than the first.
|
||||
// Newlines are included in the output.
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// optional int32 foo = 1; // Comment attached to foo.
|
||||
// // Comment attached to bar.
|
||||
// optional int32 bar = 2;
|
||||
//
|
||||
// optional string baz = 3;
|
||||
// // Comment attached to baz.
|
||||
// // Another line attached to baz.
|
||||
//
|
||||
// // Comment attached to qux.
|
||||
// //
|
||||
// // Another line attached to qux.
|
||||
// optional double qux = 4;
|
||||
//
|
||||
// // Detached comment for corge. This is not leading or trailing comments
|
||||
// // to qux or corge because there are blank lines separating it from
|
||||
// // both.
|
||||
//
|
||||
// // Detached comment for corge paragraph 2.
|
||||
//
|
||||
// optional string corge = 5;
|
||||
// /* Block comment attached
|
||||
// * to corge. Leading asterisks
|
||||
// * will be removed. */
|
||||
// /* Block comment attached to
|
||||
// * grault. */
|
||||
// optional int32 grault = 6;
|
||||
//
|
||||
// // ignored detached comments.
|
||||
optional string leading_comments = 3;
|
||||
optional string trailing_comments = 4;
|
||||
repeated string leading_detached_comments = 6;
|
||||
}
|
||||
}
|
||||
|
||||
// Describes the relationship between generated code and its original source
|
||||
// file. A GeneratedCodeInfo message is associated with only one generated
|
||||
// source file, but may contain references to different source .proto files.
|
||||
message GeneratedCodeInfo {
|
||||
// An Annotation connects some span of text in generated code to an element
|
||||
// of its generating .proto file.
|
||||
repeated Annotation annotation = 1;
|
||||
message Annotation {
|
||||
// Identifies the element in the original source .proto file. This field
|
||||
// is formatted the same as SourceCodeInfo.Location.path.
|
||||
repeated int32 path = 1 [packed=true];
|
||||
|
||||
// Identifies the filesystem path to the original source .proto.
|
||||
optional string source_file = 2;
|
||||
|
||||
// Identifies the starting offset in bytes in the generated code
|
||||
// that relates to the identified object.
|
||||
optional int32 begin = 3;
|
||||
|
||||
// Identifies the ending offset in bytes in the generated code that
|
||||
// relates to the identified offset. The end offset should be one past
|
||||
// the last relevant byte (so the length of the text = end - begin).
|
||||
optional int32 end = 4;
|
||||
}
|
||||
}
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"nested": {
|
||||
"Test": {
|
||||
"fields": {
|
||||
+1
@@ -0,0 +1 @@
|
||||
message Test {
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
message Meta {
|
||||
extensions 10 to 20;
|
||||
}
|
||||
|
||||
extend Meta {
|
||||
required string workflow_id = 10;
|
||||
required string task_id = 11;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2016, Mapbox
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of pbf nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
BIN
Binary file not shown.
+113
@@ -0,0 +1,113 @@
|
||||
import * as $protobuf from "../../..";
|
||||
export namespace vector_tile {
|
||||
|
||||
interface ITile {
|
||||
layers?: (vector_tile.Tile.ILayer[]|null);
|
||||
}
|
||||
|
||||
class Tile implements ITile {
|
||||
constructor(properties?: vector_tile.ITile);
|
||||
public layers: vector_tile.Tile.ILayer[];
|
||||
public static create(properties?: vector_tile.ITile): vector_tile.Tile;
|
||||
public static encode(message: vector_tile.ITile, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: vector_tile.ITile, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vector_tile.Tile;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vector_tile.Tile;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): vector_tile.Tile;
|
||||
public static toObject(message: vector_tile.Tile, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
namespace Tile {
|
||||
|
||||
enum GeomType {
|
||||
UNKNOWN = 0,
|
||||
POINT = 1,
|
||||
LINESTRING = 2,
|
||||
POLYGON = 3
|
||||
}
|
||||
|
||||
interface IValue {
|
||||
stringValue?: (string|null);
|
||||
floatValue?: (number|null);
|
||||
doubleValue?: (number|null);
|
||||
intValue?: (number|Long|null);
|
||||
uintValue?: (number|Long|null);
|
||||
sintValue?: (number|Long|null);
|
||||
boolValue?: (boolean|null);
|
||||
}
|
||||
|
||||
class Value implements IValue {
|
||||
constructor(properties?: vector_tile.Tile.IValue);
|
||||
public stringValue: string;
|
||||
public floatValue: number;
|
||||
public doubleValue: number;
|
||||
public intValue: (number|Long);
|
||||
public uintValue: (number|Long);
|
||||
public sintValue: (number|Long);
|
||||
public boolValue: boolean;
|
||||
public static create(properties?: vector_tile.Tile.IValue): vector_tile.Tile.Value;
|
||||
public static encode(message: vector_tile.Tile.IValue, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: vector_tile.Tile.IValue, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vector_tile.Tile.Value;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vector_tile.Tile.Value;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): vector_tile.Tile.Value;
|
||||
public static toObject(message: vector_tile.Tile.Value, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
interface IFeature {
|
||||
id?: (number|Long|null);
|
||||
tags?: (number[]|null);
|
||||
type?: (vector_tile.Tile.GeomType|null);
|
||||
geometry?: (number[]|null);
|
||||
}
|
||||
|
||||
class Feature implements IFeature {
|
||||
constructor(properties?: vector_tile.Tile.IFeature);
|
||||
public id: (number|Long);
|
||||
public tags: number[];
|
||||
public type: vector_tile.Tile.GeomType;
|
||||
public geometry: number[];
|
||||
public static create(properties?: vector_tile.Tile.IFeature): vector_tile.Tile.Feature;
|
||||
public static encode(message: vector_tile.Tile.IFeature, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: vector_tile.Tile.IFeature, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vector_tile.Tile.Feature;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vector_tile.Tile.Feature;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): vector_tile.Tile.Feature;
|
||||
public static toObject(message: vector_tile.Tile.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
interface ILayer {
|
||||
version: number;
|
||||
name: string;
|
||||
features?: (vector_tile.Tile.IFeature[]|null);
|
||||
keys?: (string[]|null);
|
||||
values?: (vector_tile.Tile.IValue[]|null);
|
||||
extent?: (number|null);
|
||||
}
|
||||
|
||||
class Layer implements ILayer {
|
||||
constructor(properties?: vector_tile.Tile.ILayer);
|
||||
public version: number;
|
||||
public name: string;
|
||||
public features: vector_tile.Tile.IFeature[];
|
||||
public keys: string[];
|
||||
public values: vector_tile.Tile.IValue[];
|
||||
public extent: number;
|
||||
public static create(properties?: vector_tile.Tile.ILayer): vector_tile.Tile.Layer;
|
||||
public static encode(message: vector_tile.Tile.ILayer, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: vector_tile.Tile.ILayer, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vector_tile.Tile.Layer;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vector_tile.Tile.Layer;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): vector_tile.Tile.Layer;
|
||||
public static toObject(message: vector_tile.Tile.Layer, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
}
|
||||
}
|
||||
+1311
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package vector_tile;
|
||||
|
||||
message Tile {
|
||||
|
||||
enum GeomType {
|
||||
|
||||
UNKNOWN = 0;
|
||||
POINT = 1;
|
||||
LINESTRING = 2;
|
||||
POLYGON = 3;
|
||||
}
|
||||
|
||||
message Value {
|
||||
|
||||
optional string string_value = 1;
|
||||
optional float float_value = 2;
|
||||
optional double double_value = 3;
|
||||
optional int64 int_value = 4;
|
||||
optional uint64 uint_value = 5;
|
||||
optional sint64 sint_value = 6;
|
||||
optional bool bool_value = 7;
|
||||
extensions 8 to max;
|
||||
}
|
||||
|
||||
message Feature {
|
||||
|
||||
optional uint64 id = 1 [ default = 0 ];
|
||||
repeated uint32 tags = 2 [ packed = true ];
|
||||
optional GeomType type = 3 [ default = UNKNOWN ];
|
||||
repeated uint32 geometry = 4 [ packed = true ];
|
||||
}
|
||||
|
||||
message Layer {
|
||||
|
||||
required uint32 version = 15 [ default = 1 ];
|
||||
required string name = 1;
|
||||
repeated Feature features = 2;
|
||||
repeated string keys = 3;
|
||||
repeated Value values = 4;
|
||||
optional uint32 extent = 5 [ default = 4096 ];
|
||||
extensions 16 to max;
|
||||
}
|
||||
|
||||
repeated Layer layers = 3;
|
||||
|
||||
extensions 16 to 8191;
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
import * as $protobuf from "../..";
|
||||
export interface IPackage {
|
||||
name?: (string|null);
|
||||
version?: (string|null);
|
||||
versionScheme?: (string|null);
|
||||
description?: (string|null);
|
||||
author?: (string|null);
|
||||
license?: (string|null);
|
||||
repository?: (Package.IRepository|null);
|
||||
bugs?: (string|null);
|
||||
homepage?: (string|null);
|
||||
keywords?: (string[]|null);
|
||||
main?: (string|null);
|
||||
bin?: ({ [k: string]: string }|null);
|
||||
scripts?: ({ [k: string]: string }|null);
|
||||
dependencies?: ({ [k: string]: string }|null);
|
||||
devDependencies?: ({ [k: string]: string }|null);
|
||||
types?: (string|null);
|
||||
cliDependencies?: (string[]|null);
|
||||
}
|
||||
|
||||
export class Package implements IPackage {
|
||||
constructor(properties?: IPackage);
|
||||
public name: string;
|
||||
public version: string;
|
||||
public versionScheme: string;
|
||||
public description: string;
|
||||
public author: string;
|
||||
public license: string;
|
||||
public repository?: (Package.IRepository|null);
|
||||
public bugs: string;
|
||||
public homepage: string;
|
||||
public keywords: string[];
|
||||
public main: string;
|
||||
public bin: { [k: string]: string };
|
||||
public scripts: { [k: string]: string };
|
||||
public dependencies: { [k: string]: string };
|
||||
public devDependencies: { [k: string]: string };
|
||||
public types: string;
|
||||
public cliDependencies: string[];
|
||||
public static create(properties?: IPackage): Package;
|
||||
public static encode(message: IPackage, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IPackage, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Package;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Package;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): Package;
|
||||
public static toObject(message: Package, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export namespace Package {
|
||||
|
||||
interface IRepository {
|
||||
type?: (string|null);
|
||||
url?: (string|null);
|
||||
}
|
||||
|
||||
class Repository implements IRepository {
|
||||
constructor(properties?: Package.IRepository);
|
||||
public type: string;
|
||||
public url: string;
|
||||
public static create(properties?: Package.IRepository): Package.Repository;
|
||||
public static encode(message: Package.IRepository, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: Package.IRepository, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): Package.Repository;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): Package.Repository;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): Package.Repository;
|
||||
public static toObject(message: Package.Repository, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
}
|
||||
Executable
+884
@@ -0,0 +1,884 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
"use strict";
|
||||
|
||||
var $protobuf = require("../../minimal");
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
var $root = $protobuf.roots.test_package || ($protobuf.roots.test_package = {});
|
||||
|
||||
$root.Package = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Package.
|
||||
* @exports IPackage
|
||||
* @interface IPackage
|
||||
* @property {string|null} [name] Package name
|
||||
* @property {string|null} [version] Package version
|
||||
* @property {string|null} [versionScheme] Package versionScheme
|
||||
* @property {string|null} [description] Package description
|
||||
* @property {string|null} [author] Package author
|
||||
* @property {string|null} [license] Package license
|
||||
* @property {Package.IRepository|null} [repository] Package repository
|
||||
* @property {string|null} [bugs] Package bugs
|
||||
* @property {string|null} [homepage] Package homepage
|
||||
* @property {Array.<string>|null} [keywords] Package keywords
|
||||
* @property {string|null} [main] Package main
|
||||
* @property {Object.<string,string>|null} [bin] Package bin
|
||||
* @property {Object.<string,string>|null} [scripts] Package scripts
|
||||
* @property {Object.<string,string>|null} [dependencies] Package dependencies
|
||||
* @property {Object.<string,string>|null} [devDependencies] Package devDependencies
|
||||
* @property {string|null} [types] Package types
|
||||
* @property {Array.<string>|null} [cliDependencies] Package cliDependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Package.
|
||||
* @exports Package
|
||||
* @classdesc Represents a Package.
|
||||
* @implements IPackage
|
||||
* @constructor
|
||||
* @param {IPackage=} [properties] Properties to set
|
||||
*/
|
||||
function Package(properties) {
|
||||
this.keywords = [];
|
||||
this.bin = {};
|
||||
this.scripts = {};
|
||||
this.dependencies = {};
|
||||
this.devDependencies = {};
|
||||
this.cliDependencies = [];
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Package name.
|
||||
* @member {string} name
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.name = "";
|
||||
|
||||
/**
|
||||
* Package version.
|
||||
* @member {string} version
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.version = "";
|
||||
|
||||
/**
|
||||
* Package versionScheme.
|
||||
* @member {string} versionScheme
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.versionScheme = "";
|
||||
|
||||
/**
|
||||
* Package description.
|
||||
* @member {string} description
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.description = "";
|
||||
|
||||
/**
|
||||
* Package author.
|
||||
* @member {string} author
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.author = "";
|
||||
|
||||
/**
|
||||
* Package license.
|
||||
* @member {string} license
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.license = "";
|
||||
|
||||
/**
|
||||
* Package repository.
|
||||
* @member {Package.IRepository|null|undefined} repository
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.repository = null;
|
||||
|
||||
/**
|
||||
* Package bugs.
|
||||
* @member {string} bugs
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.bugs = "";
|
||||
|
||||
/**
|
||||
* Package homepage.
|
||||
* @member {string} homepage
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.homepage = "";
|
||||
|
||||
/**
|
||||
* Package keywords.
|
||||
* @member {Array.<string>} keywords
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.keywords = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Package main.
|
||||
* @member {string} main
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.main = "";
|
||||
|
||||
/**
|
||||
* Package bin.
|
||||
* @member {Object.<string,string>} bin
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.bin = $util.emptyObject;
|
||||
|
||||
/**
|
||||
* Package scripts.
|
||||
* @member {Object.<string,string>} scripts
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.scripts = $util.emptyObject;
|
||||
|
||||
/**
|
||||
* Package dependencies.
|
||||
* @member {Object.<string,string>} dependencies
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.dependencies = $util.emptyObject;
|
||||
|
||||
/**
|
||||
* Package devDependencies.
|
||||
* @member {Object.<string,string>} devDependencies
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.devDependencies = $util.emptyObject;
|
||||
|
||||
/**
|
||||
* Package types.
|
||||
* @member {string} types
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.types = "";
|
||||
|
||||
/**
|
||||
* Package cliDependencies.
|
||||
* @member {Array.<string>} cliDependencies
|
||||
* @memberof Package
|
||||
* @instance
|
||||
*/
|
||||
Package.prototype.cliDependencies = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Creates a new Package instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {IPackage=} [properties] Properties to set
|
||||
* @returns {Package} Package instance
|
||||
*/
|
||||
Package.create = function create(properties) {
|
||||
return new Package(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Package message. Does not implicitly {@link Package.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {IPackage} message Package message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Package.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.name != null && message.hasOwnProperty("name"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
|
||||
if (message.version != null && message.hasOwnProperty("version"))
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.version);
|
||||
if (message.description != null && message.hasOwnProperty("description"))
|
||||
writer.uint32(/* id 3, wireType 2 =*/26).string(message.description);
|
||||
if (message.author != null && message.hasOwnProperty("author"))
|
||||
writer.uint32(/* id 4, wireType 2 =*/34).string(message.author);
|
||||
if (message.license != null && message.hasOwnProperty("license"))
|
||||
writer.uint32(/* id 5, wireType 2 =*/42).string(message.license);
|
||||
if (message.repository != null && message.hasOwnProperty("repository"))
|
||||
$root.Package.Repository.encode(message.repository, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
|
||||
if (message.bugs != null && message.hasOwnProperty("bugs"))
|
||||
writer.uint32(/* id 7, wireType 2 =*/58).string(message.bugs);
|
||||
if (message.homepage != null && message.hasOwnProperty("homepage"))
|
||||
writer.uint32(/* id 8, wireType 2 =*/66).string(message.homepage);
|
||||
if (message.keywords != null && message.keywords.length)
|
||||
for (var i = 0; i < message.keywords.length; ++i)
|
||||
writer.uint32(/* id 9, wireType 2 =*/74).string(message.keywords[i]);
|
||||
if (message.main != null && message.hasOwnProperty("main"))
|
||||
writer.uint32(/* id 10, wireType 2 =*/82).string(message.main);
|
||||
if (message.bin != null && message.hasOwnProperty("bin"))
|
||||
for (var keys = Object.keys(message.bin), i = 0; i < keys.length; ++i)
|
||||
writer.uint32(/* id 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.bin[keys[i]]).ldelim();
|
||||
if (message.scripts != null && message.hasOwnProperty("scripts"))
|
||||
for (var keys = Object.keys(message.scripts), i = 0; i < keys.length; ++i)
|
||||
writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.scripts[keys[i]]).ldelim();
|
||||
if (message.dependencies != null && message.hasOwnProperty("dependencies"))
|
||||
for (var keys = Object.keys(message.dependencies), i = 0; i < keys.length; ++i)
|
||||
writer.uint32(/* id 13, wireType 2 =*/106).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.dependencies[keys[i]]).ldelim();
|
||||
if (message.devDependencies != null && message.hasOwnProperty("devDependencies"))
|
||||
for (var keys = Object.keys(message.devDependencies), i = 0; i < keys.length; ++i)
|
||||
writer.uint32(/* id 15, wireType 2 =*/122).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.devDependencies[keys[i]]).ldelim();
|
||||
if (message.types != null && message.hasOwnProperty("types"))
|
||||
writer.uint32(/* id 17, wireType 2 =*/138).string(message.types);
|
||||
if (message.cliDependencies != null && message.cliDependencies.length)
|
||||
for (var i = 0; i < message.cliDependencies.length; ++i)
|
||||
writer.uint32(/* id 18, wireType 2 =*/146).string(message.cliDependencies[i]);
|
||||
if (message.versionScheme != null && message.hasOwnProperty("versionScheme"))
|
||||
writer.uint32(/* id 19, wireType 2 =*/154).string(message.versionScheme);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Package message, length delimited. Does not implicitly {@link Package.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {IPackage} message Package message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Package.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Package message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Package} Package
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Package.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Package(), key;
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.name = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.version = reader.string();
|
||||
break;
|
||||
case 19:
|
||||
message.versionScheme = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.description = reader.string();
|
||||
break;
|
||||
case 4:
|
||||
message.author = reader.string();
|
||||
break;
|
||||
case 5:
|
||||
message.license = reader.string();
|
||||
break;
|
||||
case 6:
|
||||
message.repository = $root.Package.Repository.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 7:
|
||||
message.bugs = reader.string();
|
||||
break;
|
||||
case 8:
|
||||
message.homepage = reader.string();
|
||||
break;
|
||||
case 9:
|
||||
if (!(message.keywords && message.keywords.length))
|
||||
message.keywords = [];
|
||||
message.keywords.push(reader.string());
|
||||
break;
|
||||
case 10:
|
||||
message.main = reader.string();
|
||||
break;
|
||||
case 11:
|
||||
reader.skip().pos++;
|
||||
if (message.bin === $util.emptyObject)
|
||||
message.bin = {};
|
||||
key = reader.string();
|
||||
reader.pos++;
|
||||
message.bin[key] = reader.string();
|
||||
break;
|
||||
case 12:
|
||||
reader.skip().pos++;
|
||||
if (message.scripts === $util.emptyObject)
|
||||
message.scripts = {};
|
||||
key = reader.string();
|
||||
reader.pos++;
|
||||
message.scripts[key] = reader.string();
|
||||
break;
|
||||
case 13:
|
||||
reader.skip().pos++;
|
||||
if (message.dependencies === $util.emptyObject)
|
||||
message.dependencies = {};
|
||||
key = reader.string();
|
||||
reader.pos++;
|
||||
message.dependencies[key] = reader.string();
|
||||
break;
|
||||
case 15:
|
||||
reader.skip().pos++;
|
||||
if (message.devDependencies === $util.emptyObject)
|
||||
message.devDependencies = {};
|
||||
key = reader.string();
|
||||
reader.pos++;
|
||||
message.devDependencies[key] = reader.string();
|
||||
break;
|
||||
case 17:
|
||||
message.types = reader.string();
|
||||
break;
|
||||
case 18:
|
||||
if (!(message.cliDependencies && message.cliDependencies.length))
|
||||
message.cliDependencies = [];
|
||||
message.cliDependencies.push(reader.string());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Package message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Package} Package
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Package.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a Package message.
|
||||
* @function verify
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
Package.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.name != null && message.hasOwnProperty("name"))
|
||||
if (!$util.isString(message.name))
|
||||
return "name: string expected";
|
||||
if (message.version != null && message.hasOwnProperty("version"))
|
||||
if (!$util.isString(message.version))
|
||||
return "version: string expected";
|
||||
if (message.versionScheme != null && message.hasOwnProperty("versionScheme"))
|
||||
if (!$util.isString(message.versionScheme))
|
||||
return "versionScheme: string expected";
|
||||
if (message.description != null && message.hasOwnProperty("description"))
|
||||
if (!$util.isString(message.description))
|
||||
return "description: string expected";
|
||||
if (message.author != null && message.hasOwnProperty("author"))
|
||||
if (!$util.isString(message.author))
|
||||
return "author: string expected";
|
||||
if (message.license != null && message.hasOwnProperty("license"))
|
||||
if (!$util.isString(message.license))
|
||||
return "license: string expected";
|
||||
if (message.repository != null && message.hasOwnProperty("repository")) {
|
||||
var error = $root.Package.Repository.verify(message.repository);
|
||||
if (error)
|
||||
return "repository." + error;
|
||||
}
|
||||
if (message.bugs != null && message.hasOwnProperty("bugs"))
|
||||
if (!$util.isString(message.bugs))
|
||||
return "bugs: string expected";
|
||||
if (message.homepage != null && message.hasOwnProperty("homepage"))
|
||||
if (!$util.isString(message.homepage))
|
||||
return "homepage: string expected";
|
||||
if (message.keywords != null && message.hasOwnProperty("keywords")) {
|
||||
if (!Array.isArray(message.keywords))
|
||||
return "keywords: array expected";
|
||||
for (var i = 0; i < message.keywords.length; ++i)
|
||||
if (!$util.isString(message.keywords[i]))
|
||||
return "keywords: string[] expected";
|
||||
}
|
||||
if (message.main != null && message.hasOwnProperty("main"))
|
||||
if (!$util.isString(message.main))
|
||||
return "main: string expected";
|
||||
if (message.bin != null && message.hasOwnProperty("bin")) {
|
||||
if (!$util.isObject(message.bin))
|
||||
return "bin: object expected";
|
||||
var key = Object.keys(message.bin);
|
||||
for (var i = 0; i < key.length; ++i)
|
||||
if (!$util.isString(message.bin[key[i]]))
|
||||
return "bin: string{k:string} expected";
|
||||
}
|
||||
if (message.scripts != null && message.hasOwnProperty("scripts")) {
|
||||
if (!$util.isObject(message.scripts))
|
||||
return "scripts: object expected";
|
||||
var key = Object.keys(message.scripts);
|
||||
for (var i = 0; i < key.length; ++i)
|
||||
if (!$util.isString(message.scripts[key[i]]))
|
||||
return "scripts: string{k:string} expected";
|
||||
}
|
||||
if (message.dependencies != null && message.hasOwnProperty("dependencies")) {
|
||||
if (!$util.isObject(message.dependencies))
|
||||
return "dependencies: object expected";
|
||||
var key = Object.keys(message.dependencies);
|
||||
for (var i = 0; i < key.length; ++i)
|
||||
if (!$util.isString(message.dependencies[key[i]]))
|
||||
return "dependencies: string{k:string} expected";
|
||||
}
|
||||
if (message.devDependencies != null && message.hasOwnProperty("devDependencies")) {
|
||||
if (!$util.isObject(message.devDependencies))
|
||||
return "devDependencies: object expected";
|
||||
var key = Object.keys(message.devDependencies);
|
||||
for (var i = 0; i < key.length; ++i)
|
||||
if (!$util.isString(message.devDependencies[key[i]]))
|
||||
return "devDependencies: string{k:string} expected";
|
||||
}
|
||||
if (message.types != null && message.hasOwnProperty("types"))
|
||||
if (!$util.isString(message.types))
|
||||
return "types: string expected";
|
||||
if (message.cliDependencies != null && message.hasOwnProperty("cliDependencies")) {
|
||||
if (!Array.isArray(message.cliDependencies))
|
||||
return "cliDependencies: array expected";
|
||||
for (var i = 0; i < message.cliDependencies.length; ++i)
|
||||
if (!$util.isString(message.cliDependencies[i]))
|
||||
return "cliDependencies: string[] expected";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Package message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Package} Package
|
||||
*/
|
||||
Package.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Package)
|
||||
return object;
|
||||
var message = new $root.Package();
|
||||
if (object.name != null)
|
||||
message.name = String(object.name);
|
||||
if (object.version != null)
|
||||
message.version = String(object.version);
|
||||
if (object.versionScheme != null)
|
||||
message.versionScheme = String(object.versionScheme);
|
||||
if (object.description != null)
|
||||
message.description = String(object.description);
|
||||
if (object.author != null)
|
||||
message.author = String(object.author);
|
||||
if (object.license != null)
|
||||
message.license = String(object.license);
|
||||
if (object.repository != null) {
|
||||
if (typeof object.repository !== "object")
|
||||
throw TypeError(".Package.repository: object expected");
|
||||
message.repository = $root.Package.Repository.fromObject(object.repository);
|
||||
}
|
||||
if (object.bugs != null)
|
||||
message.bugs = String(object.bugs);
|
||||
if (object.homepage != null)
|
||||
message.homepage = String(object.homepage);
|
||||
if (object.keywords) {
|
||||
if (!Array.isArray(object.keywords))
|
||||
throw TypeError(".Package.keywords: array expected");
|
||||
message.keywords = [];
|
||||
for (var i = 0; i < object.keywords.length; ++i)
|
||||
message.keywords[i] = String(object.keywords[i]);
|
||||
}
|
||||
if (object.main != null)
|
||||
message.main = String(object.main);
|
||||
if (object.bin) {
|
||||
if (typeof object.bin !== "object")
|
||||
throw TypeError(".Package.bin: object expected");
|
||||
message.bin = {};
|
||||
for (var keys = Object.keys(object.bin), i = 0; i < keys.length; ++i)
|
||||
message.bin[keys[i]] = String(object.bin[keys[i]]);
|
||||
}
|
||||
if (object.scripts) {
|
||||
if (typeof object.scripts !== "object")
|
||||
throw TypeError(".Package.scripts: object expected");
|
||||
message.scripts = {};
|
||||
for (var keys = Object.keys(object.scripts), i = 0; i < keys.length; ++i)
|
||||
message.scripts[keys[i]] = String(object.scripts[keys[i]]);
|
||||
}
|
||||
if (object.dependencies) {
|
||||
if (typeof object.dependencies !== "object")
|
||||
throw TypeError(".Package.dependencies: object expected");
|
||||
message.dependencies = {};
|
||||
for (var keys = Object.keys(object.dependencies), i = 0; i < keys.length; ++i)
|
||||
message.dependencies[keys[i]] = String(object.dependencies[keys[i]]);
|
||||
}
|
||||
if (object.devDependencies) {
|
||||
if (typeof object.devDependencies !== "object")
|
||||
throw TypeError(".Package.devDependencies: object expected");
|
||||
message.devDependencies = {};
|
||||
for (var keys = Object.keys(object.devDependencies), i = 0; i < keys.length; ++i)
|
||||
message.devDependencies[keys[i]] = String(object.devDependencies[keys[i]]);
|
||||
}
|
||||
if (object.types != null)
|
||||
message.types = String(object.types);
|
||||
if (object.cliDependencies) {
|
||||
if (!Array.isArray(object.cliDependencies))
|
||||
throw TypeError(".Package.cliDependencies: array expected");
|
||||
message.cliDependencies = [];
|
||||
for (var i = 0; i < object.cliDependencies.length; ++i)
|
||||
message.cliDependencies[i] = String(object.cliDependencies[i]);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a Package message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Package
|
||||
* @static
|
||||
* @param {Package} message Package
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
Package.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.arrays || options.defaults) {
|
||||
object.keywords = [];
|
||||
object.cliDependencies = [];
|
||||
}
|
||||
if (options.objects || options.defaults) {
|
||||
object.bin = {};
|
||||
object.scripts = {};
|
||||
object.dependencies = {};
|
||||
object.devDependencies = {};
|
||||
}
|
||||
if (options.defaults) {
|
||||
object.name = "";
|
||||
object.version = "";
|
||||
object.description = "";
|
||||
object.author = "";
|
||||
object.license = "";
|
||||
object.repository = null;
|
||||
object.bugs = "";
|
||||
object.homepage = "";
|
||||
object.main = "";
|
||||
object.types = "";
|
||||
object.versionScheme = "";
|
||||
}
|
||||
if (message.name != null && message.hasOwnProperty("name"))
|
||||
object.name = message.name;
|
||||
if (message.version != null && message.hasOwnProperty("version"))
|
||||
object.version = message.version;
|
||||
if (message.description != null && message.hasOwnProperty("description"))
|
||||
object.description = message.description;
|
||||
if (message.author != null && message.hasOwnProperty("author"))
|
||||
object.author = message.author;
|
||||
if (message.license != null && message.hasOwnProperty("license"))
|
||||
object.license = message.license;
|
||||
if (message.repository != null && message.hasOwnProperty("repository"))
|
||||
object.repository = $root.Package.Repository.toObject(message.repository, options);
|
||||
if (message.bugs != null && message.hasOwnProperty("bugs"))
|
||||
object.bugs = message.bugs;
|
||||
if (message.homepage != null && message.hasOwnProperty("homepage"))
|
||||
object.homepage = message.homepage;
|
||||
if (message.keywords && message.keywords.length) {
|
||||
object.keywords = [];
|
||||
for (var j = 0; j < message.keywords.length; ++j)
|
||||
object.keywords[j] = message.keywords[j];
|
||||
}
|
||||
if (message.main != null && message.hasOwnProperty("main"))
|
||||
object.main = message.main;
|
||||
var keys2;
|
||||
if (message.bin && (keys2 = Object.keys(message.bin)).length) {
|
||||
object.bin = {};
|
||||
for (var j = 0; j < keys2.length; ++j)
|
||||
object.bin[keys2[j]] = message.bin[keys2[j]];
|
||||
}
|
||||
if (message.scripts && (keys2 = Object.keys(message.scripts)).length) {
|
||||
object.scripts = {};
|
||||
for (var j = 0; j < keys2.length; ++j)
|
||||
object.scripts[keys2[j]] = message.scripts[keys2[j]];
|
||||
}
|
||||
if (message.dependencies && (keys2 = Object.keys(message.dependencies)).length) {
|
||||
object.dependencies = {};
|
||||
for (var j = 0; j < keys2.length; ++j)
|
||||
object.dependencies[keys2[j]] = message.dependencies[keys2[j]];
|
||||
}
|
||||
if (message.devDependencies && (keys2 = Object.keys(message.devDependencies)).length) {
|
||||
object.devDependencies = {};
|
||||
for (var j = 0; j < keys2.length; ++j)
|
||||
object.devDependencies[keys2[j]] = message.devDependencies[keys2[j]];
|
||||
}
|
||||
if (message.types != null && message.hasOwnProperty("types"))
|
||||
object.types = message.types;
|
||||
if (message.cliDependencies && message.cliDependencies.length) {
|
||||
object.cliDependencies = [];
|
||||
for (var j = 0; j < message.cliDependencies.length; ++j)
|
||||
object.cliDependencies[j] = message.cliDependencies[j];
|
||||
}
|
||||
if (message.versionScheme != null && message.hasOwnProperty("versionScheme"))
|
||||
object.versionScheme = message.versionScheme;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Package to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Package
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
Package.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
Package.Repository = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Repository.
|
||||
* @memberof Package
|
||||
* @interface IRepository
|
||||
* @property {string|null} [type] Repository type
|
||||
* @property {string|null} [url] Repository url
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Repository.
|
||||
* @memberof Package
|
||||
* @classdesc Represents a Repository.
|
||||
* @implements IRepository
|
||||
* @constructor
|
||||
* @param {Package.IRepository=} [properties] Properties to set
|
||||
*/
|
||||
function Repository(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Repository type.
|
||||
* @member {string} type
|
||||
* @memberof Package.Repository
|
||||
* @instance
|
||||
*/
|
||||
Repository.prototype.type = "";
|
||||
|
||||
/**
|
||||
* Repository url.
|
||||
* @member {string} url
|
||||
* @memberof Package.Repository
|
||||
* @instance
|
||||
*/
|
||||
Repository.prototype.url = "";
|
||||
|
||||
/**
|
||||
* Creates a new Repository instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {Package.IRepository=} [properties] Properties to set
|
||||
* @returns {Package.Repository} Repository instance
|
||||
*/
|
||||
Repository.create = function create(properties) {
|
||||
return new Repository(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Repository message. Does not implicitly {@link Package.Repository.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {Package.IRepository} message Repository message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Repository.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.type != null && message.hasOwnProperty("type"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.type);
|
||||
if (message.url != null && message.hasOwnProperty("url"))
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.url);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Repository message, length delimited. Does not implicitly {@link Package.Repository.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {Package.IRepository} message Repository message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Repository.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Repository message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Package.Repository} Repository
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Repository.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Package.Repository();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.type = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.url = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Repository message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Package.Repository} Repository
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Repository.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a Repository message.
|
||||
* @function verify
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
Repository.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.type != null && message.hasOwnProperty("type"))
|
||||
if (!$util.isString(message.type))
|
||||
return "type: string expected";
|
||||
if (message.url != null && message.hasOwnProperty("url"))
|
||||
if (!$util.isString(message.url))
|
||||
return "url: string expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Repository message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Package.Repository} Repository
|
||||
*/
|
||||
Repository.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Package.Repository)
|
||||
return object;
|
||||
var message = new $root.Package.Repository();
|
||||
if (object.type != null)
|
||||
message.type = String(object.type);
|
||||
if (object.url != null)
|
||||
message.url = String(object.url);
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a Repository message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Package.Repository
|
||||
* @static
|
||||
* @param {Package.Repository} message Repository
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
Repository.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults) {
|
||||
object.type = "";
|
||||
object.url = "";
|
||||
}
|
||||
if (message.type != null && message.hasOwnProperty("type"))
|
||||
object.type = message.type;
|
||||
if (message.url != null && message.hasOwnProperty("url"))
|
||||
object.url = message.url;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Repository to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Package.Repository
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
Repository.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return Repository;
|
||||
})();
|
||||
|
||||
return Package;
|
||||
})();
|
||||
|
||||
module.exports = $root;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message Package {
|
||||
string name = 1;
|
||||
string version = 2;
|
||||
string versionScheme = 19;
|
||||
string description = 3;
|
||||
string author = 4;
|
||||
string license = 5;
|
||||
|
||||
message Repository {
|
||||
string type = 1;
|
||||
string url = 2;
|
||||
}
|
||||
|
||||
Repository repository = 6;
|
||||
string bugs = 7;
|
||||
string homepage = 8;
|
||||
repeated string keywords = 9;
|
||||
string main = 10;
|
||||
map<string, string> bin = 11;
|
||||
map<string, string> scripts = 12;
|
||||
map<string, string> dependencies = 13;
|
||||
// map<string, string> optionalDependencies = 14;
|
||||
map<string, string> devDependencies = 15;
|
||||
// map<string, bool> browser = 16;
|
||||
string types = 17;
|
||||
repeated string cliDependencies = 18;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
import * as $protobuf from "../..";
|
||||
export class MyService extends $protobuf.rpc.Service {
|
||||
constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
|
||||
public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): MyService;
|
||||
public myMethod(request: IMyRequest, callback: MyService.MyMethodCallback): void;
|
||||
public myMethod(request: IMyRequest): Promise<MyResponse>;
|
||||
}
|
||||
|
||||
export namespace MyService {
|
||||
|
||||
type MyMethodCallback = (error: (Error|null), response?: MyResponse) => void;
|
||||
}
|
||||
|
||||
export interface IMyRequest {
|
||||
path?: (string|null);
|
||||
}
|
||||
|
||||
export class MyRequest implements IMyRequest {
|
||||
constructor(properties?: IMyRequest);
|
||||
public path: string;
|
||||
public static create(properties?: IMyRequest): MyRequest;
|
||||
public static encode(message: IMyRequest, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMyRequest, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyRequest;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): MyRequest;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): MyRequest;
|
||||
public static toObject(message: MyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export interface IMyResponse {
|
||||
status?: (number|null);
|
||||
}
|
||||
|
||||
export class MyResponse implements IMyResponse {
|
||||
constructor(properties?: IMyResponse);
|
||||
public status: number;
|
||||
public static create(properties?: IMyResponse): MyResponse;
|
||||
public static encode(message: IMyResponse, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMyResponse, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyResponse;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): MyResponse;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): MyResponse;
|
||||
public static toObject(message: MyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
Executable
+452
@@ -0,0 +1,452 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
import * as $protobuf from "../../minimal";
|
||||
|
||||
// Common aliases
|
||||
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
const $root = $protobuf.roots.test_rpc || ($protobuf.roots.test_rpc = {});
|
||||
|
||||
export const MyService = $root.MyService = (() => {
|
||||
|
||||
/**
|
||||
* Constructs a new MyService service.
|
||||
* @exports MyService
|
||||
* @classdesc Represents a MyService
|
||||
* @extends $protobuf.rpc.Service
|
||||
* @constructor
|
||||
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
|
||||
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
|
||||
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
|
||||
*/
|
||||
function MyService(rpcImpl, requestDelimited, responseDelimited) {
|
||||
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
|
||||
}
|
||||
|
||||
(MyService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = MyService;
|
||||
|
||||
/**
|
||||
* Creates new MyService service using the specified rpc implementation.
|
||||
* @function create
|
||||
* @memberof MyService
|
||||
* @static
|
||||
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
|
||||
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
|
||||
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
|
||||
* @returns {MyService} RPC service. Useful where requests and/or responses are streamed.
|
||||
*/
|
||||
MyService.create = function create(rpcImpl, requestDelimited, responseDelimited) {
|
||||
return new this(rpcImpl, requestDelimited, responseDelimited);
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback as used by {@link MyService#myMethod}.
|
||||
* @memberof MyService
|
||||
* @typedef MyMethodCallback
|
||||
* @type {function}
|
||||
* @param {Error|null} error Error, if any
|
||||
* @param {MyResponse} [response] MyResponse
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls MyMethod.
|
||||
* @function myMethod
|
||||
* @memberof MyService
|
||||
* @instance
|
||||
* @param {IMyRequest} request MyRequest message or plain object
|
||||
* @param {MyService.MyMethodCallback} callback Node-style callback called with the error, if any, and MyResponse
|
||||
* @returns {undefined}
|
||||
* @variation 1
|
||||
*/
|
||||
Object.defineProperty(MyService.prototype.myMethod = function myMethod(request, callback) {
|
||||
return this.rpcCall(myMethod, $root.MyRequest, $root.MyResponse, request, callback);
|
||||
}, "name", { value: "MyMethod" });
|
||||
|
||||
/**
|
||||
* Calls MyMethod.
|
||||
* @function myMethod
|
||||
* @memberof MyService
|
||||
* @instance
|
||||
* @param {IMyRequest} request MyRequest message or plain object
|
||||
* @returns {Promise<MyResponse>} Promise
|
||||
* @variation 2
|
||||
*/
|
||||
|
||||
return MyService;
|
||||
})();
|
||||
|
||||
export const MyRequest = $root.MyRequest = (() => {
|
||||
|
||||
/**
|
||||
* Properties of a MyRequest.
|
||||
* @exports IMyRequest
|
||||
* @interface IMyRequest
|
||||
* @property {string|null} [path] MyRequest path
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new MyRequest.
|
||||
* @exports MyRequest
|
||||
* @classdesc Represents a MyRequest.
|
||||
* @implements IMyRequest
|
||||
* @constructor
|
||||
* @param {IMyRequest=} [properties] Properties to set
|
||||
*/
|
||||
function MyRequest(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* MyRequest path.
|
||||
* @member {string} path
|
||||
* @memberof MyRequest
|
||||
* @instance
|
||||
*/
|
||||
MyRequest.prototype.path = "";
|
||||
|
||||
/**
|
||||
* Creates a new MyRequest instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest=} [properties] Properties to set
|
||||
* @returns {MyRequest} MyRequest instance
|
||||
*/
|
||||
MyRequest.create = function create(properties) {
|
||||
return new MyRequest(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyRequest message. Does not implicitly {@link MyRequest.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest} message MyRequest message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyRequest.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.path);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyRequest message, length delimited. Does not implicitly {@link MyRequest.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest} message MyRequest message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyRequest.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyRequest message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {MyRequest} MyRequest
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyRequest.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.MyRequest();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.path = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyRequest message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {MyRequest} MyRequest
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyRequest.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a MyRequest message.
|
||||
* @function verify
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
MyRequest.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
if (!$util.isString(message.path))
|
||||
return "path: string expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a MyRequest message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {MyRequest} MyRequest
|
||||
*/
|
||||
MyRequest.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.MyRequest)
|
||||
return object;
|
||||
let message = new $root.MyRequest();
|
||||
if (object.path != null)
|
||||
message.path = String(object.path);
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a MyRequest message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {MyRequest} message MyRequest
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
MyRequest.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
let object = {};
|
||||
if (options.defaults)
|
||||
object.path = "";
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
object.path = message.path;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this MyRequest to JSON.
|
||||
* @function toJSON
|
||||
* @memberof MyRequest
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
MyRequest.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return MyRequest;
|
||||
})();
|
||||
|
||||
export const MyResponse = $root.MyResponse = (() => {
|
||||
|
||||
/**
|
||||
* Properties of a MyResponse.
|
||||
* @exports IMyResponse
|
||||
* @interface IMyResponse
|
||||
* @property {number|null} [status] MyResponse status
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new MyResponse.
|
||||
* @exports MyResponse
|
||||
* @classdesc Represents a MyResponse.
|
||||
* @implements IMyResponse
|
||||
* @constructor
|
||||
* @param {IMyResponse=} [properties] Properties to set
|
||||
*/
|
||||
function MyResponse(properties) {
|
||||
if (properties)
|
||||
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* MyResponse status.
|
||||
* @member {number} status
|
||||
* @memberof MyResponse
|
||||
* @instance
|
||||
*/
|
||||
MyResponse.prototype.status = 0;
|
||||
|
||||
/**
|
||||
* Creates a new MyResponse instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse=} [properties] Properties to set
|
||||
* @returns {MyResponse} MyResponse instance
|
||||
*/
|
||||
MyResponse.create = function create(properties) {
|
||||
return new MyResponse(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyResponse message. Does not implicitly {@link MyResponse.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse} message MyResponse message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyResponse.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyResponse message, length delimited. Does not implicitly {@link MyResponse.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse} message MyResponse message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyResponse.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyResponse message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {MyResponse} MyResponse
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyResponse.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.MyResponse();
|
||||
while (reader.pos < end) {
|
||||
let tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2:
|
||||
message.status = reader.int32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyResponse message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {MyResponse} MyResponse
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyResponse.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a MyResponse message.
|
||||
* @function verify
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
MyResponse.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
if (!$util.isInteger(message.status))
|
||||
return "status: integer expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a MyResponse message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {MyResponse} MyResponse
|
||||
*/
|
||||
MyResponse.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.MyResponse)
|
||||
return object;
|
||||
let message = new $root.MyResponse();
|
||||
if (object.status != null)
|
||||
message.status = object.status | 0;
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a MyResponse message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {MyResponse} message MyResponse
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
MyResponse.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
let object = {};
|
||||
if (options.defaults)
|
||||
object.status = 0;
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
object.status = message.status;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this MyResponse to JSON.
|
||||
* @function toJSON
|
||||
* @memberof MyResponse
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
MyResponse.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return MyResponse;
|
||||
})();
|
||||
|
||||
export { $root as default };
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
import * as $protobuf from "../..";
|
||||
export class MyService extends $protobuf.rpc.Service {
|
||||
constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
|
||||
public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): MyService;
|
||||
public delete(request: IMyRequest, callback: MyService.DeleteCallback): void;
|
||||
public delete(request: IMyRequest): Promise<MyResponse>;
|
||||
}
|
||||
|
||||
export namespace MyService {
|
||||
|
||||
type DeleteCallback = (error: (Error|null), response?: MyResponse) => void;
|
||||
}
|
||||
|
||||
export interface IMyRequest {
|
||||
path?: (string|null);
|
||||
}
|
||||
|
||||
export class MyRequest implements IMyRequest {
|
||||
constructor(properties?: IMyRequest);
|
||||
public path: string;
|
||||
public static create(properties?: IMyRequest): MyRequest;
|
||||
public static encode(message: IMyRequest, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMyRequest, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyRequest;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): MyRequest;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): MyRequest;
|
||||
public static toObject(message: MyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export interface IMyResponse {
|
||||
status?: (number|null);
|
||||
}
|
||||
|
||||
export class MyResponse implements IMyResponse {
|
||||
constructor(properties?: IMyResponse);
|
||||
public status: number;
|
||||
public static create(properties?: IMyResponse): MyResponse;
|
||||
public static encode(message: IMyResponse, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMyResponse, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyResponse;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): MyResponse;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): MyResponse;
|
||||
public static toObject(message: MyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
+454
@@ -0,0 +1,454 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
"use strict";
|
||||
|
||||
var $protobuf = require("../../minimal");
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
var $root = $protobuf.roots["test_rpc-reserved"] || ($protobuf.roots["test_rpc-reserved"] = {});
|
||||
|
||||
$root.MyService = (function() {
|
||||
|
||||
/**
|
||||
* Constructs a new MyService service.
|
||||
* @exports MyService
|
||||
* @classdesc Represents a MyService
|
||||
* @extends $protobuf.rpc.Service
|
||||
* @constructor
|
||||
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
|
||||
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
|
||||
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
|
||||
*/
|
||||
function MyService(rpcImpl, requestDelimited, responseDelimited) {
|
||||
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
|
||||
}
|
||||
|
||||
(MyService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = MyService;
|
||||
|
||||
/**
|
||||
* Creates new MyService service using the specified rpc implementation.
|
||||
* @function create
|
||||
* @memberof MyService
|
||||
* @static
|
||||
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
|
||||
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
|
||||
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
|
||||
* @returns {MyService} RPC service. Useful where requests and/or responses are streamed.
|
||||
*/
|
||||
MyService.create = function create(rpcImpl, requestDelimited, responseDelimited) {
|
||||
return new this(rpcImpl, requestDelimited, responseDelimited);
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback as used by {@link MyService#delete_}.
|
||||
* @memberof MyService
|
||||
* @typedef DeleteCallback
|
||||
* @type {function}
|
||||
* @param {Error|null} error Error, if any
|
||||
* @param {MyResponse} [response] MyResponse
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls Delete.
|
||||
* @function delete
|
||||
* @memberof MyService
|
||||
* @instance
|
||||
* @param {IMyRequest} request MyRequest message or plain object
|
||||
* @param {MyService.DeleteCallback} callback Node-style callback called with the error, if any, and MyResponse
|
||||
* @returns {undefined}
|
||||
* @variation 1
|
||||
*/
|
||||
Object.defineProperty(MyService.prototype["delete"] = function delete_(request, callback) {
|
||||
return this.rpcCall(delete_, $root.MyRequest, $root.MyResponse, request, callback);
|
||||
}, "name", { value: "Delete" });
|
||||
|
||||
/**
|
||||
* Calls Delete.
|
||||
* @function delete
|
||||
* @memberof MyService
|
||||
* @instance
|
||||
* @param {IMyRequest} request MyRequest message or plain object
|
||||
* @returns {Promise<MyResponse>} Promise
|
||||
* @variation 2
|
||||
*/
|
||||
|
||||
return MyService;
|
||||
})();
|
||||
|
||||
$root.MyRequest = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a MyRequest.
|
||||
* @exports IMyRequest
|
||||
* @interface IMyRequest
|
||||
* @property {string|null} [path] MyRequest path
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new MyRequest.
|
||||
* @exports MyRequest
|
||||
* @classdesc Represents a MyRequest.
|
||||
* @implements IMyRequest
|
||||
* @constructor
|
||||
* @param {IMyRequest=} [properties] Properties to set
|
||||
*/
|
||||
function MyRequest(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* MyRequest path.
|
||||
* @member {string} path
|
||||
* @memberof MyRequest
|
||||
* @instance
|
||||
*/
|
||||
MyRequest.prototype.path = "";
|
||||
|
||||
/**
|
||||
* Creates a new MyRequest instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest=} [properties] Properties to set
|
||||
* @returns {MyRequest} MyRequest instance
|
||||
*/
|
||||
MyRequest.create = function create(properties) {
|
||||
return new MyRequest(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyRequest message. Does not implicitly {@link MyRequest.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest} message MyRequest message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyRequest.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.path);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyRequest message, length delimited. Does not implicitly {@link MyRequest.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest} message MyRequest message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyRequest.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyRequest message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {MyRequest} MyRequest
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyRequest.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.MyRequest();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.path = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyRequest message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {MyRequest} MyRequest
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyRequest.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a MyRequest message.
|
||||
* @function verify
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
MyRequest.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
if (!$util.isString(message.path))
|
||||
return "path: string expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a MyRequest message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {MyRequest} MyRequest
|
||||
*/
|
||||
MyRequest.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.MyRequest)
|
||||
return object;
|
||||
var message = new $root.MyRequest();
|
||||
if (object.path != null)
|
||||
message.path = String(object.path);
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a MyRequest message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {MyRequest} message MyRequest
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
MyRequest.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults)
|
||||
object.path = "";
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
object.path = message.path;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this MyRequest to JSON.
|
||||
* @function toJSON
|
||||
* @memberof MyRequest
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
MyRequest.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return MyRequest;
|
||||
})();
|
||||
|
||||
$root.MyResponse = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a MyResponse.
|
||||
* @exports IMyResponse
|
||||
* @interface IMyResponse
|
||||
* @property {number|null} [status] MyResponse status
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new MyResponse.
|
||||
* @exports MyResponse
|
||||
* @classdesc Represents a MyResponse.
|
||||
* @implements IMyResponse
|
||||
* @constructor
|
||||
* @param {IMyResponse=} [properties] Properties to set
|
||||
*/
|
||||
function MyResponse(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* MyResponse status.
|
||||
* @member {number} status
|
||||
* @memberof MyResponse
|
||||
* @instance
|
||||
*/
|
||||
MyResponse.prototype.status = 0;
|
||||
|
||||
/**
|
||||
* Creates a new MyResponse instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse=} [properties] Properties to set
|
||||
* @returns {MyResponse} MyResponse instance
|
||||
*/
|
||||
MyResponse.create = function create(properties) {
|
||||
return new MyResponse(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyResponse message. Does not implicitly {@link MyResponse.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse} message MyResponse message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyResponse.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyResponse message, length delimited. Does not implicitly {@link MyResponse.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse} message MyResponse message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyResponse.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyResponse message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {MyResponse} MyResponse
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyResponse.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.MyResponse();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2:
|
||||
message.status = reader.int32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyResponse message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {MyResponse} MyResponse
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyResponse.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a MyResponse message.
|
||||
* @function verify
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
MyResponse.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
if (!$util.isInteger(message.status))
|
||||
return "status: integer expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a MyResponse message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {MyResponse} MyResponse
|
||||
*/
|
||||
MyResponse.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.MyResponse)
|
||||
return object;
|
||||
var message = new $root.MyResponse();
|
||||
if (object.status != null)
|
||||
message.status = object.status | 0;
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a MyResponse message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {MyResponse} message MyResponse
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
MyResponse.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults)
|
||||
object.status = 0;
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
object.status = message.status;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this MyResponse to JSON.
|
||||
* @function toJSON
|
||||
* @memberof MyResponse
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
MyResponse.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return MyResponse;
|
||||
})();
|
||||
|
||||
module.exports = $root;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
service MyService {
|
||||
rpc Delete (MyRequest) returns (MyResponse);
|
||||
}
|
||||
|
||||
message MyRequest {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message MyResponse {
|
||||
int32 status = 2;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
import * as $protobuf from "../..";
|
||||
export class MyService extends $protobuf.rpc.Service {
|
||||
constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
|
||||
public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): MyService;
|
||||
public myMethod(request: IMyRequest, callback: MyService.MyMethodCallback): void;
|
||||
public myMethod(request: IMyRequest): Promise<MyResponse>;
|
||||
}
|
||||
|
||||
export namespace MyService {
|
||||
|
||||
type MyMethodCallback = (error: (Error|null), response?: MyResponse) => void;
|
||||
}
|
||||
|
||||
export interface IMyRequest {
|
||||
path?: (string|null);
|
||||
}
|
||||
|
||||
export class MyRequest implements IMyRequest {
|
||||
constructor(properties?: IMyRequest);
|
||||
public path: string;
|
||||
public static create(properties?: IMyRequest): MyRequest;
|
||||
public static encode(message: IMyRequest, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMyRequest, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyRequest;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): MyRequest;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): MyRequest;
|
||||
public static toObject(message: MyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
export interface IMyResponse {
|
||||
status?: (number|null);
|
||||
}
|
||||
|
||||
export class MyResponse implements IMyResponse {
|
||||
constructor(properties?: IMyResponse);
|
||||
public status: number;
|
||||
public static create(properties?: IMyResponse): MyResponse;
|
||||
public static encode(message: IMyResponse, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static encodeDelimited(message: IMyResponse, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): MyResponse;
|
||||
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): MyResponse;
|
||||
public static verify(message: { [k: string]: any }): (string|null);
|
||||
public static fromObject(object: { [k: string]: any }): MyResponse;
|
||||
public static toObject(message: MyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
Executable
+454
@@ -0,0 +1,454 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
"use strict";
|
||||
|
||||
var $protobuf = require("../../minimal");
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
var $root = $protobuf.roots.test_rpc || ($protobuf.roots.test_rpc = {});
|
||||
|
||||
$root.MyService = (function() {
|
||||
|
||||
/**
|
||||
* Constructs a new MyService service.
|
||||
* @exports MyService
|
||||
* @classdesc Represents a MyService
|
||||
* @extends $protobuf.rpc.Service
|
||||
* @constructor
|
||||
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
|
||||
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
|
||||
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
|
||||
*/
|
||||
function MyService(rpcImpl, requestDelimited, responseDelimited) {
|
||||
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
|
||||
}
|
||||
|
||||
(MyService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = MyService;
|
||||
|
||||
/**
|
||||
* Creates new MyService service using the specified rpc implementation.
|
||||
* @function create
|
||||
* @memberof MyService
|
||||
* @static
|
||||
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
|
||||
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
|
||||
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
|
||||
* @returns {MyService} RPC service. Useful where requests and/or responses are streamed.
|
||||
*/
|
||||
MyService.create = function create(rpcImpl, requestDelimited, responseDelimited) {
|
||||
return new this(rpcImpl, requestDelimited, responseDelimited);
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback as used by {@link MyService#myMethod}.
|
||||
* @memberof MyService
|
||||
* @typedef MyMethodCallback
|
||||
* @type {function}
|
||||
* @param {Error|null} error Error, if any
|
||||
* @param {MyResponse} [response] MyResponse
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls MyMethod.
|
||||
* @function myMethod
|
||||
* @memberof MyService
|
||||
* @instance
|
||||
* @param {IMyRequest} request MyRequest message or plain object
|
||||
* @param {MyService.MyMethodCallback} callback Node-style callback called with the error, if any, and MyResponse
|
||||
* @returns {undefined}
|
||||
* @variation 1
|
||||
*/
|
||||
Object.defineProperty(MyService.prototype.myMethod = function myMethod(request, callback) {
|
||||
return this.rpcCall(myMethod, $root.MyRequest, $root.MyResponse, request, callback);
|
||||
}, "name", { value: "MyMethod" });
|
||||
|
||||
/**
|
||||
* Calls MyMethod.
|
||||
* @function myMethod
|
||||
* @memberof MyService
|
||||
* @instance
|
||||
* @param {IMyRequest} request MyRequest message or plain object
|
||||
* @returns {Promise<MyResponse>} Promise
|
||||
* @variation 2
|
||||
*/
|
||||
|
||||
return MyService;
|
||||
})();
|
||||
|
||||
$root.MyRequest = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a MyRequest.
|
||||
* @exports IMyRequest
|
||||
* @interface IMyRequest
|
||||
* @property {string|null} [path] MyRequest path
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new MyRequest.
|
||||
* @exports MyRequest
|
||||
* @classdesc Represents a MyRequest.
|
||||
* @implements IMyRequest
|
||||
* @constructor
|
||||
* @param {IMyRequest=} [properties] Properties to set
|
||||
*/
|
||||
function MyRequest(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* MyRequest path.
|
||||
* @member {string} path
|
||||
* @memberof MyRequest
|
||||
* @instance
|
||||
*/
|
||||
MyRequest.prototype.path = "";
|
||||
|
||||
/**
|
||||
* Creates a new MyRequest instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest=} [properties] Properties to set
|
||||
* @returns {MyRequest} MyRequest instance
|
||||
*/
|
||||
MyRequest.create = function create(properties) {
|
||||
return new MyRequest(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyRequest message. Does not implicitly {@link MyRequest.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest} message MyRequest message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyRequest.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.path);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyRequest message, length delimited. Does not implicitly {@link MyRequest.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {IMyRequest} message MyRequest message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyRequest.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyRequest message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {MyRequest} MyRequest
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyRequest.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.MyRequest();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.path = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyRequest message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {MyRequest} MyRequest
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyRequest.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a MyRequest message.
|
||||
* @function verify
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
MyRequest.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
if (!$util.isString(message.path))
|
||||
return "path: string expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a MyRequest message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {MyRequest} MyRequest
|
||||
*/
|
||||
MyRequest.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.MyRequest)
|
||||
return object;
|
||||
var message = new $root.MyRequest();
|
||||
if (object.path != null)
|
||||
message.path = String(object.path);
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a MyRequest message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof MyRequest
|
||||
* @static
|
||||
* @param {MyRequest} message MyRequest
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
MyRequest.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults)
|
||||
object.path = "";
|
||||
if (message.path != null && message.hasOwnProperty("path"))
|
||||
object.path = message.path;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this MyRequest to JSON.
|
||||
* @function toJSON
|
||||
* @memberof MyRequest
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
MyRequest.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return MyRequest;
|
||||
})();
|
||||
|
||||
$root.MyResponse = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a MyResponse.
|
||||
* @exports IMyResponse
|
||||
* @interface IMyResponse
|
||||
* @property {number|null} [status] MyResponse status
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new MyResponse.
|
||||
* @exports MyResponse
|
||||
* @classdesc Represents a MyResponse.
|
||||
* @implements IMyResponse
|
||||
* @constructor
|
||||
* @param {IMyResponse=} [properties] Properties to set
|
||||
*/
|
||||
function MyResponse(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* MyResponse status.
|
||||
* @member {number} status
|
||||
* @memberof MyResponse
|
||||
* @instance
|
||||
*/
|
||||
MyResponse.prototype.status = 0;
|
||||
|
||||
/**
|
||||
* Creates a new MyResponse instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse=} [properties] Properties to set
|
||||
* @returns {MyResponse} MyResponse instance
|
||||
*/
|
||||
MyResponse.create = function create(properties) {
|
||||
return new MyResponse(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyResponse message. Does not implicitly {@link MyResponse.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse} message MyResponse message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyResponse.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified MyResponse message, length delimited. Does not implicitly {@link MyResponse.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {IMyResponse} message MyResponse message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
MyResponse.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyResponse message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {MyResponse} MyResponse
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyResponse.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.MyResponse();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2:
|
||||
message.status = reader.int32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a MyResponse message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {MyResponse} MyResponse
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
MyResponse.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a MyResponse message.
|
||||
* @function verify
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
MyResponse.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
if (!$util.isInteger(message.status))
|
||||
return "status: integer expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a MyResponse message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {MyResponse} MyResponse
|
||||
*/
|
||||
MyResponse.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.MyResponse)
|
||||
return object;
|
||||
var message = new $root.MyResponse();
|
||||
if (object.status != null)
|
||||
message.status = object.status | 0;
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a MyResponse message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof MyResponse
|
||||
* @static
|
||||
* @param {MyResponse} message MyResponse
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
MyResponse.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults)
|
||||
object.status = 0;
|
||||
if (message.status != null && message.hasOwnProperty("status"))
|
||||
object.status = message.status;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this MyResponse to JSON.
|
||||
* @function toJSON
|
||||
* @memberof MyResponse
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
MyResponse.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return MyResponse;
|
||||
})();
|
||||
|
||||
module.exports = $root;
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
service MyService {
|
||||
rpc MyMethod (MyRequest) returns (MyResponse);
|
||||
}
|
||||
|
||||
message MyRequest {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message MyResponse {
|
||||
int32 status = 2;
|
||||
}
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
import * as test from "./rpc.js";
|
||||
+1443
File diff suppressed because it is too large
Load Diff
Executable
+15927
File diff suppressed because it is too large
Load Diff
Executable
+19
@@ -0,0 +1,19 @@
|
||||
import * as protobuf from "../..";
|
||||
import * as test from "./test";
|
||||
|
||||
// should encode an object implementing the interface
|
||||
let mInterface: test.jspb.test.ISimple1 = { aString: "a-string", aRepeatedString: [ "a", "repeated", "string" ], aBoolean: true };
|
||||
let mInterfaceWriter: protobuf.Writer = test.jspb.test.Simple1.encode(mInterface);
|
||||
|
||||
// should encode a message
|
||||
let mMessage: test.jspb.test.Simple1 = test.jspb.test.Simple1.create(mInterface);
|
||||
let mMessageWritter: protobuf.Writer = test.jspb.test.Simple1.encode(mMessage);
|
||||
|
||||
// should allow to assign a message to an interface
|
||||
mInterface = mMessage;
|
||||
|
||||
// should not allow to assign an interface to a message
|
||||
// mMessage = mInterface;
|
||||
|
||||
// should always decode to a message, not an interface
|
||||
let dMessage: test.jspb.test.Simple1 = test.jspb.test.Simple1.decode(mInterfaceWriter.finish());
|
||||
Executable
+1517
File diff suppressed because it is too large
Load Diff
Executable
+270
@@ -0,0 +1,270 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Author: [email protected] (Mark Rawling)
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
option java_package = "com.google.apps.jspb.proto";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
package jspb.test;
|
||||
|
||||
message Empty {
|
||||
}
|
||||
|
||||
enum OuterEnum {
|
||||
FOO = 1;
|
||||
BAR = 2;
|
||||
}
|
||||
|
||||
message EnumContainer {
|
||||
optional OuterEnum outer_enum = 1;
|
||||
}
|
||||
|
||||
message Simple1 {
|
||||
required string a_string = 1;
|
||||
repeated string a_repeated_string = 2;
|
||||
optional bool a_boolean = 3;
|
||||
}
|
||||
|
||||
// A message that differs from Simple1 only by name
|
||||
message Simple2 {
|
||||
required string a_string = 1;
|
||||
repeated string a_repeated_string = 2;
|
||||
}
|
||||
|
||||
message SpecialCases {
|
||||
required string normal = 1;
|
||||
// Examples of Js reserved names that are converted to pb_<name>.
|
||||
required string default = 2;
|
||||
required string function = 3;
|
||||
required string var = 4;
|
||||
}
|
||||
|
||||
message OptionalFields {
|
||||
message Nested {
|
||||
optional int32 an_int = 1;
|
||||
}
|
||||
optional string a_string = 1;
|
||||
required bool a_bool = 2;
|
||||
optional Nested a_nested_message = 3;
|
||||
repeated Nested a_repeated_message = 4;
|
||||
repeated string a_repeated_string = 5;
|
||||
}
|
||||
|
||||
message HasExtensions {
|
||||
optional string str1 = 1;
|
||||
optional string str2 = 2;
|
||||
optional string str3 = 3;
|
||||
extensions 10 to max;
|
||||
}
|
||||
|
||||
message Complex {
|
||||
message Nested {
|
||||
required int32 an_int = 2;
|
||||
}
|
||||
required string a_string = 1;
|
||||
required bool an_out_of_order_bool = 9;
|
||||
optional Nested a_nested_message = 4;
|
||||
repeated Nested a_repeated_message = 5;
|
||||
repeated string a_repeated_string = 7;
|
||||
}
|
||||
|
||||
message OuterMessage {
|
||||
// Make sure this doesn't conflict with the other Complex message.
|
||||
message Complex {
|
||||
optional int32 inner_complex_field = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message IsExtension {
|
||||
extend HasExtensions {
|
||||
optional IsExtension ext_field = 100;
|
||||
}
|
||||
optional string ext1 = 1;
|
||||
|
||||
// Extensions of proto2 Descriptor messages will be ignored.
|
||||
extend google.protobuf.EnumOptions {
|
||||
optional string simple_option = 42113038;
|
||||
}
|
||||
}
|
||||
|
||||
message IndirectExtension {
|
||||
extend HasExtensions {
|
||||
optional Simple1 simple = 101;
|
||||
optional string str = 102;
|
||||
repeated string repeated_str = 103;
|
||||
repeated Simple1 repeated_simple = 104;
|
||||
}
|
||||
}
|
||||
|
||||
extend HasExtensions {
|
||||
optional Simple1 simple1 = 105;
|
||||
}
|
||||
|
||||
message DefaultValues {
|
||||
enum Enum {
|
||||
E1 = 13;
|
||||
E2 = 77;
|
||||
}
|
||||
optional string string_field = 1 [default="default<>\'\"abc"];
|
||||
optional bool bool_field = 2 [default=true];
|
||||
optional int64 int_field = 3 [default=11];
|
||||
optional Enum enum_field = 4 [default=E1];
|
||||
optional string empty_field = 6 [default=""];
|
||||
optional bytes bytes_field = 8 [default="moo"]; // Base64 encoding is "bW9v"
|
||||
}
|
||||
|
||||
message FloatingPointFields {
|
||||
optional float optional_float_field = 1;
|
||||
required float required_float_field = 2;
|
||||
repeated float repeated_float_field = 3;
|
||||
optional float default_float_field = 4 [default = 2.0];
|
||||
optional double optional_double_field = 5;
|
||||
required double required_double_field = 6;
|
||||
repeated double repeated_double_field = 7;
|
||||
optional double default_double_field = 8 [default = 2.0];
|
||||
}
|
||||
|
||||
message TestClone {
|
||||
optional string str = 1;
|
||||
optional Simple1 simple1 = 3;
|
||||
repeated Simple1 simple2 = 5;
|
||||
optional bytes bytes_field = 6;
|
||||
optional string unused = 7;
|
||||
extensions 10 to max;
|
||||
}
|
||||
|
||||
message CloneExtension {
|
||||
extend TestClone {
|
||||
optional CloneExtension ext_field = 100;
|
||||
}
|
||||
optional string ext = 2;
|
||||
}
|
||||
|
||||
message TestGroup {
|
||||
repeated group RepeatedGroup = 1 {
|
||||
required string id = 1;
|
||||
repeated bool some_bool = 2;
|
||||
}
|
||||
required group RequiredGroup = 2 {
|
||||
required string id = 1;
|
||||
}
|
||||
optional group OptionalGroup = 3 {
|
||||
required string id = 1;
|
||||
}
|
||||
optional string id = 4;
|
||||
required Simple2 required_simple = 5;
|
||||
optional Simple2 optional_simple = 6;
|
||||
}
|
||||
|
||||
message TestGroup1 {
|
||||
optional TestGroup.RepeatedGroup group = 1;
|
||||
}
|
||||
|
||||
message TestReservedNames {
|
||||
optional int32 extension = 1;
|
||||
extensions 10 to max;
|
||||
}
|
||||
|
||||
message TestReservedNamesExtension {
|
||||
extend TestReservedNames {
|
||||
optional int32 foo = 10;
|
||||
}
|
||||
}
|
||||
|
||||
message TestMessageWithOneof {
|
||||
|
||||
oneof partial_oneof {
|
||||
string pone = 3;
|
||||
string pthree = 5;
|
||||
}
|
||||
|
||||
oneof recursive_oneof {
|
||||
TestMessageWithOneof rone = 6;
|
||||
string rtwo = 7;
|
||||
}
|
||||
|
||||
optional bool normal_field = 8;
|
||||
repeated string repeated_field = 9;
|
||||
|
||||
oneof default_oneof_a {
|
||||
int32 aone = 10 [default = 1234];
|
||||
int32 atwo = 11;
|
||||
}
|
||||
|
||||
oneof default_oneof_b {
|
||||
int32 bone = 12;
|
||||
int32 btwo = 13 [default = 1234];
|
||||
}
|
||||
}
|
||||
|
||||
message TestEndsWithBytes {
|
||||
optional int32 value = 1;
|
||||
optional bytes data = 2;
|
||||
}
|
||||
|
||||
message TestMapFieldsNoBinary {
|
||||
map<string, string> map_string_string = 1;
|
||||
map<string, int32> map_string_int32 = 2;
|
||||
map<string, int64> map_string_int64 = 3;
|
||||
map<string, bool> map_string_bool = 4;
|
||||
map<string, double> map_string_double = 5;
|
||||
map<string, MapValueEnumNoBinary> map_string_enum = 6;
|
||||
map<string, MapValueMessageNoBinary> map_string_msg = 7;
|
||||
|
||||
map<int32, string> map_int32_string = 8;
|
||||
map<int64, string> map_int64_string = 9;
|
||||
map<bool, string> map_bool_string = 10;
|
||||
|
||||
optional TestMapFieldsNoBinary test_map_fields = 11;
|
||||
map<string, TestMapFieldsNoBinary> map_string_testmapfields = 12;
|
||||
}
|
||||
|
||||
enum MapValueEnumNoBinary {
|
||||
MAP_VALUE_FOO_NOBINARY = 0;
|
||||
MAP_VALUE_BAR_NOBINARY = 1;
|
||||
MAP_VALUE_BAZ_NOBINARY = 2;
|
||||
}
|
||||
|
||||
message MapValueMessageNoBinary {
|
||||
optional int32 foo = 1;
|
||||
}
|
||||
|
||||
message Deeply {
|
||||
message Nested {
|
||||
message Message {
|
||||
optional int32 count = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package uncommon;
|
||||
|
||||
import public 'common.proto';
|
||||
|
||||
syntax = 'proto3';
|
||||
|
||||
option java_package = 'com.google.protobuf';
|
||||
|
||||
message Test;
|
||||
|
||||
message Test2 {
|
||||
float hex = 0x1 [default=0x1];
|
||||
float oct = 02 [default=02];
|
||||
float zero = 3 [default=0];
|
||||
float inf = 4 [default=inf];
|
||||
float nan = 5 [default=nan];
|
||||
|
||||
/** pre */
|
||||
repeated group lower = 6 {}; /// post
|
||||
|
||||
/** pre */
|
||||
map<string,string> ambiguousComments = 7; /// post
|
||||
|
||||
string str = 8 {
|
||||
option default = "a";
|
||||
}
|
||||
|
||||
map<string,string> strmap = 9 {
|
||||
option (custom) = "";
|
||||
};
|
||||
|
||||
map<uint64,Test> longmap = 10;
|
||||
|
||||
/** pre */
|
||||
oneof kind;
|
||||
oneof kind2; /// post
|
||||
|
||||
/** pre */
|
||||
oneof kind3 {
|
||||
option (custom) = ""; /// post
|
||||
};
|
||||
|
||||
option (custom) = -42;
|
||||
|
||||
extend Test;
|
||||
extend Test{};
|
||||
extend Test{required int32 a=1;} // not validated by the parser
|
||||
};
|
||||
|
||||
enum Test3;
|
||||
|
||||
enum Test4{
|
||||
option (custom).foo = "";
|
||||
ONE = 1 [foo="bar"];
|
||||
TWO = 2 [(my_options) = { a: "foo" b { c: "bar" } }];
|
||||
THREE = 3 {
|
||||
option (custom).bar = "";
|
||||
};
|
||||
};
|
||||
|
||||
enum Test4_1{
|
||||
OPTION = 1;
|
||||
}
|
||||
|
||||
service Test5;
|
||||
|
||||
service Test6 { option (custom).bar = "";
|
||||
message DoSomethingRequest;
|
||||
message DoSomethingResponse;
|
||||
|
||||
rpc DoSomething(stream DoSomethingRequest) returns (stream DoSomethingResponse){ option (custom).foo2 = ""; };
|
||||
/** pre */
|
||||
rpc DoSomethingElse( stream DoSomethingRequest ) returns (DoSomethingResponse); /// post
|
||||
rpc DoSomethingEntirelyDifferent(DoSomethingRequest ) returns ( stream DoSomethingResponse ); /// post
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
import weak "NOT_FOUND2";
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
import "google/protobuf/any.proto";
|
||||
import weak "NOT_FOUND";
|
||||
import "weak-other.proto";
|
||||
Reference in New Issue
Block a user