Comparing version 1.4.5 to 1.4.6
@@ -13,3 +13,3 @@ import { Message, RpcMeta } from "./types"; | ||
reset(url?: string, options?: any): void; | ||
rpcCall<T, U>(meta: RpcMeta<any, any>, request: Message<T>): Promise<Message<U>>; | ||
rpcCall<T, U>(meta: RpcMeta, request: Message<T>): Promise<Message<U>>; | ||
} |
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/ | ||
"use strict"; | ||
var $protobuf = require("protobufjs/minimal"); | ||
var $protobuf = window.protobuf || require("protobufjs/minimal"); | ||
// Common aliases | ||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; | ||
var $Reader = $protobuf.Reader, | ||
$Writer = $protobuf.Writer, | ||
$util = $protobuf.util; | ||
@@ -13,1281 +15,1298 @@ // Exported root namespace | ||
$root.wsgrpc = (function() { | ||
/** | ||
* Namespace wsgrpc. | ||
* @exports wsgrpc | ||
* @namespace | ||
*/ | ||
var wsgrpc = {}; | ||
wsgrpc.DataFrame = (function() { | ||
/** | ||
* Namespace wsgrpc. | ||
* @exports wsgrpc | ||
* @namespace | ||
* Properties of a DataFrame. | ||
* @memberof wsgrpc | ||
* @interface IDataFrame | ||
* @property {number} streamId DataFrame streamId | ||
* @property {boolean} endStream DataFrame endStream | ||
* @property {wsgrpc.DataFrame.Types} type DataFrame type | ||
* @property {wsgrpc.DataFrame.IHeaders|null} [headers] DataFrame headers | ||
* @property {wsgrpc.DataFrame.ITrailers|null} [trailers] DataFrame trailers | ||
* @property {Uint8Array|null} [message] DataFrame message | ||
*/ | ||
var wsgrpc = {}; | ||
wsgrpc.DataFrame = (function() { | ||
/** | ||
* Constructs a new DataFrame. | ||
* @memberof wsgrpc | ||
* @classdesc Represents a DataFrame. | ||
* @implements IDataFrame | ||
* @constructor | ||
* @param {wsgrpc.IDataFrame=} [properties] Properties to set | ||
*/ | ||
function DataFrame(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]]; | ||
} | ||
/** | ||
* Properties of a DataFrame. | ||
* @memberof wsgrpc | ||
* @interface IDataFrame | ||
* @property {number} streamId DataFrame streamId | ||
* @property {boolean} endStream DataFrame endStream | ||
* @property {wsgrpc.DataFrame.Types} type DataFrame type | ||
* @property {wsgrpc.DataFrame.IHeaders|null} [headers] DataFrame headers | ||
* @property {wsgrpc.DataFrame.ITrailers|null} [trailers] DataFrame trailers | ||
* @property {Uint8Array|null} [message] DataFrame message | ||
*/ | ||
/** | ||
* DataFrame streamId. | ||
* @member {number} streamId | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.streamId = 0; | ||
/** | ||
* Constructs a new DataFrame. | ||
* @memberof wsgrpc | ||
* @classdesc Represents a DataFrame. | ||
* @implements IDataFrame | ||
* @constructor | ||
* @param {wsgrpc.IDataFrame=} [properties] Properties to set | ||
*/ | ||
function DataFrame(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]]; | ||
} | ||
/** | ||
* DataFrame endStream. | ||
* @member {boolean} endStream | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.endStream = false; | ||
/** | ||
* DataFrame streamId. | ||
* @member {number} streamId | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.streamId = 0; | ||
/** | ||
* DataFrame type. | ||
* @member {wsgrpc.DataFrame.Types} type | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.type = 1; | ||
/** | ||
* DataFrame endStream. | ||
* @member {boolean} endStream | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.endStream = false; | ||
/** | ||
* DataFrame headers. | ||
* @member {wsgrpc.DataFrame.IHeaders|null|undefined} headers | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.headers = null; | ||
/** | ||
* DataFrame type. | ||
* @member {wsgrpc.DataFrame.Types} type | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.type = 1; | ||
/** | ||
* DataFrame trailers. | ||
* @member {wsgrpc.DataFrame.ITrailers|null|undefined} trailers | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.trailers = null; | ||
/** | ||
* DataFrame headers. | ||
* @member {wsgrpc.DataFrame.IHeaders|null|undefined} headers | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.headers = null; | ||
/** | ||
* DataFrame message. | ||
* @member {Uint8Array} message | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.message = $util.newBuffer([]); | ||
/** | ||
* DataFrame trailers. | ||
* @member {wsgrpc.DataFrame.ITrailers|null|undefined} trailers | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.trailers = null; | ||
/** | ||
* Creates a new DataFrame instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.IDataFrame=} [properties] Properties to set | ||
* @returns {wsgrpc.DataFrame} DataFrame instance | ||
*/ | ||
DataFrame.create = function create(properties) { | ||
return new DataFrame(properties); | ||
}; | ||
/** | ||
* DataFrame message. | ||
* @member {Uint8Array} message | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
*/ | ||
DataFrame.prototype.message = $util.newBuffer([]); | ||
/** | ||
* Encodes the specified DataFrame message. Does not implicitly {@link wsgrpc.DataFrame.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.IDataFrame} message DataFrame message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
DataFrame.encode = function encode(message, writer) { | ||
if (!writer) writer = $Writer.create(); | ||
writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.streamId); | ||
writer.uint32(/* id 2, wireType 0 =*/ 16).bool(message.endStream); | ||
writer.uint32(/* id 3, wireType 0 =*/ 24).int32(message.type); | ||
if (message.headers != null && message.hasOwnProperty("headers")) | ||
$root.wsgrpc.DataFrame.Headers.encode( | ||
message.headers, | ||
writer.uint32(/* id 4, wireType 2 =*/ 34).fork() | ||
).ldelim(); | ||
if (message.trailers != null && message.hasOwnProperty("trailers")) | ||
$root.wsgrpc.DataFrame.Trailers.encode( | ||
message.trailers, | ||
writer.uint32(/* id 5, wireType 2 =*/ 42).fork() | ||
).ldelim(); | ||
if (message.message != null && message.hasOwnProperty("message")) | ||
writer.uint32(/* id 6, wireType 2 =*/ 50).bytes(message.message); | ||
return writer; | ||
}; | ||
/** | ||
* Creates a new DataFrame instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.IDataFrame=} [properties] Properties to set | ||
* @returns {wsgrpc.DataFrame} DataFrame instance | ||
*/ | ||
DataFrame.create = function create(properties) { | ||
return new DataFrame(properties); | ||
}; | ||
/** | ||
* Encodes the specified DataFrame message, length delimited. Does not implicitly {@link wsgrpc.DataFrame.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.IDataFrame} message DataFrame message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
DataFrame.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Encodes the specified DataFrame message. Does not implicitly {@link wsgrpc.DataFrame.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.IDataFrame} message DataFrame message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
DataFrame.encode = function encode(message, writer) { | ||
if (!writer) | ||
writer = $Writer.create(); | ||
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.streamId); | ||
writer.uint32(/* id 2, wireType 0 =*/16).bool(message.endStream); | ||
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); | ||
if (message.headers != null && message.hasOwnProperty("headers")) | ||
$root.wsgrpc.DataFrame.Headers.encode(message.headers, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); | ||
if (message.trailers != null && message.hasOwnProperty("trailers")) | ||
$root.wsgrpc.DataFrame.Trailers.encode(message.trailers, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); | ||
if (message.message != null && message.hasOwnProperty("message")) | ||
writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.message); | ||
return writer; | ||
}; | ||
/** | ||
* Decodes a DataFrame message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.DataFrame} DataFrame | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
DataFrame.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.wsgrpc.DataFrame(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.streamId = reader.int32(); | ||
break; | ||
case 2: | ||
message.endStream = reader.bool(); | ||
break; | ||
case 3: | ||
message.type = reader.int32(); | ||
break; | ||
case 4: | ||
message.headers = $root.wsgrpc.DataFrame.Headers.decode( | ||
reader, | ||
reader.uint32() | ||
); | ||
break; | ||
case 5: | ||
message.trailers = $root.wsgrpc.DataFrame.Trailers.decode( | ||
reader, | ||
reader.uint32() | ||
); | ||
break; | ||
case 6: | ||
message.message = reader.bytes(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
if (!message.hasOwnProperty("streamId")) | ||
throw $util.ProtocolError("missing required 'streamId'", { | ||
instance: message | ||
}); | ||
if (!message.hasOwnProperty("endStream")) | ||
throw $util.ProtocolError("missing required 'endStream'", { | ||
instance: message | ||
}); | ||
if (!message.hasOwnProperty("type")) | ||
throw $util.ProtocolError("missing required 'type'", { | ||
instance: message | ||
}); | ||
return message; | ||
}; | ||
/** | ||
* Encodes the specified DataFrame message, length delimited. Does not implicitly {@link wsgrpc.DataFrame.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.IDataFrame} message DataFrame message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
DataFrame.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Decodes a DataFrame message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.DataFrame} DataFrame | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
DataFrame.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Decodes a DataFrame message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.DataFrame} DataFrame | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
DataFrame.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.wsgrpc.DataFrame(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.streamId = reader.int32(); | ||
break; | ||
case 2: | ||
message.endStream = reader.bool(); | ||
break; | ||
case 3: | ||
message.type = reader.int32(); | ||
break; | ||
case 4: | ||
message.headers = $root.wsgrpc.DataFrame.Headers.decode(reader, reader.uint32()); | ||
break; | ||
case 5: | ||
message.trailers = $root.wsgrpc.DataFrame.Trailers.decode(reader, reader.uint32()); | ||
break; | ||
case 6: | ||
message.message = reader.bytes(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
if (!message.hasOwnProperty("streamId")) | ||
throw $util.ProtocolError("missing required 'streamId'", { instance: message }); | ||
if (!message.hasOwnProperty("endStream")) | ||
throw $util.ProtocolError("missing required 'endStream'", { instance: message }); | ||
if (!message.hasOwnProperty("type")) | ||
throw $util.ProtocolError("missing required 'type'", { instance: message }); | ||
return message; | ||
}; | ||
/** | ||
* Verifies a DataFrame message. | ||
* @function verify | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
DataFrame.verify = function verify(message) { | ||
if (typeof message !== "object" || message === null) | ||
return "object expected"; | ||
if (!$util.isInteger(message.streamId)) | ||
return "streamId: integer expected"; | ||
if (typeof message.endStream !== "boolean") | ||
return "endStream: boolean expected"; | ||
switch (message.type) { | ||
default: | ||
return "type: enum value expected"; | ||
case 1: | ||
case 2: | ||
case 3: | ||
break; | ||
} | ||
if (message.headers != null && message.hasOwnProperty("headers")) { | ||
var error = $root.wsgrpc.DataFrame.Headers.verify(message.headers); | ||
if (error) return "headers." + error; | ||
} | ||
if (message.trailers != null && message.hasOwnProperty("trailers")) { | ||
var error = $root.wsgrpc.DataFrame.Trailers.verify(message.trailers); | ||
if (error) return "trailers." + error; | ||
} | ||
if (message.message != null && message.hasOwnProperty("message")) | ||
if ( | ||
!( | ||
(message.message && typeof message.message.length === "number") || | ||
$util.isString(message.message) | ||
) | ||
) | ||
return "message: buffer expected"; | ||
return null; | ||
}; | ||
/** | ||
* Decodes a DataFrame message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.DataFrame} DataFrame | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
DataFrame.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) | ||
reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Creates a DataFrame message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.DataFrame} DataFrame | ||
*/ | ||
DataFrame.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.DataFrame) return object; | ||
var message = new $root.wsgrpc.DataFrame(); | ||
if (object.streamId != null) message.streamId = object.streamId | 0; | ||
if (object.endStream != null) | ||
message.endStream = Boolean(object.endStream); | ||
switch (object.type) { | ||
case "HEADERS": | ||
case 1: | ||
message.type = 1; | ||
break; | ||
case "TRAILERS": | ||
case 2: | ||
message.type = 2; | ||
break; | ||
case "MESSAGE": | ||
case 3: | ||
message.type = 3; | ||
break; | ||
} | ||
if (object.headers != null) { | ||
if (typeof object.headers !== "object") | ||
throw TypeError(".wsgrpc.DataFrame.headers: object expected"); | ||
message.headers = $root.wsgrpc.DataFrame.Headers.fromObject( | ||
object.headers | ||
); | ||
} | ||
if (object.trailers != null) { | ||
if (typeof object.trailers !== "object") | ||
throw TypeError(".wsgrpc.DataFrame.trailers: object expected"); | ||
message.trailers = $root.wsgrpc.DataFrame.Trailers.fromObject( | ||
object.trailers | ||
); | ||
} | ||
if (object.message != null) | ||
if (typeof object.message === "string") | ||
$util.base64.decode( | ||
object.message, | ||
(message.message = $util.newBuffer( | ||
$util.base64.length(object.message) | ||
)), | ||
0 | ||
); | ||
else if (object.message.length) message.message = object.message; | ||
return message; | ||
}; | ||
/** | ||
* Verifies a DataFrame message. | ||
* @function verify | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
DataFrame.verify = function verify(message) { | ||
if (typeof message !== "object" || message === null) | ||
return "object expected"; | ||
if (!$util.isInteger(message.streamId)) | ||
return "streamId: integer expected"; | ||
if (typeof message.endStream !== "boolean") | ||
return "endStream: boolean expected"; | ||
switch (message.type) { | ||
default: | ||
return "type: enum value expected"; | ||
case 1: | ||
case 2: | ||
case 3: | ||
break; | ||
} | ||
if (message.headers != null && message.hasOwnProperty("headers")) { | ||
var error = $root.wsgrpc.DataFrame.Headers.verify(message.headers); | ||
if (error) | ||
return "headers." + error; | ||
} | ||
if (message.trailers != null && message.hasOwnProperty("trailers")) { | ||
var error = $root.wsgrpc.DataFrame.Trailers.verify(message.trailers); | ||
if (error) | ||
return "trailers." + error; | ||
} | ||
if (message.message != null && message.hasOwnProperty("message")) | ||
if (!(message.message && typeof message.message.length === "number" || $util.isString(message.message))) | ||
return "message: buffer expected"; | ||
return null; | ||
}; | ||
/** | ||
* Creates a plain object from a DataFrame message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.DataFrame} message DataFrame | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
DataFrame.toObject = function toObject(message, options) { | ||
if (!options) options = {}; | ||
var object = {}; | ||
if (options.defaults) { | ||
object.streamId = 0; | ||
object.endStream = false; | ||
object.type = options.enums === String ? "HEADERS" : 1; | ||
object.headers = null; | ||
object.trailers = null; | ||
object.message = options.bytes === String ? "" : []; | ||
} | ||
if (message.streamId != null && message.hasOwnProperty("streamId")) | ||
object.streamId = message.streamId; | ||
if (message.endStream != null && message.hasOwnProperty("endStream")) | ||
object.endStream = message.endStream; | ||
if (message.type != null && message.hasOwnProperty("type")) | ||
object.type = | ||
options.enums === String | ||
? $root.wsgrpc.DataFrame.Types[message.type] | ||
: message.type; | ||
if (message.headers != null && message.hasOwnProperty("headers")) | ||
object.headers = $root.wsgrpc.DataFrame.Headers.toObject( | ||
message.headers, | ||
options | ||
); | ||
if (message.trailers != null && message.hasOwnProperty("trailers")) | ||
object.trailers = $root.wsgrpc.DataFrame.Trailers.toObject( | ||
message.trailers, | ||
options | ||
); | ||
if (message.message != null && message.hasOwnProperty("message")) | ||
object.message = | ||
options.bytes === String | ||
? $util.base64.encode(message.message, 0, message.message.length) | ||
: options.bytes === Array | ||
? Array.prototype.slice.call(message.message) | ||
: message.message; | ||
return object; | ||
}; | ||
/** | ||
* Creates a DataFrame message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.DataFrame} DataFrame | ||
*/ | ||
DataFrame.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.DataFrame) | ||
return object; | ||
var message = new $root.wsgrpc.DataFrame(); | ||
if (object.streamId != null) | ||
message.streamId = object.streamId | 0; | ||
if (object.endStream != null) | ||
message.endStream = Boolean(object.endStream); | ||
switch (object.type) { | ||
case "HEADERS": | ||
case 1: | ||
message.type = 1; | ||
break; | ||
case "TRAILERS": | ||
case 2: | ||
message.type = 2; | ||
break; | ||
case "MESSAGE": | ||
case 3: | ||
message.type = 3; | ||
break; | ||
} | ||
if (object.headers != null) { | ||
if (typeof object.headers !== "object") | ||
throw TypeError(".wsgrpc.DataFrame.headers: object expected"); | ||
message.headers = $root.wsgrpc.DataFrame.Headers.fromObject(object.headers); | ||
} | ||
if (object.trailers != null) { | ||
if (typeof object.trailers !== "object") | ||
throw TypeError(".wsgrpc.DataFrame.trailers: object expected"); | ||
message.trailers = $root.wsgrpc.DataFrame.Trailers.fromObject(object.trailers); | ||
} | ||
if (object.message != null) | ||
if (typeof object.message === "string") | ||
$util.base64.decode(object.message, message.message = $util.newBuffer($util.base64.length(object.message)), 0); | ||
else if (object.message.length) | ||
message.message = object.message; | ||
return message; | ||
}; | ||
/** | ||
* Converts this DataFrame to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
DataFrame.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Creates a plain object from a DataFrame message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.DataFrame | ||
* @static | ||
* @param {wsgrpc.DataFrame} message DataFrame | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
DataFrame.toObject = function toObject(message, options) { | ||
if (!options) | ||
options = {}; | ||
var object = {}; | ||
if (options.defaults) { | ||
object.streamId = 0; | ||
object.endStream = false; | ||
object.type = options.enums === String ? "HEADERS" : 1; | ||
object.headers = null; | ||
object.trailers = null; | ||
object.message = options.bytes === String ? "" : []; | ||
} | ||
if (message.streamId != null && message.hasOwnProperty("streamId")) | ||
object.streamId = message.streamId; | ||
if (message.endStream != null && message.hasOwnProperty("endStream")) | ||
object.endStream = message.endStream; | ||
if (message.type != null && message.hasOwnProperty("type")) | ||
object.type = options.enums === String ? $root.wsgrpc.DataFrame.Types[message.type] : message.type; | ||
if (message.headers != null && message.hasOwnProperty("headers")) | ||
object.headers = $root.wsgrpc.DataFrame.Headers.toObject(message.headers, options); | ||
if (message.trailers != null && message.hasOwnProperty("trailers")) | ||
object.trailers = $root.wsgrpc.DataFrame.Trailers.toObject(message.trailers, options); | ||
if (message.message != null && message.hasOwnProperty("message")) | ||
object.message = options.bytes === String ? $util.base64.encode(message.message, 0, message.message.length) : options.bytes === Array ? Array.prototype.slice.call(message.message) : message.message; | ||
return object; | ||
}; | ||
DataFrame.Headers = (function() { | ||
/** | ||
* Properties of a Headers. | ||
* @memberof wsgrpc.DataFrame | ||
* @interface IHeaders | ||
* @property {string|null} [path] Headers path | ||
* @property {string|null} [status] Headers status | ||
* @property {string|null} [rpcStatus] Headers rpcStatus | ||
* @property {string|null} [rpcMessage] Headers rpcMessage | ||
*/ | ||
/** | ||
* Converts this DataFrame to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.DataFrame | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
DataFrame.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Constructs a new Headers. | ||
* @memberof wsgrpc.DataFrame | ||
* @classdesc Represents a Headers. | ||
* @implements IHeaders | ||
* @constructor | ||
* @param {wsgrpc.DataFrame.IHeaders=} [properties] Properties to set | ||
*/ | ||
function Headers(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]]; | ||
} | ||
DataFrame.Headers = (function() { | ||
/** | ||
* Headers path. | ||
* @member {string} path | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.path = ""; | ||
/** | ||
* Properties of a Headers. | ||
* @memberof wsgrpc.DataFrame | ||
* @interface IHeaders | ||
* @property {string|null} [path] Headers path | ||
* @property {string|null} [status] Headers status | ||
* @property {string|null} [rpcStatus] Headers rpcStatus | ||
* @property {string|null} [rpcMessage] Headers rpcMessage | ||
*/ | ||
/** | ||
* Headers status. | ||
* @member {string} status | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.status = ""; | ||
/** | ||
* Constructs a new Headers. | ||
* @memberof wsgrpc.DataFrame | ||
* @classdesc Represents a Headers. | ||
* @implements IHeaders | ||
* @constructor | ||
* @param {wsgrpc.DataFrame.IHeaders=} [properties] Properties to set | ||
*/ | ||
function Headers(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]]; | ||
} | ||
/** | ||
* Headers rpcStatus. | ||
* @member {string} rpcStatus | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.rpcStatus = ""; | ||
/** | ||
* Headers path. | ||
* @member {string} path | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.path = ""; | ||
/** | ||
* Headers rpcMessage. | ||
* @member {string} rpcMessage | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.rpcMessage = ""; | ||
/** | ||
* Headers status. | ||
* @member {string} status | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.status = ""; | ||
/** | ||
* Creates a new Headers instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.IHeaders=} [properties] Properties to set | ||
* @returns {wsgrpc.DataFrame.Headers} Headers instance | ||
*/ | ||
Headers.create = function create(properties) { | ||
return new Headers(properties); | ||
}; | ||
/** | ||
* Headers rpcStatus. | ||
* @member {string} rpcStatus | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.rpcStatus = ""; | ||
/** | ||
* Encodes the specified Headers message. Does not implicitly {@link wsgrpc.DataFrame.Headers.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.IHeaders} message Headers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Headers.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); | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.status); | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.rpcStatus); | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.rpcMessage); | ||
return writer; | ||
}; | ||
/** | ||
* Headers rpcMessage. | ||
* @member {string} rpcMessage | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
*/ | ||
Headers.prototype.rpcMessage = ""; | ||
/** | ||
* Encodes the specified Headers message, length delimited. Does not implicitly {@link wsgrpc.DataFrame.Headers.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.IHeaders} message Headers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Headers.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Creates a new Headers instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.IHeaders=} [properties] Properties to set | ||
* @returns {wsgrpc.DataFrame.Headers} Headers instance | ||
*/ | ||
Headers.create = function create(properties) { | ||
return new Headers(properties); | ||
}; | ||
/** | ||
* Decodes a Headers message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.DataFrame.Headers} Headers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Headers.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.wsgrpc.DataFrame.Headers(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.path = reader.string(); | ||
break; | ||
case 2: | ||
message.status = reader.string(); | ||
break; | ||
case 3: | ||
message.rpcStatus = reader.string(); | ||
break; | ||
case 4: | ||
message.rpcMessage = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Encodes the specified Headers message. Does not implicitly {@link wsgrpc.DataFrame.Headers.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.IHeaders} message Headers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Headers.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); | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.status); | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
writer.uint32(/* id 3, wireType 2 =*/26).string(message.rpcStatus); | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
writer.uint32(/* id 4, wireType 2 =*/34).string(message.rpcMessage); | ||
return writer; | ||
}; | ||
/** | ||
* Decodes a Headers message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.DataFrame.Headers} Headers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Headers.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Encodes the specified Headers message, length delimited. Does not implicitly {@link wsgrpc.DataFrame.Headers.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.IHeaders} message Headers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Headers.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Verifies a Headers message. | ||
* @function verify | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Headers.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"; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
if (!$util.isString(message.status)) return "status: string expected"; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
if (!$util.isString(message.rpcStatus)) | ||
return "rpcStatus: string expected"; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
if (!$util.isString(message.rpcMessage)) | ||
return "rpcMessage: string expected"; | ||
return null; | ||
}; | ||
/** | ||
* Decodes a Headers message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.DataFrame.Headers} Headers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Headers.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.wsgrpc.DataFrame.Headers(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.path = reader.string(); | ||
break; | ||
case 2: | ||
message.status = reader.string(); | ||
break; | ||
case 3: | ||
message.rpcStatus = reader.string(); | ||
break; | ||
case 4: | ||
message.rpcMessage = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Creates a Headers message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.DataFrame.Headers} Headers | ||
*/ | ||
Headers.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.DataFrame.Headers) return object; | ||
var message = new $root.wsgrpc.DataFrame.Headers(); | ||
if (object.path != null) message.path = String(object.path); | ||
if (object.status != null) message.status = String(object.status); | ||
if (object.rpcStatus != null) | ||
message.rpcStatus = String(object.rpcStatus); | ||
if (object.rpcMessage != null) | ||
message.rpcMessage = String(object.rpcMessage); | ||
return message; | ||
}; | ||
/** | ||
* Decodes a Headers message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.DataFrame.Headers} Headers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Headers.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) | ||
reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Creates a plain object from a Headers message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.Headers} message Headers | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Headers.toObject = function toObject(message, options) { | ||
if (!options) options = {}; | ||
var object = {}; | ||
if (options.defaults) { | ||
object.path = ""; | ||
object.status = ""; | ||
object.rpcStatus = ""; | ||
object.rpcMessage = ""; | ||
} | ||
if (message.path != null && message.hasOwnProperty("path")) | ||
object.path = message.path; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
object.status = message.status; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
object.rpcStatus = message.rpcStatus; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
object.rpcMessage = message.rpcMessage; | ||
return object; | ||
}; | ||
/** | ||
* Verifies a Headers message. | ||
* @function verify | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Headers.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"; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
if (!$util.isString(message.status)) | ||
return "status: string expected"; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
if (!$util.isString(message.rpcStatus)) | ||
return "rpcStatus: string expected"; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
if (!$util.isString(message.rpcMessage)) | ||
return "rpcMessage: string expected"; | ||
return null; | ||
}; | ||
/** | ||
* Converts this Headers to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Headers.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Creates a Headers message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.DataFrame.Headers} Headers | ||
*/ | ||
Headers.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.DataFrame.Headers) | ||
return object; | ||
var message = new $root.wsgrpc.DataFrame.Headers(); | ||
if (object.path != null) | ||
message.path = String(object.path); | ||
if (object.status != null) | ||
message.status = String(object.status); | ||
if (object.rpcStatus != null) | ||
message.rpcStatus = String(object.rpcStatus); | ||
if (object.rpcMessage != null) | ||
message.rpcMessage = String(object.rpcMessage); | ||
return message; | ||
}; | ||
return Headers; | ||
})(); | ||
/** | ||
* Creates a plain object from a Headers message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @static | ||
* @param {wsgrpc.DataFrame.Headers} message Headers | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Headers.toObject = function toObject(message, options) { | ||
if (!options) | ||
options = {}; | ||
var object = {}; | ||
if (options.defaults) { | ||
object.path = ""; | ||
object.status = ""; | ||
object.rpcStatus = ""; | ||
object.rpcMessage = ""; | ||
} | ||
if (message.path != null && message.hasOwnProperty("path")) | ||
object.path = message.path; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
object.status = message.status; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
object.rpcStatus = message.rpcStatus; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
object.rpcMessage = message.rpcMessage; | ||
return object; | ||
}; | ||
DataFrame.Trailers = (function() { | ||
/** | ||
* Properties of a Trailers. | ||
* @memberof wsgrpc.DataFrame | ||
* @interface ITrailers | ||
* @property {string|null} [path] Trailers path | ||
* @property {string|null} [status] Trailers status | ||
* @property {string|null} [rpcStatus] Trailers rpcStatus | ||
* @property {string|null} [rpcMessage] Trailers rpcMessage | ||
*/ | ||
/** | ||
* Converts this Headers to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.DataFrame.Headers | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Headers.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Constructs a new Trailers. | ||
* @memberof wsgrpc.DataFrame | ||
* @classdesc Represents a Trailers. | ||
* @implements ITrailers | ||
* @constructor | ||
* @param {wsgrpc.DataFrame.ITrailers=} [properties] Properties to set | ||
*/ | ||
function Trailers(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]]; | ||
} | ||
return Headers; | ||
})(); | ||
/** | ||
* Trailers path. | ||
* @member {string} path | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.path = ""; | ||
DataFrame.Trailers = (function() { | ||
/** | ||
* Trailers status. | ||
* @member {string} status | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.status = ""; | ||
/** | ||
* Properties of a Trailers. | ||
* @memberof wsgrpc.DataFrame | ||
* @interface ITrailers | ||
* @property {string|null} [path] Trailers path | ||
* @property {string|null} [status] Trailers status | ||
* @property {string|null} [rpcStatus] Trailers rpcStatus | ||
* @property {string|null} [rpcMessage] Trailers rpcMessage | ||
*/ | ||
/** | ||
* Trailers rpcStatus. | ||
* @member {string} rpcStatus | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.rpcStatus = ""; | ||
/** | ||
* Constructs a new Trailers. | ||
* @memberof wsgrpc.DataFrame | ||
* @classdesc Represents a Trailers. | ||
* @implements ITrailers | ||
* @constructor | ||
* @param {wsgrpc.DataFrame.ITrailers=} [properties] Properties to set | ||
*/ | ||
function Trailers(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]]; | ||
} | ||
/** | ||
* Trailers rpcMessage. | ||
* @member {string} rpcMessage | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.rpcMessage = ""; | ||
/** | ||
* Trailers path. | ||
* @member {string} path | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.path = ""; | ||
/** | ||
* Creates a new Trailers instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.ITrailers=} [properties] Properties to set | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers instance | ||
*/ | ||
Trailers.create = function create(properties) { | ||
return new Trailers(properties); | ||
}; | ||
/** | ||
* Trailers status. | ||
* @member {string} status | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.status = ""; | ||
/** | ||
* Encodes the specified Trailers message. Does not implicitly {@link wsgrpc.DataFrame.Trailers.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.ITrailers} message Trailers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Trailers.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); | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.status); | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.rpcStatus); | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.rpcMessage); | ||
return writer; | ||
}; | ||
/** | ||
* Trailers rpcStatus. | ||
* @member {string} rpcStatus | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.rpcStatus = ""; | ||
/** | ||
* Encodes the specified Trailers message, length delimited. Does not implicitly {@link wsgrpc.DataFrame.Trailers.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.ITrailers} message Trailers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Trailers.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Trailers rpcMessage. | ||
* @member {string} rpcMessage | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
*/ | ||
Trailers.prototype.rpcMessage = ""; | ||
/** | ||
* Decodes a Trailers message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Trailers.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.wsgrpc.DataFrame.Trailers(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.path = reader.string(); | ||
break; | ||
case 2: | ||
message.status = reader.string(); | ||
break; | ||
case 3: | ||
message.rpcStatus = reader.string(); | ||
break; | ||
case 4: | ||
message.rpcMessage = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Creates a new Trailers instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.ITrailers=} [properties] Properties to set | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers instance | ||
*/ | ||
Trailers.create = function create(properties) { | ||
return new Trailers(properties); | ||
}; | ||
/** | ||
* Decodes a Trailers message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Trailers.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Encodes the specified Trailers message. Does not implicitly {@link wsgrpc.DataFrame.Trailers.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.ITrailers} message Trailers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Trailers.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); | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.status); | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
writer.uint32(/* id 3, wireType 2 =*/26).string(message.rpcStatus); | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
writer.uint32(/* id 4, wireType 2 =*/34).string(message.rpcMessage); | ||
return writer; | ||
}; | ||
/** | ||
* Verifies a Trailers message. | ||
* @function verify | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Trailers.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"; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
if (!$util.isString(message.status)) return "status: string expected"; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
if (!$util.isString(message.rpcStatus)) | ||
return "rpcStatus: string expected"; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
if (!$util.isString(message.rpcMessage)) | ||
return "rpcMessage: string expected"; | ||
return null; | ||
}; | ||
/** | ||
* Encodes the specified Trailers message, length delimited. Does not implicitly {@link wsgrpc.DataFrame.Trailers.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.ITrailers} message Trailers message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Trailers.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Creates a Trailers message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers | ||
*/ | ||
Trailers.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.DataFrame.Trailers) return object; | ||
var message = new $root.wsgrpc.DataFrame.Trailers(); | ||
if (object.path != null) message.path = String(object.path); | ||
if (object.status != null) message.status = String(object.status); | ||
if (object.rpcStatus != null) | ||
message.rpcStatus = String(object.rpcStatus); | ||
if (object.rpcMessage != null) | ||
message.rpcMessage = String(object.rpcMessage); | ||
return message; | ||
}; | ||
/** | ||
* Decodes a Trailers message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Trailers.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.wsgrpc.DataFrame.Trailers(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.path = reader.string(); | ||
break; | ||
case 2: | ||
message.status = reader.string(); | ||
break; | ||
case 3: | ||
message.rpcStatus = reader.string(); | ||
break; | ||
case 4: | ||
message.rpcMessage = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Creates a plain object from a Trailers message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.Trailers} message Trailers | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Trailers.toObject = function toObject(message, options) { | ||
if (!options) options = {}; | ||
var object = {}; | ||
if (options.defaults) { | ||
object.path = ""; | ||
object.status = ""; | ||
object.rpcStatus = ""; | ||
object.rpcMessage = ""; | ||
} | ||
if (message.path != null && message.hasOwnProperty("path")) | ||
object.path = message.path; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
object.status = message.status; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
object.rpcStatus = message.rpcStatus; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
object.rpcMessage = message.rpcMessage; | ||
return object; | ||
}; | ||
/** | ||
* Decodes a Trailers message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Trailers.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) | ||
reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Converts this Trailers to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Trailers.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Verifies a Trailers message. | ||
* @function verify | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Trailers.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"; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
if (!$util.isString(message.status)) | ||
return "status: string expected"; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
if (!$util.isString(message.rpcStatus)) | ||
return "rpcStatus: string expected"; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
if (!$util.isString(message.rpcMessage)) | ||
return "rpcMessage: string expected"; | ||
return null; | ||
}; | ||
return Trailers; | ||
})(); | ||
/** | ||
* Creates a Trailers message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.DataFrame.Trailers} Trailers | ||
*/ | ||
Trailers.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.DataFrame.Trailers) | ||
return object; | ||
var message = new $root.wsgrpc.DataFrame.Trailers(); | ||
if (object.path != null) | ||
message.path = String(object.path); | ||
if (object.status != null) | ||
message.status = String(object.status); | ||
if (object.rpcStatus != null) | ||
message.rpcStatus = String(object.rpcStatus); | ||
if (object.rpcMessage != null) | ||
message.rpcMessage = String(object.rpcMessage); | ||
return message; | ||
}; | ||
/** | ||
* Types enum. | ||
* @name wsgrpc.DataFrame.Types | ||
* @enum {string} | ||
* @property {number} HEADERS=1 HEADERS value | ||
* @property {number} TRAILERS=2 TRAILERS value | ||
* @property {number} MESSAGE=3 MESSAGE value | ||
*/ | ||
DataFrame.Types = (function() { | ||
var valuesById = {}, | ||
values = Object.create(valuesById); | ||
values[(valuesById[1] = "HEADERS")] = 1; | ||
values[(valuesById[2] = "TRAILERS")] = 2; | ||
values[(valuesById[3] = "MESSAGE")] = 3; | ||
return values; | ||
})(); | ||
/** | ||
* Creates a plain object from a Trailers message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @static | ||
* @param {wsgrpc.DataFrame.Trailers} message Trailers | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Trailers.toObject = function toObject(message, options) { | ||
if (!options) | ||
options = {}; | ||
var object = {}; | ||
if (options.defaults) { | ||
object.path = ""; | ||
object.status = ""; | ||
object.rpcStatus = ""; | ||
object.rpcMessage = ""; | ||
} | ||
if (message.path != null && message.hasOwnProperty("path")) | ||
object.path = message.path; | ||
if (message.status != null && message.hasOwnProperty("status")) | ||
object.status = message.status; | ||
if (message.rpcStatus != null && message.hasOwnProperty("rpcStatus")) | ||
object.rpcStatus = message.rpcStatus; | ||
if (message.rpcMessage != null && message.hasOwnProperty("rpcMessage")) | ||
object.rpcMessage = message.rpcMessage; | ||
return object; | ||
}; | ||
return DataFrame; | ||
})(); | ||
/** | ||
* Converts this Trailers to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.DataFrame.Trailers | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Trailers.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
wsgrpc.Endponit = (function() { | ||
/** | ||
* Properties of an Endponit. | ||
* @memberof wsgrpc | ||
* @interface IEndponit | ||
* @property {string|null} [url] Endponit url | ||
*/ | ||
return Trailers; | ||
})(); | ||
/** | ||
* Constructs a new Endponit. | ||
* @memberof wsgrpc | ||
* @classdesc Represents an Endponit. | ||
* @implements IEndponit | ||
* @constructor | ||
* @param {wsgrpc.IEndponit=} [properties] Properties to set | ||
*/ | ||
function Endponit(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]]; | ||
} | ||
/** | ||
* Types enum. | ||
* @name wsgrpc.DataFrame.Types | ||
* @enum {string} | ||
* @property {number} HEADERS=1 HEADERS value | ||
* @property {number} TRAILERS=2 TRAILERS value | ||
* @property {number} MESSAGE=3 MESSAGE value | ||
*/ | ||
DataFrame.Types = (function() { | ||
var valuesById = {}, values = Object.create(valuesById); | ||
values[valuesById[1] = "HEADERS"] = 1; | ||
values[valuesById[2] = "TRAILERS"] = 2; | ||
values[valuesById[3] = "MESSAGE"] = 3; | ||
return values; | ||
})(); | ||
/** | ||
* Endponit url. | ||
* @member {string} url | ||
* @memberof wsgrpc.Endponit | ||
* @instance | ||
*/ | ||
Endponit.prototype.url = ""; | ||
return DataFrame; | ||
})(); | ||
/** | ||
* Creates a new Endponit instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.IEndponit=} [properties] Properties to set | ||
* @returns {wsgrpc.Endponit} Endponit instance | ||
*/ | ||
Endponit.create = function create(properties) { | ||
return new Endponit(properties); | ||
}; | ||
wsgrpc.Endponit = (function() { | ||
/** | ||
* Encodes the specified Endponit message. Does not implicitly {@link wsgrpc.Endponit.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.IEndponit} message Endponit message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Endponit.encode = function encode(message, writer) { | ||
if (!writer) writer = $Writer.create(); | ||
if (message.url != null && message.hasOwnProperty("url")) | ||
writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.url); | ||
return writer; | ||
}; | ||
/** | ||
* Properties of an Endponit. | ||
* @memberof wsgrpc | ||
* @interface IEndponit | ||
* @property {string|null} [url] Endponit url | ||
*/ | ||
/** | ||
* Encodes the specified Endponit message, length delimited. Does not implicitly {@link wsgrpc.Endponit.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.IEndponit} message Endponit message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Endponit.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Constructs a new Endponit. | ||
* @memberof wsgrpc | ||
* @classdesc Represents an Endponit. | ||
* @implements IEndponit | ||
* @constructor | ||
* @param {wsgrpc.IEndponit=} [properties] Properties to set | ||
*/ | ||
function Endponit(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]]; | ||
/** | ||
* Decodes an Endponit message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.Endponit} Endponit | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Endponit.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.wsgrpc.Endponit(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.url = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Endponit url. | ||
* @member {string} url | ||
* @memberof wsgrpc.Endponit | ||
* @instance | ||
*/ | ||
Endponit.prototype.url = ""; | ||
/** | ||
* Decodes an Endponit message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.Endponit} Endponit | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Endponit.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Creates a new Endponit instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.IEndponit=} [properties] Properties to set | ||
* @returns {wsgrpc.Endponit} Endponit instance | ||
*/ | ||
Endponit.create = function create(properties) { | ||
return new Endponit(properties); | ||
}; | ||
/** | ||
* Verifies an Endponit message. | ||
* @function verify | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Endponit.verify = function verify(message) { | ||
if (typeof message !== "object" || message === null) | ||
return "object expected"; | ||
if (message.url != null && message.hasOwnProperty("url")) | ||
if (!$util.isString(message.url)) return "url: string expected"; | ||
return null; | ||
}; | ||
/** | ||
* Encodes the specified Endponit message. Does not implicitly {@link wsgrpc.Endponit.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.IEndponit} message Endponit message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Endponit.encode = function encode(message, writer) { | ||
if (!writer) | ||
writer = $Writer.create(); | ||
if (message.url != null && message.hasOwnProperty("url")) | ||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); | ||
return writer; | ||
}; | ||
/** | ||
* Creates an Endponit message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.Endponit} Endponit | ||
*/ | ||
Endponit.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.Endponit) return object; | ||
var message = new $root.wsgrpc.Endponit(); | ||
if (object.url != null) message.url = String(object.url); | ||
return message; | ||
}; | ||
/** | ||
* Encodes the specified Endponit message, length delimited. Does not implicitly {@link wsgrpc.Endponit.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.IEndponit} message Endponit message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Endponit.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Creates a plain object from an Endponit message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.Endponit} message Endponit | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Endponit.toObject = function toObject(message, options) { | ||
if (!options) options = {}; | ||
var object = {}; | ||
if (options.defaults) object.url = ""; | ||
if (message.url != null && message.hasOwnProperty("url")) | ||
object.url = message.url; | ||
return object; | ||
}; | ||
/** | ||
* Decodes an Endponit message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.Endponit} Endponit | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Endponit.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.wsgrpc.Endponit(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.url = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Converts this Endponit to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.Endponit | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Endponit.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Decodes an Endponit message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.Endponit} Endponit | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Endponit.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) | ||
reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
return Endponit; | ||
})(); | ||
/** | ||
* Verifies an Endponit message. | ||
* @function verify | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Endponit.verify = function verify(message) { | ||
if (typeof message !== "object" || message === null) | ||
return "object expected"; | ||
if (message.url != null && message.hasOwnProperty("url")) | ||
if (!$util.isString(message.url)) | ||
return "url: string expected"; | ||
return null; | ||
}; | ||
wsgrpc.Channel = (function() { | ||
/** | ||
* Properties of a Channel. | ||
* @memberof wsgrpc | ||
* @interface IChannel | ||
*/ | ||
/** | ||
* Creates an Endponit message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.Endponit} Endponit | ||
*/ | ||
Endponit.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.Endponit) | ||
return object; | ||
var message = new $root.wsgrpc.Endponit(); | ||
if (object.url != null) | ||
message.url = String(object.url); | ||
return message; | ||
}; | ||
/** | ||
* Constructs a new Channel. | ||
* @memberof wsgrpc | ||
* @classdesc Represents a Channel. | ||
* @implements IChannel | ||
* @constructor | ||
* @param {wsgrpc.IChannel=} [properties] Properties to set | ||
*/ | ||
function Channel(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 plain object from an Endponit message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.Endponit | ||
* @static | ||
* @param {wsgrpc.Endponit} message Endponit | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Endponit.toObject = function toObject(message, options) { | ||
if (!options) | ||
options = {}; | ||
var object = {}; | ||
if (options.defaults) | ||
object.url = ""; | ||
if (message.url != null && message.hasOwnProperty("url")) | ||
object.url = message.url; | ||
return object; | ||
}; | ||
/** | ||
* Creates a new Channel instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.IChannel=} [properties] Properties to set | ||
* @returns {wsgrpc.Channel} Channel instance | ||
*/ | ||
Channel.create = function create(properties) { | ||
return new Channel(properties); | ||
}; | ||
/** | ||
* Converts this Endponit to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.Endponit | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Endponit.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Encodes the specified Channel message. Does not implicitly {@link wsgrpc.Channel.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.IChannel} message Channel message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Channel.encode = function encode(message, writer) { | ||
if (!writer) writer = $Writer.create(); | ||
return writer; | ||
}; | ||
return Endponit; | ||
})(); | ||
/** | ||
* Encodes the specified Channel message, length delimited. Does not implicitly {@link wsgrpc.Channel.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.IChannel} message Channel message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Channel.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
wsgrpc.Channel = (function() { | ||
/** | ||
* Properties of a Channel. | ||
* @memberof wsgrpc | ||
* @interface IChannel | ||
*/ | ||
/** | ||
* Constructs a new Channel. | ||
* @memberof wsgrpc | ||
* @classdesc Represents a Channel. | ||
* @implements IChannel | ||
* @constructor | ||
* @param {wsgrpc.IChannel=} [properties] Properties to set | ||
*/ | ||
function Channel(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]]; | ||
/** | ||
* Decodes a Channel message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.Channel} Channel | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Channel.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.wsgrpc.Channel(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Creates a new Channel instance using the specified properties. | ||
* @function create | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.IChannel=} [properties] Properties to set | ||
* @returns {wsgrpc.Channel} Channel instance | ||
*/ | ||
Channel.create = function create(properties) { | ||
return new Channel(properties); | ||
}; | ||
/** | ||
* Decodes a Channel message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.Channel} Channel | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Channel.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Encodes the specified Channel message. Does not implicitly {@link wsgrpc.Channel.verify|verify} messages. | ||
* @function encode | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.IChannel} message Channel message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Channel.encode = function encode(message, writer) { | ||
if (!writer) | ||
writer = $Writer.create(); | ||
return writer; | ||
}; | ||
/** | ||
* Verifies a Channel message. | ||
* @function verify | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Channel.verify = function verify(message) { | ||
if (typeof message !== "object" || message === null) | ||
return "object expected"; | ||
return null; | ||
}; | ||
/** | ||
* Encodes the specified Channel message, length delimited. Does not implicitly {@link wsgrpc.Channel.verify|verify} messages. | ||
* @function encodeDelimited | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.IChannel} message Channel message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Channel.encodeDelimited = function encodeDelimited(message, writer) { | ||
return this.encode(message, writer).ldelim(); | ||
}; | ||
/** | ||
* Creates a Channel message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.Channel} Channel | ||
*/ | ||
Channel.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.Channel) return object; | ||
return new $root.wsgrpc.Channel(); | ||
}; | ||
/** | ||
* Decodes a Channel message from the specified reader or buffer. | ||
* @function decode | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {wsgrpc.Channel} Channel | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Channel.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.wsgrpc.Channel(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}; | ||
/** | ||
* Creates a plain object from a Channel message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.Channel} message Channel | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Channel.toObject = function toObject() { | ||
return {}; | ||
}; | ||
/** | ||
* Decodes a Channel message from the specified reader or buffer, length delimited. | ||
* @function decodeDelimited | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | ||
* @returns {wsgrpc.Channel} Channel | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
Channel.decodeDelimited = function decodeDelimited(reader) { | ||
if (!(reader instanceof $Reader)) | ||
reader = new $Reader(reader); | ||
return this.decode(reader, reader.uint32()); | ||
}; | ||
/** | ||
* Converts this Channel to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.Channel | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Channel.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Verifies a Channel message. | ||
* @function verify | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {Object.<string,*>} message Plain object to verify | ||
* @returns {string|null} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Channel.verify = function verify(message) { | ||
if (typeof message !== "object" || message === null) | ||
return "object expected"; | ||
return null; | ||
}; | ||
return Channel; | ||
})(); | ||
/** | ||
* Creates a Channel message from a plain object. Also converts values to their respective internal types. | ||
* @function fromObject | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {Object.<string,*>} object Plain object | ||
* @returns {wsgrpc.Channel} Channel | ||
*/ | ||
Channel.fromObject = function fromObject(object) { | ||
if (object instanceof $root.wsgrpc.Channel) | ||
return object; | ||
return new $root.wsgrpc.Channel(); | ||
}; | ||
wsgrpc.WS = (function() { | ||
/** | ||
* Constructs a new WS service. | ||
* @memberof wsgrpc | ||
* @classdesc Represents a WS | ||
* @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 WS(rpcImpl, requestDelimited, responseDelimited) { | ||
$protobuf.rpc.Service.call( | ||
this, | ||
rpcImpl, | ||
requestDelimited, | ||
responseDelimited | ||
); | ||
} | ||
/** | ||
* Creates a plain object from a Channel message. Also converts values to other types if specified. | ||
* @function toObject | ||
* @memberof wsgrpc.Channel | ||
* @static | ||
* @param {wsgrpc.Channel} message Channel | ||
* @param {$protobuf.IConversionOptions} [options] Conversion options | ||
* @returns {Object.<string,*>} Plain object | ||
*/ | ||
Channel.toObject = function toObject() { | ||
return {}; | ||
}; | ||
(WS.prototype = Object.create( | ||
$protobuf.rpc.Service.prototype | ||
)).constructor = WS; | ||
/** | ||
* Converts this Channel to JSON. | ||
* @function toJSON | ||
* @memberof wsgrpc.Channel | ||
* @instance | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
Channel.prototype.toJSON = function toJSON() { | ||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | ||
}; | ||
/** | ||
* Creates new WS service using the specified rpc implementation. | ||
* @function create | ||
* @memberof wsgrpc.WS | ||
* @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 {WS} RPC service. Useful where requests and/or responses are streamed. | ||
*/ | ||
WS.create = function create(rpcImpl, requestDelimited, responseDelimited) { | ||
return new this(rpcImpl, requestDelimited, responseDelimited); | ||
}; | ||
return Channel; | ||
})(); | ||
/** | ||
* Callback as used by {@link wsgrpc.WS#getChannel}. | ||
* @memberof wsgrpc.WS | ||
* @typedef GetChannelCallback | ||
* @type {function} | ||
* @param {Error|null} error Error, if any | ||
* @param {wsgrpc.Channel} [response] Channel | ||
*/ | ||
wsgrpc.WS = (function() { | ||
/** | ||
* Calls GetChannel. | ||
* @function getChannel | ||
* @memberof wsgrpc.WS | ||
* @instance | ||
* @param {wsgrpc.IEndponit} request Endponit message or plain object | ||
* @param {wsgrpc.WS.GetChannelCallback} callback Node-style callback called with the error, if any, and Channel | ||
* @returns {undefined} | ||
* @variation 1 | ||
*/ | ||
WS.prototype.getChannel = function getChannel(request, callback) { | ||
return this.rpcCall( | ||
getChannel, | ||
$root.wsgrpc.Endponit, | ||
$root.wsgrpc.Channel, | ||
request, | ||
callback | ||
); | ||
}; | ||
/** | ||
* Constructs a new WS service. | ||
* @memberof wsgrpc | ||
* @classdesc Represents a WS | ||
* @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 WS(rpcImpl, requestDelimited, responseDelimited) { | ||
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); | ||
} | ||
/** | ||
* Calls GetChannel. | ||
* @function getChannel | ||
* @memberof wsgrpc.WS | ||
* @instance | ||
* @param {wsgrpc.IEndponit} request Endponit message or plain object | ||
* @returns {Promise<wsgrpc.Channel>} Promise | ||
* @variation 2 | ||
*/ | ||
(WS.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = WS; | ||
return WS; | ||
})(); | ||
/** | ||
* Creates new WS service using the specified rpc implementation. | ||
* @function create | ||
* @memberof wsgrpc.WS | ||
* @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 {WS} RPC service. Useful where requests and/or responses are streamed. | ||
*/ | ||
WS.create = function create(rpcImpl, requestDelimited, responseDelimited) { | ||
return new this(rpcImpl, requestDelimited, responseDelimited); | ||
}; | ||
/** | ||
* Callback as used by {@link wsgrpc.WS#getChannel}. | ||
* @memberof wsgrpc.WS | ||
* @typedef GetChannelCallback | ||
* @type {function} | ||
* @param {Error|null} error Error, if any | ||
* @param {wsgrpc.Channel} [response] Channel | ||
*/ | ||
/** | ||
* Calls GetChannel. | ||
* @function getChannel | ||
* @memberof wsgrpc.WS | ||
* @instance | ||
* @param {wsgrpc.IEndponit} request Endponit message or plain object | ||
* @param {wsgrpc.WS.GetChannelCallback} callback Node-style callback called with the error, if any, and Channel | ||
* @returns {undefined} | ||
* @variation 1 | ||
*/ | ||
WS.prototype.getChannel = function getChannel(request, callback) { | ||
return this.rpcCall(getChannel, $root.wsgrpc.Endponit, $root.wsgrpc.Channel, request, callback); | ||
}; | ||
/** | ||
* Calls GetChannel. | ||
* @function getChannel | ||
* @memberof wsgrpc.WS | ||
* @instance | ||
* @param {wsgrpc.IEndponit} request Endponit message or plain object | ||
* @returns {Promise<wsgrpc.Channel>} Promise | ||
* @variation 2 | ||
*/ | ||
return WS; | ||
})(); | ||
return wsgrpc; | ||
return wsgrpc; | ||
})(); | ||
module.exports = $root; |
@@ -24,4 +24,4 @@ import { RpcMeta, Message } from "./types"; | ||
sendResponseFinish(streamID: number): void; | ||
request<T, U>(meta: RpcMeta<any, any>, request: Message<T>): Promise<Message<U>>; | ||
request<T, U>(meta: RpcMeta, request: Message<T>): Promise<Message<U>>; | ||
handle(streamID: number, path: string, router: Router): Promise<void>; | ||
} |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
readonly streamID: number; | ||
method: RpcMeta<any, any>; | ||
method: RpcMeta; | ||
private request; | ||
@@ -15,3 +15,3 @@ private protocol; | ||
headers: Queue<Headers>; | ||
constructor(protocol: GrpcProtocol, streamID: number, method: RpcMeta<any, any>, request: Message<T>, handler?: any); | ||
constructor(protocol: GrpcProtocol, streamID: number, method: RpcMeta, request: Message<T>, handler?: any); | ||
invoke(): Promise<Message<U>>; | ||
@@ -18,0 +18,0 @@ handle(): Promise<void>; |
@@ -5,1 +5,2 @@ export { ServiceFactory, RpcMeta, ServiceMeta } from "./types"; | ||
export { createServer } from "./server"; | ||
export { StreamReader, StreamController } from "./stream"; |
@@ -9,1 +9,4 @@ "use strict"; | ||
exports.createServer = server_1.createServer; | ||
var stream_1 = require("./stream"); | ||
exports.StreamReader = stream_1.StreamReader; | ||
exports.StreamController = stream_1.StreamController; |
@@ -28,3 +28,3 @@ /// <reference types="node" /> | ||
onStreamEnd(streamID: number | any): void; | ||
request<T, U>(meta: RpcMeta<any, any>, request: Message<T>): Promise<Message<U>>; | ||
request<T, U>(meta: RpcMeta, request: Message<T>): Promise<Message<U>>; | ||
handle(streamID: number, path: string, router: Router): void; | ||
@@ -31,0 +31,0 @@ } |
@@ -38,3 +38,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var protobufjs_1 = require("protobufjs"); | ||
var Router = /** @class */ (function () { | ||
@@ -79,3 +78,3 @@ function Router(descriptors) { | ||
case 4: | ||
jsName = protobufjs_1.util.lcFirst(sm[1]); | ||
jsName = lcFirst(sm[1]); | ||
method = service[jsName]; | ||
@@ -94,1 +93,4 @@ if (!method) { | ||
exports.Router = Router; | ||
function lcFirst(name) { | ||
return name[0].toLowerCase() + name.substr(1); | ||
} |
/// <reference types="node" /> | ||
import * as pbjs from "protobufjs/minimal"; | ||
export declare type Message<T> = T | AsyncIterableIterator<T>; | ||
export interface ServiceMeta { | ||
[key: string]: RpcMeta<any, any>; | ||
[key: string]: RpcMeta; | ||
} | ||
export interface RpcMeta<T extends pbjs.Message<T>, U extends pbjs.Message<U>> { | ||
export interface RpcMeta { | ||
path: string; | ||
requestStream: boolean; | ||
responseStream: boolean; | ||
requestType: T; | ||
responseType: U; | ||
requestType: any; | ||
responseType: any; | ||
} | ||
@@ -21,4 +20,4 @@ export declare type ServiceFactory<T> = (context: any) => T | Promise<T>; | ||
export interface MethodDescriptor { | ||
meta: RpcMeta<any, any>; | ||
meta: RpcMeta; | ||
handler: MethodHandler; | ||
} |
{ | ||
"name": "wsgrpc", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "TODO", | ||
@@ -16,3 +16,3 @@ "author": "tsangpo", | ||
"minimist": "^1.2.0", | ||
"protobufjs": "^6.8.6", | ||
"protobufjs": "6.8.8", | ||
"tmp": "0.0.33", | ||
@@ -19,0 +19,0 @@ "ws": "^5.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310170
73
6746
2
7
+ Added@types/node@10.17.60(transitive)
+ Addedprotobufjs@6.8.8(transitive)
- Removed@types/node@22.10.1(transitive)
- Removedprotobufjs@6.11.4(transitive)
- Removedundici-types@6.20.0(transitive)
Updatedprotobufjs@6.8.8