@x5e/gink
Version:
an eventually consistent database
459 lines • 15.7 kB
JavaScript
// source: proto/bundle.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = (typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var proto_change_pb = require('../proto/change_pb.js');
goog.object.extend(proto, proto_change_pb);
goog.exportSymbol('proto.gink.Bundle', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.gink.Bundle = function (opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.gink.Bundle.repeatedFields_, null);
};
goog.inherits(proto.gink.Bundle, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.gink.Bundle.displayName = 'proto.gink.Bundle';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.gink.Bundle.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.gink.Bundle.prototype.toObject = function (opt_includeInstance) {
return proto.gink.Bundle.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.gink.Bundle} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.gink.Bundle.toObject = function (includeInstance, msg) {
var f, obj = {
identity: jspb.Message.getFieldWithDefault(msg, 1, ""),
changesList: jspb.Message.toObjectList(msg.getChangesList(), proto_change_pb.Change.toObject, includeInstance),
verifyKey: msg.getVerifyKey_asB64(),
timestamp: jspb.Message.getFieldWithDefault(msg, 4, 0),
chainStart: jspb.Message.getFieldWithDefault(msg, 5, 0),
medallion: jspb.Message.getFieldWithDefault(msg, 6, 0),
previous: jspb.Message.getFieldWithDefault(msg, 7, 0),
priorHash: msg.getPriorHash_asB64(),
keyId: jspb.Message.getFieldWithDefault(msg, 9, 0),
encrypted: msg.getEncrypted_asB64(),
comment: jspb.Message.getFieldWithDefault(msg, 11, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.gink.Bundle}
*/
proto.gink.Bundle.deserializeBinary = function (bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.gink.Bundle;
return proto.gink.Bundle.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.gink.Bundle} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.gink.Bundle}
*/
proto.gink.Bundle.deserializeBinaryFromReader = function (msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setIdentity(value);
break;
case 2:
var value = new proto_change_pb.Change;
reader.readMessage(value, proto_change_pb.Change.deserializeBinaryFromReader);
msg.addChanges(value);
break;
case 3:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setVerifyKey(value);
break;
case 4:
var value = /** @type {number} */ (reader.readUint64());
msg.setTimestamp(value);
break;
case 5:
var value = /** @type {number} */ (reader.readUint64());
msg.setChainStart(value);
break;
case 6:
var value = /** @type {number} */ (reader.readUint64());
msg.setMedallion(value);
break;
case 7:
var value = /** @type {number} */ (reader.readUint64());
msg.setPrevious(value);
break;
case 8:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setPriorHash(value);
break;
case 9:
var value = /** @type {number} */ (reader.readUint64());
msg.setKeyId(value);
break;
case 10:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setEncrypted(value);
break;
case 11:
var value = /** @type {string} */ (reader.readString());
msg.setComment(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.gink.Bundle.prototype.serializeBinary = function () {
var writer = new jspb.BinaryWriter();
proto.gink.Bundle.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.gink.Bundle} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.gink.Bundle.serializeBinaryToWriter = function (message, writer) {
var f = undefined;
f = message.getIdentity();
if (f.length > 0) {
writer.writeString(1, f);
}
f = message.getChangesList();
if (f.length > 0) {
writer.writeRepeatedMessage(2, f, proto_change_pb.Change.serializeBinaryToWriter);
}
f = message.getVerifyKey_asU8();
if (f.length > 0) {
writer.writeBytes(3, f);
}
f = message.getTimestamp();
if (f !== 0) {
writer.writeUint64(4, f);
}
f = message.getChainStart();
if (f !== 0) {
writer.writeUint64(5, f);
}
f = message.getMedallion();
if (f !== 0) {
writer.writeUint64(6, f);
}
f = message.getPrevious();
if (f !== 0) {
writer.writeUint64(7, f);
}
f = message.getPriorHash_asU8();
if (f.length > 0) {
writer.writeBytes(8, f);
}
f = message.getKeyId();
if (f !== 0) {
writer.writeUint64(9, f);
}
f = message.getEncrypted_asU8();
if (f.length > 0) {
writer.writeBytes(10, f);
}
f = message.getComment();
if (f.length > 0) {
writer.writeString(11, f);
}
};
/**
* optional string identity = 1;
* @return {string}
*/
proto.gink.Bundle.prototype.getIdentity = function () {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setIdentity = function (value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* repeated Change changes = 2;
* @return {!Array<!proto.gink.Change>}
*/
proto.gink.Bundle.prototype.getChangesList = function () {
return /** @type{!Array<!proto.gink.Change>} */ (jspb.Message.getRepeatedWrapperField(this, proto_change_pb.Change, 2));
};
/**
* @param {!Array<!proto.gink.Change>} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setChangesList = function (value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.gink.Change=} opt_value
* @param {number=} opt_index
* @return {!proto.gink.Change}
*/
proto.gink.Bundle.prototype.addChanges = function (opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.gink.Change, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.clearChangesList = function () {
return this.setChangesList([]);
};
/**
* optional bytes verify_key = 3;
* @return {!(string|Uint8Array)}
*/
proto.gink.Bundle.prototype.getVerifyKey = function () {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* optional bytes verify_key = 3;
* This is a type-conversion wrapper around `getVerifyKey()`
* @return {string}
*/
proto.gink.Bundle.prototype.getVerifyKey_asB64 = function () {
return /** @type {string} */ (jspb.Message.bytesAsB64(this.getVerifyKey()));
};
/**
* optional bytes verify_key = 3;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getVerifyKey()`
* @return {!Uint8Array}
*/
proto.gink.Bundle.prototype.getVerifyKey_asU8 = function () {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(this.getVerifyKey()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setVerifyKey = function (value) {
return jspb.Message.setProto3BytesField(this, 3, value);
};
/**
* optional uint64 timestamp = 4;
* @return {number}
*/
proto.gink.Bundle.prototype.getTimestamp = function () {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {number} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setTimestamp = function (value) {
return jspb.Message.setProto3IntField(this, 4, value);
};
/**
* optional uint64 chain_start = 5;
* @return {number}
*/
proto.gink.Bundle.prototype.getChainStart = function () {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};
/**
* @param {number} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setChainStart = function (value) {
return jspb.Message.setProto3IntField(this, 5, value);
};
/**
* optional uint64 medallion = 6;
* @return {number}
*/
proto.gink.Bundle.prototype.getMedallion = function () {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
};
/**
* @param {number} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setMedallion = function (value) {
return jspb.Message.setProto3IntField(this, 6, value);
};
/**
* optional uint64 previous = 7;
* @return {number}
*/
proto.gink.Bundle.prototype.getPrevious = function () {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
};
/**
* @param {number} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setPrevious = function (value) {
return jspb.Message.setProto3IntField(this, 7, value);
};
/**
* optional bytes prior_hash = 8;
* @return {!(string|Uint8Array)}
*/
proto.gink.Bundle.prototype.getPriorHash = function () {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, ""));
};
/**
* optional bytes prior_hash = 8;
* This is a type-conversion wrapper around `getPriorHash()`
* @return {string}
*/
proto.gink.Bundle.prototype.getPriorHash_asB64 = function () {
return /** @type {string} */ (jspb.Message.bytesAsB64(this.getPriorHash()));
};
/**
* optional bytes prior_hash = 8;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getPriorHash()`
* @return {!Uint8Array}
*/
proto.gink.Bundle.prototype.getPriorHash_asU8 = function () {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(this.getPriorHash()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setPriorHash = function (value) {
return jspb.Message.setProto3BytesField(this, 8, value);
};
/**
* optional uint64 key_id = 9;
* @return {number}
*/
proto.gink.Bundle.prototype.getKeyId = function () {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
};
/**
* @param {number} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setKeyId = function (value) {
return jspb.Message.setProto3IntField(this, 9, value);
};
/**
* optional bytes encrypted = 10;
* @return {!(string|Uint8Array)}
*/
proto.gink.Bundle.prototype.getEncrypted = function () {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 10, ""));
};
/**
* optional bytes encrypted = 10;
* This is a type-conversion wrapper around `getEncrypted()`
* @return {string}
*/
proto.gink.Bundle.prototype.getEncrypted_asB64 = function () {
return /** @type {string} */ (jspb.Message.bytesAsB64(this.getEncrypted()));
};
/**
* optional bytes encrypted = 10;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getEncrypted()`
* @return {!Uint8Array}
*/
proto.gink.Bundle.prototype.getEncrypted_asU8 = function () {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(this.getEncrypted()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setEncrypted = function (value) {
return jspb.Message.setProto3BytesField(this, 10, value);
};
/**
* optional string comment = 11;
* @return {string}
*/
proto.gink.Bundle.prototype.getComment = function () {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, ""));
};
/**
* @param {string} value
* @return {!proto.gink.Bundle} returns this
*/
proto.gink.Bundle.prototype.setComment = function (value) {
return jspb.Message.setProto3StringField(this, 11, value);
};
goog.object.extend(exports, proto.gink);
//# sourceMappingURL=bundle_pb.js.map