apollo-engine-reporting-protobuf
Version:
Protobuf format for Apollo Engine
1,119 lines (1,056 loc) • 377 kB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";
var $protobuf = require("@apollo/protobufjs/minimal");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.Trace = (function() {
/**
* Properties of a Trace.
* @exports ITrace
* @interface ITrace
* @property {google.protobuf.ITimestamp|null} [startTime] Trace startTime
* @property {google.protobuf.ITimestamp|null} [endTime] Trace endTime
* @property {number|null} [durationNs] Trace durationNs
* @property {Trace.INode|null} [root] Trace root
* @property {string|null} [signature] Trace signature
* @property {Trace.IDetails|null} [details] Trace details
* @property {string|null} [clientName] Trace clientName
* @property {string|null} [clientVersion] Trace clientVersion
* @property {string|null} [clientAddress] Trace clientAddress
* @property {string|null} [clientReferenceId] Trace clientReferenceId
* @property {Trace.IHTTP|null} [http] Trace http
* @property {Trace.ICachePolicy|null} [cachePolicy] Trace cachePolicy
* @property {Trace.IQueryPlanNode|null} [queryPlan] Trace queryPlan
* @property {boolean|null} [fullQueryCacheHit] Trace fullQueryCacheHit
* @property {boolean|null} [persistedQueryHit] Trace persistedQueryHit
* @property {boolean|null} [persistedQueryRegister] Trace persistedQueryRegister
* @property {boolean|null} [registeredOperation] Trace registeredOperation
* @property {boolean|null} [forbiddenOperation] Trace forbiddenOperation
* @property {string|null} [legacySignatureNeedsResigning] Trace legacySignatureNeedsResigning
*/
/**
* Constructs a new Trace.
* @exports Trace
* @classdesc Represents a Trace.
* @implements ITrace
* @constructor
* @param {ITrace=} [properties] Properties to set
*/
function Trace(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]];
}
/**
* Trace startTime.
* @member {google.protobuf.ITimestamp|null|undefined} startTime
* @memberof Trace
* @instance
*/
Trace.prototype.startTime = null;
/**
* Trace endTime.
* @member {google.protobuf.ITimestamp|null|undefined} endTime
* @memberof Trace
* @instance
*/
Trace.prototype.endTime = null;
/**
* Trace durationNs.
* @member {number} durationNs
* @memberof Trace
* @instance
*/
Trace.prototype.durationNs = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
/**
* Trace root.
* @member {Trace.INode|null|undefined} root
* @memberof Trace
* @instance
*/
Trace.prototype.root = null;
/**
* Trace signature.
* @member {string} signature
* @memberof Trace
* @instance
*/
Trace.prototype.signature = "";
/**
* Trace details.
* @member {Trace.IDetails|null|undefined} details
* @memberof Trace
* @instance
*/
Trace.prototype.details = null;
/**
* Trace clientName.
* @member {string} clientName
* @memberof Trace
* @instance
*/
Trace.prototype.clientName = "";
/**
* Trace clientVersion.
* @member {string} clientVersion
* @memberof Trace
* @instance
*/
Trace.prototype.clientVersion = "";
/**
* Trace clientAddress.
* @member {string} clientAddress
* @memberof Trace
* @instance
*/
Trace.prototype.clientAddress = "";
/**
* Trace clientReferenceId.
* @member {string} clientReferenceId
* @memberof Trace
* @instance
*/
Trace.prototype.clientReferenceId = "";
/**
* Trace http.
* @member {Trace.IHTTP|null|undefined} http
* @memberof Trace
* @instance
*/
Trace.prototype.http = null;
/**
* Trace cachePolicy.
* @member {Trace.ICachePolicy|null|undefined} cachePolicy
* @memberof Trace
* @instance
*/
Trace.prototype.cachePolicy = null;
/**
* Trace queryPlan.
* @member {Trace.IQueryPlanNode|null|undefined} queryPlan
* @memberof Trace
* @instance
*/
Trace.prototype.queryPlan = null;
/**
* Trace fullQueryCacheHit.
* @member {boolean} fullQueryCacheHit
* @memberof Trace
* @instance
*/
Trace.prototype.fullQueryCacheHit = false;
/**
* Trace persistedQueryHit.
* @member {boolean} persistedQueryHit
* @memberof Trace
* @instance
*/
Trace.prototype.persistedQueryHit = false;
/**
* Trace persistedQueryRegister.
* @member {boolean} persistedQueryRegister
* @memberof Trace
* @instance
*/
Trace.prototype.persistedQueryRegister = false;
/**
* Trace registeredOperation.
* @member {boolean} registeredOperation
* @memberof Trace
* @instance
*/
Trace.prototype.registeredOperation = false;
/**
* Trace forbiddenOperation.
* @member {boolean} forbiddenOperation
* @memberof Trace
* @instance
*/
Trace.prototype.forbiddenOperation = false;
/**
* Trace legacySignatureNeedsResigning.
* @member {string} legacySignatureNeedsResigning
* @memberof Trace
* @instance
*/
Trace.prototype.legacySignatureNeedsResigning = "";
/**
* Creates a new Trace instance using the specified properties.
* @function create
* @memberof Trace
* @static
* @param {ITrace=} [properties] Properties to set
* @returns {Trace} Trace instance
*/
Trace.create = function create(properties) {
return new Trace(properties);
};
/**
* Encodes the specified Trace message. Does not implicitly {@link Trace.verify|verify} messages.
* @function encode
* @memberof Trace
* @static
* @param {ITrace} message Trace message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Trace.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime"))
$root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime"))
$root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
if (message.legacySignatureNeedsResigning != null && Object.hasOwnProperty.call(message, "legacySignatureNeedsResigning"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.legacySignatureNeedsResigning);
if (message.details != null && Object.hasOwnProperty.call(message, "details"))
$root.Trace.Details.encode(message.details, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
if (message.clientName != null && Object.hasOwnProperty.call(message, "clientName"))
writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientName);
if (message.clientVersion != null && Object.hasOwnProperty.call(message, "clientVersion"))
writer.uint32(/* id 8, wireType 2 =*/66).string(message.clientVersion);
if (message.clientAddress != null && Object.hasOwnProperty.call(message, "clientAddress"))
writer.uint32(/* id 9, wireType 2 =*/74).string(message.clientAddress);
if (message.http != null && Object.hasOwnProperty.call(message, "http"))
$root.Trace.HTTP.encode(message.http, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
if (message.durationNs != null && Object.hasOwnProperty.call(message, "durationNs"))
writer.uint32(/* id 11, wireType 0 =*/88).uint64(message.durationNs);
if (message.root != null && Object.hasOwnProperty.call(message, "root"))
$root.Trace.Node.encode(message.root, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();
if (message.cachePolicy != null && Object.hasOwnProperty.call(message, "cachePolicy"))
$root.Trace.CachePolicy.encode(message.cachePolicy, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim();
if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
writer.uint32(/* id 19, wireType 2 =*/154).string(message.signature);
if (message.fullQueryCacheHit != null && Object.hasOwnProperty.call(message, "fullQueryCacheHit"))
writer.uint32(/* id 20, wireType 0 =*/160).bool(message.fullQueryCacheHit);
if (message.persistedQueryHit != null && Object.hasOwnProperty.call(message, "persistedQueryHit"))
writer.uint32(/* id 21, wireType 0 =*/168).bool(message.persistedQueryHit);
if (message.persistedQueryRegister != null && Object.hasOwnProperty.call(message, "persistedQueryRegister"))
writer.uint32(/* id 22, wireType 0 =*/176).bool(message.persistedQueryRegister);
if (message.clientReferenceId != null && Object.hasOwnProperty.call(message, "clientReferenceId"))
writer.uint32(/* id 23, wireType 2 =*/186).string(message.clientReferenceId);
if (message.registeredOperation != null && Object.hasOwnProperty.call(message, "registeredOperation"))
writer.uint32(/* id 24, wireType 0 =*/192).bool(message.registeredOperation);
if (message.forbiddenOperation != null && Object.hasOwnProperty.call(message, "forbiddenOperation"))
writer.uint32(/* id 25, wireType 0 =*/200).bool(message.forbiddenOperation);
if (message.queryPlan != null && Object.hasOwnProperty.call(message, "queryPlan"))
$root.Trace.QueryPlanNode.encode(message.queryPlan, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim();
return writer;
};
/**
* Encodes the specified Trace message, length delimited. Does not implicitly {@link Trace.verify|verify} messages.
* @function encodeDelimited
* @memberof Trace
* @static
* @param {ITrace} message Trace message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Trace.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Trace message from the specified reader or buffer.
* @function decode
* @memberof Trace
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Trace} Trace
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Trace.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.Trace();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 4:
message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
case 3:
message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
case 11:
message.durationNs = reader.uint64();
break;
case 14:
message.root = $root.Trace.Node.decode(reader, reader.uint32());
break;
case 19:
message.signature = reader.string();
break;
case 6:
message.details = $root.Trace.Details.decode(reader, reader.uint32());
break;
case 7:
message.clientName = reader.string();
break;
case 8:
message.clientVersion = reader.string();
break;
case 9:
message.clientAddress = reader.string();
break;
case 23:
message.clientReferenceId = reader.string();
break;
case 10:
message.http = $root.Trace.HTTP.decode(reader, reader.uint32());
break;
case 18:
message.cachePolicy = $root.Trace.CachePolicy.decode(reader, reader.uint32());
break;
case 26:
message.queryPlan = $root.Trace.QueryPlanNode.decode(reader, reader.uint32());
break;
case 20:
message.fullQueryCacheHit = reader.bool();
break;
case 21:
message.persistedQueryHit = reader.bool();
break;
case 22:
message.persistedQueryRegister = reader.bool();
break;
case 24:
message.registeredOperation = reader.bool();
break;
case 25:
message.forbiddenOperation = reader.bool();
break;
case 5:
message.legacySignatureNeedsResigning = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Trace message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Trace
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Trace} Trace
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Trace.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Trace message.
* @function verify
* @memberof Trace
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Trace.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.startTime != null && message.hasOwnProperty("startTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.startTime);
if (error)
return "startTime." + error;
}
if (message.endTime != null && message.hasOwnProperty("endTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.endTime);
if (error)
return "endTime." + error;
}
if (message.durationNs != null && message.hasOwnProperty("durationNs"))
if (!$util.isInteger(message.durationNs) && !(message.durationNs && $util.isInteger(message.durationNs.low) && $util.isInteger(message.durationNs.high)))
return "durationNs: integer|Long expected";
if (message.root != null && message.hasOwnProperty("root")) {
var error = $root.Trace.Node.verify(message.root);
if (error)
return "root." + error;
}
if (message.signature != null && message.hasOwnProperty("signature"))
if (!$util.isString(message.signature))
return "signature: string expected";
if (message.details != null && message.hasOwnProperty("details")) {
var error = $root.Trace.Details.verify(message.details);
if (error)
return "details." + error;
}
if (message.clientName != null && message.hasOwnProperty("clientName"))
if (!$util.isString(message.clientName))
return "clientName: string expected";
if (message.clientVersion != null && message.hasOwnProperty("clientVersion"))
if (!$util.isString(message.clientVersion))
return "clientVersion: string expected";
if (message.clientAddress != null && message.hasOwnProperty("clientAddress"))
if (!$util.isString(message.clientAddress))
return "clientAddress: string expected";
if (message.clientReferenceId != null && message.hasOwnProperty("clientReferenceId"))
if (!$util.isString(message.clientReferenceId))
return "clientReferenceId: string expected";
if (message.http != null && message.hasOwnProperty("http")) {
var error = $root.Trace.HTTP.verify(message.http);
if (error)
return "http." + error;
}
if (message.cachePolicy != null && message.hasOwnProperty("cachePolicy")) {
var error = $root.Trace.CachePolicy.verify(message.cachePolicy);
if (error)
return "cachePolicy." + error;
}
if (message.queryPlan != null && message.hasOwnProperty("queryPlan")) {
var error = $root.Trace.QueryPlanNode.verify(message.queryPlan);
if (error)
return "queryPlan." + error;
}
if (message.fullQueryCacheHit != null && message.hasOwnProperty("fullQueryCacheHit"))
if (typeof message.fullQueryCacheHit !== "boolean")
return "fullQueryCacheHit: boolean expected";
if (message.persistedQueryHit != null && message.hasOwnProperty("persistedQueryHit"))
if (typeof message.persistedQueryHit !== "boolean")
return "persistedQueryHit: boolean expected";
if (message.persistedQueryRegister != null && message.hasOwnProperty("persistedQueryRegister"))
if (typeof message.persistedQueryRegister !== "boolean")
return "persistedQueryRegister: boolean expected";
if (message.registeredOperation != null && message.hasOwnProperty("registeredOperation"))
if (typeof message.registeredOperation !== "boolean")
return "registeredOperation: boolean expected";
if (message.forbiddenOperation != null && message.hasOwnProperty("forbiddenOperation"))
if (typeof message.forbiddenOperation !== "boolean")
return "forbiddenOperation: boolean expected";
if (message.legacySignatureNeedsResigning != null && message.hasOwnProperty("legacySignatureNeedsResigning"))
if (!$util.isString(message.legacySignatureNeedsResigning))
return "legacySignatureNeedsResigning: string expected";
return null;
};
/**
* Creates a Trace message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Trace
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Trace} Trace
*/
Trace.fromObject = function fromObject(object) {
if (object instanceof $root.Trace)
return object;
var message = new $root.Trace();
if (object.startTime != null) {
if (typeof object.startTime !== "object")
throw TypeError(".Trace.startTime: object expected");
message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime);
}
if (object.endTime != null) {
if (typeof object.endTime !== "object")
throw TypeError(".Trace.endTime: object expected");
message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime);
}
if (object.durationNs != null)
if ($util.Long)
(message.durationNs = $util.Long.fromValue(object.durationNs)).unsigned = true;
else if (typeof object.durationNs === "string")
message.durationNs = parseInt(object.durationNs, 10);
else if (typeof object.durationNs === "number")
message.durationNs = object.durationNs;
else if (typeof object.durationNs === "object")
message.durationNs = new $util.LongBits(object.durationNs.low >>> 0, object.durationNs.high >>> 0).toNumber(true);
if (object.root != null) {
if (typeof object.root !== "object")
throw TypeError(".Trace.root: object expected");
message.root = $root.Trace.Node.fromObject(object.root);
}
if (object.signature != null)
message.signature = String(object.signature);
if (object.details != null) {
if (typeof object.details !== "object")
throw TypeError(".Trace.details: object expected");
message.details = $root.Trace.Details.fromObject(object.details);
}
if (object.clientName != null)
message.clientName = String(object.clientName);
if (object.clientVersion != null)
message.clientVersion = String(object.clientVersion);
if (object.clientAddress != null)
message.clientAddress = String(object.clientAddress);
if (object.clientReferenceId != null)
message.clientReferenceId = String(object.clientReferenceId);
if (object.http != null) {
if (typeof object.http !== "object")
throw TypeError(".Trace.http: object expected");
message.http = $root.Trace.HTTP.fromObject(object.http);
}
if (object.cachePolicy != null) {
if (typeof object.cachePolicy !== "object")
throw TypeError(".Trace.cachePolicy: object expected");
message.cachePolicy = $root.Trace.CachePolicy.fromObject(object.cachePolicy);
}
if (object.queryPlan != null) {
if (typeof object.queryPlan !== "object")
throw TypeError(".Trace.queryPlan: object expected");
message.queryPlan = $root.Trace.QueryPlanNode.fromObject(object.queryPlan);
}
if (object.fullQueryCacheHit != null)
message.fullQueryCacheHit = Boolean(object.fullQueryCacheHit);
if (object.persistedQueryHit != null)
message.persistedQueryHit = Boolean(object.persistedQueryHit);
if (object.persistedQueryRegister != null)
message.persistedQueryRegister = Boolean(object.persistedQueryRegister);
if (object.registeredOperation != null)
message.registeredOperation = Boolean(object.registeredOperation);
if (object.forbiddenOperation != null)
message.forbiddenOperation = Boolean(object.forbiddenOperation);
if (object.legacySignatureNeedsResigning != null)
message.legacySignatureNeedsResigning = String(object.legacySignatureNeedsResigning);
return message;
};
/**
* Creates a plain object from a Trace message. Also converts values to other types if specified.
* @function toObject
* @memberof Trace
* @static
* @param {Trace} message Trace
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Trace.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.endTime = null;
object.startTime = null;
object.legacySignatureNeedsResigning = "";
object.details = null;
object.clientName = "";
object.clientVersion = "";
object.clientAddress = "";
object.http = null;
if ($util.Long) {
var long = new $util.Long(0, 0, true);
object.durationNs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.durationNs = options.longs === String ? "0" : 0;
object.root = null;
object.cachePolicy = null;
object.signature = "";
object.fullQueryCacheHit = false;
object.persistedQueryHit = false;
object.persistedQueryRegister = false;
object.clientReferenceId = "";
object.registeredOperation = false;
object.forbiddenOperation = false;
object.queryPlan = null;
}
if (message.endTime != null && message.hasOwnProperty("endTime"))
object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options);
if (message.startTime != null && message.hasOwnProperty("startTime"))
object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options);
if (message.legacySignatureNeedsResigning != null && message.hasOwnProperty("legacySignatureNeedsResigning"))
object.legacySignatureNeedsResigning = message.legacySignatureNeedsResigning;
if (message.details != null && message.hasOwnProperty("details"))
object.details = $root.Trace.Details.toObject(message.details, options);
if (message.clientName != null && message.hasOwnProperty("clientName"))
object.clientName = message.clientName;
if (message.clientVersion != null && message.hasOwnProperty("clientVersion"))
object.clientVersion = message.clientVersion;
if (message.clientAddress != null && message.hasOwnProperty("clientAddress"))
object.clientAddress = message.clientAddress;
if (message.http != null && message.hasOwnProperty("http"))
object.http = $root.Trace.HTTP.toObject(message.http, options);
if (message.durationNs != null && message.hasOwnProperty("durationNs"))
if (typeof message.durationNs === "number")
object.durationNs = options.longs === String ? String(message.durationNs) : message.durationNs;
else
object.durationNs = options.longs === String ? $util.Long.prototype.toString.call(message.durationNs) : options.longs === Number ? new $util.LongBits(message.durationNs.low >>> 0, message.durationNs.high >>> 0).toNumber(true) : message.durationNs;
if (message.root != null && message.hasOwnProperty("root"))
object.root = $root.Trace.Node.toObject(message.root, options);
if (message.cachePolicy != null && message.hasOwnProperty("cachePolicy"))
object.cachePolicy = $root.Trace.CachePolicy.toObject(message.cachePolicy, options);
if (message.signature != null && message.hasOwnProperty("signature"))
object.signature = message.signature;
if (message.fullQueryCacheHit != null && message.hasOwnProperty("fullQueryCacheHit"))
object.fullQueryCacheHit = message.fullQueryCacheHit;
if (message.persistedQueryHit != null && message.hasOwnProperty("persistedQueryHit"))
object.persistedQueryHit = message.persistedQueryHit;
if (message.persistedQueryRegister != null && message.hasOwnProperty("persistedQueryRegister"))
object.persistedQueryRegister = message.persistedQueryRegister;
if (message.clientReferenceId != null && message.hasOwnProperty("clientReferenceId"))
object.clientReferenceId = message.clientReferenceId;
if (message.registeredOperation != null && message.hasOwnProperty("registeredOperation"))
object.registeredOperation = message.registeredOperation;
if (message.forbiddenOperation != null && message.hasOwnProperty("forbiddenOperation"))
object.forbiddenOperation = message.forbiddenOperation;
if (message.queryPlan != null && message.hasOwnProperty("queryPlan"))
object.queryPlan = $root.Trace.QueryPlanNode.toObject(message.queryPlan, options);
return object;
};
/**
* Converts this Trace to JSON.
* @function toJSON
* @memberof Trace
* @instance
* @returns {Object.<string,*>} JSON object
*/
Trace.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
Trace.CachePolicy = (function() {
/**
* Properties of a CachePolicy.
* @memberof Trace
* @interface ICachePolicy
* @property {Trace.CachePolicy.Scope|null} [scope] CachePolicy scope
* @property {number|null} [maxAgeNs] CachePolicy maxAgeNs
*/
/**
* Constructs a new CachePolicy.
* @memberof Trace
* @classdesc Represents a CachePolicy.
* @implements ICachePolicy
* @constructor
* @param {Trace.ICachePolicy=} [properties] Properties to set
*/
function CachePolicy(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]];
}
/**
* CachePolicy scope.
* @member {Trace.CachePolicy.Scope} scope
* @memberof Trace.CachePolicy
* @instance
*/
CachePolicy.prototype.scope = 0;
/**
* CachePolicy maxAgeNs.
* @member {number} maxAgeNs
* @memberof Trace.CachePolicy
* @instance
*/
CachePolicy.prototype.maxAgeNs = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* Creates a new CachePolicy instance using the specified properties.
* @function create
* @memberof Trace.CachePolicy
* @static
* @param {Trace.ICachePolicy=} [properties] Properties to set
* @returns {Trace.CachePolicy} CachePolicy instance
*/
CachePolicy.create = function create(properties) {
return new CachePolicy(properties);
};
/**
* Encodes the specified CachePolicy message. Does not implicitly {@link Trace.CachePolicy.verify|verify} messages.
* @function encode
* @memberof Trace.CachePolicy
* @static
* @param {Trace.ICachePolicy} message CachePolicy message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CachePolicy.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.scope != null && Object.hasOwnProperty.call(message, "scope"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.scope);
if (message.maxAgeNs != null && Object.hasOwnProperty.call(message, "maxAgeNs"))
writer.uint32(/* id 2, wireType 0 =*/16).int64(message.maxAgeNs);
return writer;
};
/**
* Encodes the specified CachePolicy message, length delimited. Does not implicitly {@link Trace.CachePolicy.verify|verify} messages.
* @function encodeDelimited
* @memberof Trace.CachePolicy
* @static
* @param {Trace.ICachePolicy} message CachePolicy message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CachePolicy.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CachePolicy message from the specified reader or buffer.
* @function decode
* @memberof Trace.CachePolicy
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Trace.CachePolicy} CachePolicy
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CachePolicy.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.Trace.CachePolicy();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.scope = reader.int32();
break;
case 2:
message.maxAgeNs = reader.int64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CachePolicy message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Trace.CachePolicy
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Trace.CachePolicy} CachePolicy
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CachePolicy.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CachePolicy message.
* @function verify
* @memberof Trace.CachePolicy
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CachePolicy.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.scope != null && message.hasOwnProperty("scope"))
switch (message.scope) {
default:
return "scope: enum value expected";
case 0:
case 1:
case 2:
break;
}
if (message.maxAgeNs != null && message.hasOwnProperty("maxAgeNs"))
if (!$util.isInteger(message.maxAgeNs) && !(message.maxAgeNs && $util.isInteger(message.maxAgeNs.low) && $util.isInteger(message.maxAgeNs.high)))
return "maxAgeNs: integer|Long expected";
return null;
};
/**
* Creates a CachePolicy message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Trace.CachePolicy
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Trace.CachePolicy} CachePolicy
*/
CachePolicy.fromObject = function fromObject(object) {
if (object instanceof $root.Trace.CachePolicy)
return object;
var message = new $root.Trace.CachePolicy();
switch (object.scope) {
case "UNKNOWN":
case 0:
message.scope = 0;
break;
case "PUBLIC":
case 1:
message.scope = 1;
break;
case "PRIVATE":
case 2:
message.scope = 2;
break;
}
if (object.maxAgeNs != null)
if ($util.Long)
(message.maxAgeNs = $util.Long.fromValue(object.maxAgeNs)).unsigned = false;
else if (typeof object.maxAgeNs === "string")
message.maxAgeNs = parseInt(object.maxAgeNs, 10);
else if (typeof object.maxAgeNs === "number")
message.maxAgeNs = object.maxAgeNs;
else if (typeof object.maxAgeNs === "object")
message.maxAgeNs = new $util.LongBits(object.maxAgeNs.low >>> 0, object.maxAgeNs.high >>> 0).toNumber();
return message;
};
/**
* Creates a plain object from a CachePolicy message. Also converts values to other types if specified.
* @function toObject
* @memberof Trace.CachePolicy
* @static
* @param {Trace.CachePolicy} message CachePolicy
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CachePolicy.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.scope = options.enums === String ? "UNKNOWN" : 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.maxAgeNs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.maxAgeNs = options.longs === String ? "0" : 0;
}
if (message.scope != null && message.hasOwnProperty("scope"))
object.scope = options.enums === String ? $root.Trace.CachePolicy.Scope[message.scope] : message.scope;
if (message.maxAgeNs != null && message.hasOwnProperty("maxAgeNs"))
if (typeof message.maxAgeNs === "number")
object.maxAgeNs = options.longs === String ? String(message.maxAgeNs) : message.maxAgeNs;
else
object.maxAgeNs = options.longs === String ? $util.Long.prototype.toString.call(message.maxAgeNs) : options.longs === Number ? new $util.LongBits(message.maxAgeNs.low >>> 0, message.maxAgeNs.high >>> 0).toNumber() : message.maxAgeNs;
return object;
};
/**
* Converts this CachePolicy to JSON.
* @function toJSON
* @memberof Trace.CachePolicy
* @instance
* @returns {Object.<string,*>} JSON object
*/
CachePolicy.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Scope enum.
* @name Trace.CachePolicy.Scope
* @enum {string}
* @property {number} UNKNOWN=0 UNKNOWN value
* @property {number} PUBLIC=1 PUBLIC value
* @property {number} PRIVATE=2 PRIVATE value
*/
CachePolicy.Scope = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "UNKNOWN"] = 0;
values[valuesById[1] = "PUBLIC"] = 1;
values[valuesById[2] = "PRIVATE"] = 2;
return values;
})();
return CachePolicy;
})();
Trace.Details = (function() {
/**
* Properties of a Details.
* @memberof Trace
* @interface IDetails
* @property {Object.<string,string>|null} [variablesJson] Details variablesJson
* @property {Object.<string,Uint8Array>|null} [deprecatedVariables] Details deprecatedVariables
* @property {string|null} [operationName] Details operationName
*/
/**
* Constructs a new Details.
* @memberof Trace
* @classdesc Represents a Details.
* @implements IDetails
* @constructor
* @param {Trace.IDetails=} [properties] Properties to set
*/
function Details(properties) {
this.variablesJson = {};
this.deprecatedVariables = {};
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]];
}
/**
* Details variablesJson.
* @member {Object.<string,string>} variablesJson
* @memberof Trace.Details
* @instance
*/
Details.prototype.variablesJson = $util.emptyObject;
/**
* Details deprecatedVariables.
* @member {Object.<string,Uint8Array>} deprecatedVariables
* @memberof Trace.Details
* @instance
*/
Details.prototype.deprecatedVariables = $util.emptyObject;
/**
* Details operationName.
* @member {string} operationName
* @memberof Trace.Details
* @instance
*/
Details.prototype.operationName = "";
/**
* Creates a new Details instance using the specified properties.
* @function create
* @memberof Trace.Details
* @static
* @param {Trace.IDetails=} [properties] Properties to set
* @returns {Trace.Details} Details instance
*/
Details.create = function create(properties) {
return new Details(properties);
};
/**
* Encodes the specified Details message. Does not implicitly {@link Trace.Details.verify|verify} messages.
* @function encode
* @memberof Trace.Details
* @static
* @param {Trace.IDetails} message Details message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Details.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.deprecatedVariables != null && Object.hasOwnProperty.call(message, "deprecatedVariables"))
for (var keys = Object.keys(message.deprecatedVariables), i = 0; i < keys.length; ++i)
writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).bytes(message.deprecatedVariables[keys[i]]).ldelim();
if (message.operationName != null && Object.hasOwnProperty.call(message, "operationName"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.operationName);
if (message.variablesJson != null && Object.hasOwnProperty.call(message, "variablesJson"))
for (var keys = Object.keys(message.variablesJson), i = 0; i < keys.length; ++i)
writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.variablesJson[keys[i]]).ldelim();
return writer;
};
/**
* Encodes the specified Details message, length delimited. Does not implicitly {@link Trace.Details.verify|verify} messages.
* @function encodeDelimited
* @memberof Trace.Details
* @static
* @param {Trace.IDetails} message Details message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Details.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Details message from the specified reader or buffer.
* @function decode
* @memberof Trace.Details
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {Trace.Details} Details
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Details.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.Trace.Details(), key;
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 4:
reader.skip().pos++;
if (message.variablesJson === $util.emptyObject)
message.variablesJson = {};
key = reader.string();
reader.pos++;
message.variablesJson[key] = reader.string();
break;
case 1:
reader.skip().pos++;
if (message.deprecatedVariables === $util.emptyObject)
message.deprecatedVariables = {};
key = reader.string();
reader.pos++;
message.deprecatedVariables[key] = reader.bytes();
break;
case 3:
message.operationName = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Details message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof Trace.Details
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {Trace.Details} Details
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Details.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Details message.
* @function verify
* @memberof Trace.Details
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Details.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.variablesJson != null && message.hasOwnProperty("variablesJson")) {
if (!$util.isObject(message.variablesJson))
return "variablesJson: object expected";
var key = Object.keys(message.variablesJson);
for (var i = 0; i < key.length; ++i)
if (!$util.isString(message.variablesJson[key[i]]))
return "variablesJson: string{k:string} expected";
}
if (message.deprecatedVariables != null && message.hasOwnProperty("deprecatedVariables")) {
if (!$util.isObject(message.deprecatedVariables))
return "deprecatedVariables: object expected";
var key = Object.keys(message.deprecatedVariables);
for (var i = 0; i < key.length; ++i)
if (!(message.deprecatedVariables[key[i]] && typeof message.deprecatedVariables[key[i]].length === "number" || $util.isString(message.deprecatedVariables[key[i]])))
return "deprecatedVariables: buffer{k:string} expected";
}
if (message.operationName != null && message.hasOwnProperty("operationName"))
if (!$util.isString(message.operationName))
return "operationName: string expected";
return null;
};
/**
* Creates a Details message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof Trace.Details
* @static
* @param {Object.<string,*>} object Plain object
* @returns {Trace.Details} Details
*/
Details.fromObject = function fromObject(object) {
if (object instanceof $root.Trace.Details)
return object;
var message = new $root.Trace.Details();
if (object.variablesJson) {
if (typeof object.variablesJson !== "object")
throw TypeError(".Trace.Details.variablesJson: object expected");
message.variablesJson = {};
for (var keys = Object.keys(object.variablesJson), i = 0; i < keys.length; ++i)
message.variablesJson[keys[i]] = String(object.variablesJson[keys[i]]);
}
if (object.deprecatedVariables) {
if (typeof object.deprecatedVariables !== "object")
throw TypeError(".Trace.Details.deprecatedVariables: object expected");
message.deprecatedVariables = {};
for (var keys = Object.keys(object.deprecatedVariables), i = 0; i < keys.length; ++i)
if (typeof object.deprecatedVariables[keys[i]] === "string")
$util.base64.decode(object.deprecatedVariables[keys[i]], message.deprecatedVariables[keys[i]] = $util.newBuffer