From 961dd03061fc2c43ab3bf22b3f9f5165504c1002 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Fri, 30 Dec 2016 16:42:29 +0100 Subject: [PATCH] Other: Removed unused sandbox files --- tests/sandbox/sample.d.ts | 519 ---------------- tests/sandbox/sample.js | 1153 ------------------------------------ tests/sandbox/sample.proto | 52 -- 3 files changed, 1724 deletions(-) delete mode 100644 tests/sandbox/sample.d.ts delete mode 100644 tests/sandbox/sample.js delete mode 100644 tests/sandbox/sample.proto diff --git a/tests/sandbox/sample.d.ts b/tests/sandbox/sample.d.ts deleted file mode 100644 index 5561649ab..000000000 --- a/tests/sandbox/sample.d.ts +++ /dev/null @@ -1,519 +0,0 @@ -// $> pbts tests\sandbox\sample.js -// Generated Sun, 18 Dec 2016 15:44:01 UTC -/** - * Constructs a new Request. - * @exports Request - * @constructor - * @param {Object} [properties] Properties to set - */ -declare class Request { - - /** - * Constructs a new Request. - * @exports Request - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Request action. - * @name Request#action - * @type {number} - */ - action: number; - - /** - * Request target. - * @name Request#target - * @type {Array.} - */ - target: string[]; - - /** - * Request source. - * @name Request#source - * @type {string} - */ - source: string; - - /** - * Request require. - * @name Request#require - * @type {Array.} - */ - require: Dict[]; - - /** - * Request sort. - * @name Request#sort - * @type {Array.} - */ - sort: Sort[]; - - /** - * Request limit. - * @name Request#limit - * @type {number} - */ - limit: number; - - /** - * Request offset. - * @name Request#offset - * @type {number|Long} - */ - offset: (number|Long); - - /** - * Request args. - * @name Request#args - * @type {google.protobuf.Any} - */ - args: google.protobuf.Any; - - /** - * Request content. - * @name Request#content - * @type {Array.} - */ - content: google.protobuf.Any[]; - - /** - * Encodes the specified Request. - * @function - * @param {Request|Object} message Request or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encode(message: (Request|Object), writer?: Writer): Writer; - - /** - * Encodes the specified Request, length delimited. - * @param {Request|Object} message Request or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encodeDelimited(message: (Request|Object), writer?: Writer): Writer; - - /** - * Decodes a Request from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {Request} Request - */ - static decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Request; - - /** - * Decodes a Request from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Request} Request - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Request; - - /** - * Verifies a Request. - * @function - * @param {Request|Object} message Request or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (Request|Object)): string; -} - -/** - * Constructs a new Response. - * @exports Response - * @constructor - * @param {Object} [properties] Properties to set - */ -declare class Response { - - /** - * Constructs a new Response. - * @exports Response - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Response code. - * @name Response#code - * @type {number} - */ - code: number; - - /** - * Response msg. - * @name Response#msg - * @type {string} - */ - msg: string; - - /** - * Response result. - * @name Response#result - * @type {google.protobuf.Any} - */ - result: google.protobuf.Any; - - /** - * Response content. - * @name Response#content - * @type {Array.} - */ - content: google.protobuf.Any[]; - - /** - * Encodes the specified Response. - * @function - * @param {Response|Object} message Response or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encode(message: (Response|Object), writer?: Writer): Writer; - - /** - * Encodes the specified Response, length delimited. - * @param {Response|Object} message Response or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encodeDelimited(message: (Response|Object), writer?: Writer): Writer; - - /** - * Decodes a Response from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {Response} Response - */ - static decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Response; - - /** - * Decodes a Response from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Response} Response - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Response; - - /** - * Verifies a Response. - * @function - * @param {Response|Object} message Response or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (Response|Object)): string; -} - -/** - * Constructs a new Dict. - * @exports Dict - * @constructor - * @param {Object} [properties] Properties to set - */ -declare class Dict { - - /** - * Constructs a new Dict. - * @exports Dict - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Dict key. - * @name Dict#key - * @type {string} - */ - key: string; - - /** - * Dict value. - * @name Dict#value - * @type {string} - */ - value: string; - - /** - * Dict compare. - * @name Dict#compare - * @type {number} - */ - compare: number; - - /** - * Encodes the specified Dict. - * @function - * @param {Dict|Object} message Dict or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encode(message: (Dict|Object), writer?: Writer): Writer; - - /** - * Encodes the specified Dict, length delimited. - * @param {Dict|Object} message Dict or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encodeDelimited(message: (Dict|Object), writer?: Writer): Writer; - - /** - * Decodes a Dict from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {Dict} Dict - */ - static decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Dict; - - /** - * Decodes a Dict from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Dict} Dict - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Dict; - - /** - * Verifies a Dict. - * @function - * @param {Dict|Object} message Dict or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (Dict|Object)): string; -} - -/** - * Constructs a new Sort. - * @exports Sort - * @constructor - * @param {Object} [properties] Properties to set - */ -declare class Sort { - - /** - * Constructs a new Sort. - * @exports Sort - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Sort column. - * @name Sort#column - * @type {string} - */ - column: string; - - /** - * Sort orderBy. - * @name Sort#orderBy - * @type {number} - */ - orderBy: number; - - /** - * Encodes the specified Sort. - * @function - * @param {Sort|Object} message Sort or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encode(message: (Sort|Object), writer?: Writer): Writer; - - /** - * Encodes the specified Sort, length delimited. - * @param {Sort|Object} message Sort or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encodeDelimited(message: (Sort|Object), writer?: Writer): Writer; - - /** - * Decodes a Sort from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {Sort} Sort - */ - static decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Sort; - - /** - * Decodes a Sort from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Sort} Sort - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Sort; - - /** - * Verifies a Sort. - * @function - * @param {Sort|Object} message Sort or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (Sort|Object)): string; -} - -/** - * Constructs a new Arg. - * @exports Arg - * @constructor - * @param {Object} [properties] Properties to set - */ -declare class Arg { - - /** - * Constructs a new Arg. - * @exports Arg - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Arg text. - * @name Arg#text - * @type {Array.} - */ - text: string[]; - - /** - * Arg obj. - * @name Arg#obj - * @type {Array.} - */ - obj: google.protobuf.Any[]; - - /** - * Encodes the specified Arg. - * @function - * @param {Arg|Object} message Arg or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encode(message: (Arg|Object), writer?: Writer): Writer; - - /** - * Encodes the specified Arg, length delimited. - * @param {Arg|Object} message Arg or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encodeDelimited(message: (Arg|Object), writer?: Writer): Writer; - - /** - * Decodes a Arg from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {Arg} Arg - */ - static decode(readerOrBuffer: (Reader|Uint8Array), length?: number): Arg; - - /** - * Decodes a Arg from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Arg} Arg - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): Arg; - - /** - * Verifies a Arg. - * @function - * @param {Arg|Object} message Arg or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (Arg|Object)): string; -} - -/** - * Namespace google. - * @exports google - * @namespace - */ -declare module google { - - /** - * Namespace protobuf. - * @exports google.protobuf - * @namespace - */ - module protobuf { - - /** - * Constructs a new Any. - * @exports google.protobuf.Any - * @constructor - * @param {Object} [properties] Properties to set - */ - class Any { - - /** - * Constructs a new Any. - * @exports google.protobuf.Any - * @constructor - * @param {Object} [properties] Properties to set - */ - constructor(properties?: Object); - - /** - * Any type_url. - * @name google.protobuf.Any#type_url - * @type {string} - */ - type_url: string; - - /** - * Any value. - * @name google.protobuf.Any#value - * @type {Uint8Array} - */ - value: Uint8Array; - - /** - * Encodes the specified Any. - * @function - * @param {google.protobuf.Any|Object} message Any or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encode(message: (google.protobuf.Any|Object), writer?: Writer): Writer; - - /** - * Encodes the specified Any, length delimited. - * @param {google.protobuf.Any|Object} message Any or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - static encodeDelimited(message: (google.protobuf.Any|Object), writer?: Writer): Writer; - - /** - * Decodes a Any from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Any} Any - */ - static decode(readerOrBuffer: (Reader|Uint8Array), length?: number): google.protobuf.Any; - - /** - * Decodes a Any from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.Any} Any - */ - static decodeDelimited(readerOrBuffer: (Reader|Uint8Array)): google.protobuf.Any; - - /** - * Verifies a Any. - * @function - * @param {google.protobuf.Any|Object} message Any or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - static verify(message: (google.protobuf.Any|Object)): string; - } - } -} diff --git a/tests/sandbox/sample.js b/tests/sandbox/sample.js deleted file mode 100644 index def18ad49..000000000 --- a/tests/sandbox/sample.js +++ /dev/null @@ -1,1153 +0,0 @@ -(function(global, factory) { - /* eslint-disable no-undef */ - - /* AMD */ if (typeof define === 'function' && define.amd) - define(["protobuf"], factory); - - /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("protobufjs/runtime")); - - /* eslint-enable no-undef */ -})(this, function($protobuf) { - "use strict"; // eslint-disable-line strict - - // Lazily resolved type references - var $lazyTypes = []; - - // Exported root namespace - var $root = {}; - - /** @alias Request */ - $root.Request = (function() { - - /** - * Constructs a new Request. - * @exports Request - * @constructor - * @param {Object} [properties] Properties to set - */ - function Request(properties) { - if (properties) { - var keys = Object.keys(properties); - for (var i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; - } - } - - /** @alias Request.prototype */ - var $prototype = Request.prototype; - - /** - * Request action. - * @name Request#action - * @type {number} - */ - $prototype["action"] = 0; - - /** - * Request target. - * @name Request#target - * @type {Array.} - */ - $prototype["target"] = $protobuf.util.emptyArray; - - /** - * Request source. - * @name Request#source - * @type {string} - */ - $prototype["source"] = ""; - - /** - * Request require. - * @name Request#require - * @type {Array.} - */ - $prototype["require"] = $protobuf.util.emptyArray; - - /** - * Request sort. - * @name Request#sort - * @type {Array.} - */ - $prototype["sort"] = $protobuf.util.emptyArray; - - /** - * Request limit. - * @name Request#limit - * @type {number} - */ - $prototype["limit"] = 0; - - /** - * Request offset. - * @name Request#offset - * @type {number|Long} - */ - $prototype["offset"] = $protobuf.util.emptyObject; - - /** - * Request args. - * @name Request#args - * @type {google.protobuf.Any} - */ - $prototype["args"] = null; - - /** - * Request content. - * @name Request#content - * @type {Array.} - */ - $prototype["content"] = $protobuf.util.emptyArray; - - /** - * Encodes the specified Request. - * @function - * @param {Request|Object} message Request or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - Request.encode = (function() { - /* eslint-disable */ - var Writer = $protobuf.Writer; - var util = $protobuf.util; - var types; $lazyTypes.push(types = ["Request.Action",null,null,"Dict","Sort",null,null,"google.protobuf.Any","google.protobuf.Any"]); - return function encode(m, w) { - w||(w=Writer.create()) - if(m["action"]!==undefined&&m["action"]!==0) - w.uint32(8).uint32(m["action"]) - if(m["target"]) - for(var i=0;i>>3){ - case 1: - m["action"]=r.uint32() - break - case 2: - m["target"]&&m["target"].length?m["target"]:m["target"]=[] - m["target"].push(r.string()) - break - case 3: - m["source"]=r.string() - break - case 4: - m["require"]&&m["require"].length?m["require"]:m["require"]=[] - m["require"].push(types[3].decode(r,r.uint32())) - break - case 5: - m["sort"]&&m["sort"].length?m["sort"]:m["sort"]=[] - m["sort"].push(types[4].decode(r,r.uint32())) - break - case 6: - m["limit"]=r.int32() - break - case 7: - m["offset"]=r.int64() - break - case 8: - m["args"]=types[7].decode(r,r.uint32()) - break - case 9: - m["content"]&&m["content"].length?m["content"]:m["content"]=[] - m["content"].push(types[8].decode(r,r.uint32())) - break - default: - r.skipType(t&7) - break - } - } - return m - } - /* eslint-enable */ - })(); - - /** - * Decodes a Request from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Request} Request - */ - Request.decodeDelimited = function decodeDelimited(readerOrBuffer) { - readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); - return this.decode(readerOrBuffer, readerOrBuffer.uint32()); - }; - - /** - * Verifies a Request. - * @function - * @param {Request|Object} message Request or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - Request.verify = (function() { - /* eslint-disable */ - var util = $protobuf.util; - var types; $lazyTypes.push(types = ["Request.Action",null,null,"Dict","Sort",null,null,"google.protobuf.Any","google.protobuf.Any"]); - return function verify(m) { - if(m["action"]!==undefined){ - switch(m["action"]){ - default: - return"invalid value for field .Request.action (enum value expected)" - case 0: - case 1: - case 2: - case 3: - break - } - } - if(m["target"]!==undefined){ - if(!Array.isArray(m["target"])) - return"invalid value for field .Request.target (array expected)" - for(var i=0;i} - */ - Request.Action = { - - SELECT: 0, - INSERT: 1, - UPDATE: 2, - DELETE: 3 - }; - - return Request; - })(); - - /** @alias Response */ - $root.Response = (function() { - - /** - * Constructs a new Response. - * @exports Response - * @constructor - * @param {Object} [properties] Properties to set - */ - function Response(properties) { - if (properties) { - var keys = Object.keys(properties); - for (var i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; - } - } - - /** @alias Response.prototype */ - var $prototype = Response.prototype; - - /** - * Response code. - * @name Response#code - * @type {number} - */ - $prototype["code"] = 0; - - /** - * Response msg. - * @name Response#msg - * @type {string} - */ - $prototype["msg"] = ""; - - /** - * Response result. - * @name Response#result - * @type {google.protobuf.Any} - */ - $prototype["result"] = null; - - /** - * Response content. - * @name Response#content - * @type {Array.} - */ - $prototype["content"] = $protobuf.util.emptyArray; - - /** - * Encodes the specified Response. - * @function - * @param {Response|Object} message Response or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - Response.encode = (function() { - /* eslint-disable */ - var Writer = $protobuf.Writer; - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,null,"google.protobuf.Any","google.protobuf.Any"]); - return function encode(m, w) { - w||(w=Writer.create()) - if(m["code"]!==undefined&&m["code"]!==0) - w.uint32(8).int32(m["code"]) - if(m["msg"]!==undefined&&m["msg"]!=="") - w.uint32(18).string(m["msg"]) - if(m["result"]!==undefined&&m["result"]!==null) - types[2].encode(m["result"],w.fork()).len&&w.ldelim(4)||w.reset() - if(m["content"]) - for(var i=0;i>>3){ - case 1: - m["code"]=r.int32() - break - case 2: - m["msg"]=r.string() - break - case 4: - m["result"]=types[2].decode(r,r.uint32()) - break - case 3: - m["content"]&&m["content"].length?m["content"]:m["content"]=[] - m["content"].push(types[3].decode(r,r.uint32())) - break - default: - r.skipType(t&7) - break - } - } - return m - } - /* eslint-enable */ - })(); - - /** - * Decodes a Response from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Response} Response - */ - Response.decodeDelimited = function decodeDelimited(readerOrBuffer) { - readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); - return this.decode(readerOrBuffer, readerOrBuffer.uint32()); - }; - - /** - * Verifies a Response. - * @function - * @param {Response|Object} message Response or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - Response.verify = (function() { - /* eslint-disable */ - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,null,"google.protobuf.Any","google.protobuf.Any"]); - return function verify(m) { - if(m["code"]!==undefined){ - if(!util.isInteger(m["code"])) - return"invalid value for field .Response.code (integer expected)" - } - if(m["msg"]!==undefined){ - if(!util.isString(m["msg"])) - return"invalid value for field .Response.msg (string expected)" - } - if(m["result"]!==undefined&&m["result"]!==null){ - var r; - if(r=types[2].verify(m["result"])) - return r - } - if(m["content"]!==undefined){ - if(!Array.isArray(m["content"])) - return"invalid value for field .Response.content (array expected)" - for(var i=0;i>>3){ - case 1: - m["key"]=r.string() - break - case 2: - m["value"]=r.string() - break - case 3: - m["compare"]=r.uint32() - break - default: - r.skipType(t&7) - break - } - } - return m - } - /* eslint-enable */ - })(); - - /** - * Decodes a Dict from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Dict} Dict - */ - Dict.decodeDelimited = function decodeDelimited(readerOrBuffer) { - readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); - return this.decode(readerOrBuffer, readerOrBuffer.uint32()); - }; - - /** - * Verifies a Dict. - * @function - * @param {Dict|Object} message Dict or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - Dict.verify = (function() { - /* eslint-disable */ - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,null,"Dict.Compare"]); - return function verify(m) { - if(m["key"]!==undefined){ - if(!util.isString(m["key"])) - return"invalid value for field .Dict.key (string expected)" - } - if(m["value"]!==undefined){ - if(!util.isString(m["value"])) - return"invalid value for field .Dict.value (string expected)" - } - if(m["compare"]!==undefined){ - switch(m["compare"]){ - default: - return"invalid value for field .Dict.compare (enum value expected)" - case 0: - case 1: - case 2: - break - } - } - return null - } - /* eslint-enable */ - })(); - - /** - * Compare values. - * @exports Dict.Compare - * @type {Object.} - */ - Dict.Compare = { - - LT: 0, - EQ: 1, - GT: 2 - }; - - return Dict; - })(); - - /** @alias Sort */ - $root.Sort = (function() { - - /** - * Constructs a new Sort. - * @exports Sort - * @constructor - * @param {Object} [properties] Properties to set - */ - function Sort(properties) { - if (properties) { - var keys = Object.keys(properties); - for (var i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; - } - } - - /** @alias Sort.prototype */ - var $prototype = Sort.prototype; - - /** - * Sort column. - * @name Sort#column - * @type {string} - */ - $prototype["column"] = ""; - - /** - * Sort orderBy. - * @name Sort#orderBy - * @type {number} - */ - $prototype["orderBy"] = 0; - - /** - * Encodes the specified Sort. - * @function - * @param {Sort|Object} message Sort or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - Sort.encode = (function() { - /* eslint-disable */ - var Writer = $protobuf.Writer; - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,"Sort.OrderBy"]); - return function encode(m, w) { - w||(w=Writer.create()) - if(m["column"]!==undefined&&m["column"]!=="") - w.uint32(10).string(m["column"]) - if(m["orderBy"]!==undefined&&m["orderBy"]!==0) - w.uint32(16).uint32(m["orderBy"]) - return w - } - /* eslint-enable */ - })(); - - /** - * Encodes the specified Sort, length delimited. - * @param {Sort|Object} message Sort or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - Sort.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Sort from the specified reader or buffer. - * @function - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {Sort} Sort - */ - Sort.decode = (function() { - /* eslint-disable */ - var Reader = $protobuf.Reader; - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,"Sort.OrderBy"]); - return function decode(r, l) { - r instanceof Reader||(r=Reader.create(r)) - var c=l===undefined?r.len:r.pos+l,m=new $root.Sort - while(r.pos>>3){ - case 1: - m["column"]=r.string() - break - case 2: - m["orderBy"]=r.uint32() - break - default: - r.skipType(t&7) - break - } - } - return m - } - /* eslint-enable */ - })(); - - /** - * Decodes a Sort from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Sort} Sort - */ - Sort.decodeDelimited = function decodeDelimited(readerOrBuffer) { - readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); - return this.decode(readerOrBuffer, readerOrBuffer.uint32()); - }; - - /** - * Verifies a Sort. - * @function - * @param {Sort|Object} message Sort or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - Sort.verify = (function() { - /* eslint-disable */ - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,"Sort.OrderBy"]); - return function verify(m) { - if(m["column"]!==undefined){ - if(!util.isString(m["column"])) - return"invalid value for field .Sort.column (string expected)" - } - if(m["orderBy"]!==undefined){ - switch(m["orderBy"]){ - default: - return"invalid value for field .Sort.orderBy (enum value expected)" - case 0: - case 1: - break - } - } - return null - } - /* eslint-enable */ - })(); - - /** - * OrderBy values. - * @exports Sort.OrderBy - * @type {Object.} - */ - Sort.OrderBy = { - - ASC: 0, - DESC: 1 - }; - - return Sort; - })(); - - /** @alias Arg */ - $root.Arg = (function() { - - /** - * Constructs a new Arg. - * @exports Arg - * @constructor - * @param {Object} [properties] Properties to set - */ - function Arg(properties) { - if (properties) { - var keys = Object.keys(properties); - for (var i = 0; i < keys.length; ++i) - this[keys[i]] = properties[keys[i]]; - } - } - - /** @alias Arg.prototype */ - var $prototype = Arg.prototype; - - /** - * Arg text. - * @name Arg#text - * @type {Array.} - */ - $prototype["text"] = $protobuf.util.emptyArray; - - /** - * Arg obj. - * @name Arg#obj - * @type {Array.} - */ - $prototype["obj"] = $protobuf.util.emptyArray; - - /** - * Encodes the specified Arg. - * @function - * @param {Arg|Object} message Arg or plain object to encode - * @param {Writer} [writer] Writer to encode to - * @returns {Writer} Writer - */ - Arg.encode = (function() { - /* eslint-disable */ - var Writer = $protobuf.Writer; - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,"google.protobuf.Any"]); - return function encode(m, w) { - w||(w=Writer.create()) - if(m["text"]) - for(var i=0;i>>3){ - case 1: - m["text"]&&m["text"].length?m["text"]:m["text"]=[] - m["text"].push(r.string()) - break - case 2: - m["obj"]&&m["obj"].length?m["obj"]:m["obj"]=[] - m["obj"].push(types[1].decode(r,r.uint32())) - break - default: - r.skipType(t&7) - break - } - } - return m - } - /* eslint-enable */ - })(); - - /** - * Decodes a Arg from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {Arg} Arg - */ - Arg.decodeDelimited = function decodeDelimited(readerOrBuffer) { - readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); - return this.decode(readerOrBuffer, readerOrBuffer.uint32()); - }; - - /** - * Verifies a Arg. - * @function - * @param {Arg|Object} message Arg or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - Arg.verify = (function() { - /* eslint-disable */ - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,"google.protobuf.Any"]); - return function verify(m) { - if(m["text"]!==undefined){ - if(!Array.isArray(m["text"])) - return"invalid value for field .Arg.text (array expected)" - for(var i=0;i>>3){ - case 1: - m["type_url"]=r.string() - break - case 2: - m["value"]=r.bytes() - break - default: - r.skipType(t&7) - break - } - } - return m - } - /* eslint-enable */ - })(); - - /** - * Decodes a Any from the specified reader or buffer, length delimited. - * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from - * @returns {google.protobuf.Any} Any - */ - Any.decodeDelimited = function decodeDelimited(readerOrBuffer) { - readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); - return this.decode(readerOrBuffer, readerOrBuffer.uint32()); - }; - - /** - * Verifies a Any. - * @function - * @param {google.protobuf.Any|Object} message Any or plain object to verify - * @returns {?string} `null` if valid, otherwise the reason why it is not - */ - Any.verify = (function() { - /* eslint-disable */ - var util = $protobuf.util; - var types; $lazyTypes.push(types = [null,null]); - return function verify(m) { - if(m["type_url"]!==undefined){ - if(!util.isString(m["type_url"])) - return"invalid value for field .google.protobuf.Any.type_url (string expected)" - } - if(m["value"]!==undefined){ - if(!(m["value"]&&typeof m["value"].length==="number"||util.isString(m["value"]))) - return"invalid value for field .google.protobuf.Any.value (buffer expected)" - } - return null - } - /* eslint-enable */ - })(); - - return Any; - })(); - - return protobuf; - })(); - - return google; - })(); - - // Resolve lazy types - $lazyTypes.forEach(function(types) { - types.forEach(function(path, i) { - if (!path) - return; - path = path.split('.'); - var ptr = $root; - while (path.length) - ptr = ptr[path.shift()]; - types[i] = ptr; - }); - }); - - $protobuf.roots["default"] = $root; - - return $root; -}); diff --git a/tests/sandbox/sample.proto b/tests/sandbox/sample.proto deleted file mode 100644 index 75fb8833a..000000000 --- a/tests/sandbox/sample.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/any.proto"; - -message Request { - enum Action { - SELECT = 0; - INSERT = 1; - UPDATE = 2; - DELETE = 3; - } - Action action = 1; - repeated string target = 2; - string source = 3; - repeated Dict require = 4; - repeated Sort sort = 5; - int32 limit = 6; - int64 offset = 7; - google.protobuf.Any args = 8; - repeated google.protobuf.Any content = 9; -} - -message Response { - int32 code = 1; - string msg = 2; - google.protobuf.Any result = 4; - repeated google.protobuf.Any content = 3; -} - -message Dict { - enum Compare { - LT = 0; - EQ = 1; - GT = 2; - } - string key = 1; - string value = 2; - Compare compare = 3; -} - -message Sort { - enum OrderBy { - ASC = 0; - DESC = 1; - } - string column = 1; - OrderBy orderBy = 2; -} - -message Arg { - repeated string text = 1; - repeated google.protobuf.Any obj = 2; -} \ No newline at end of file