UNPKG

@xmtp/proto

Version:

Protobuf client and generated classes for GRPC API

116 lines 4.11 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReaddRequest = exports.protobufPackage = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_1 = __importDefault(require("protobufjs/minimal")); exports.protobufPackage = "xmtp.mls.message_contents"; function createBaseReaddRequest() { return { groupId: new Uint8Array(), commitLogEpoch: long_1.default.UZERO }; } exports.ReaddRequest = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.groupId.length !== 0) { writer.uint32(10).bytes(message.groupId); } if (!message.commitLogEpoch.isZero()) { writer.uint32(16).uint64(message.commitLogEpoch); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseReaddRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.groupId = reader.bytes(); break; case 2: message.commitLogEpoch = reader.uint64(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { groupId: isSet(object.groupId) ? bytesFromBase64(object.groupId) : new Uint8Array(), commitLogEpoch: isSet(object.commitLogEpoch) ? long_1.default.fromValue(object.commitLogEpoch) : long_1.default.UZERO, }; }, toJSON(message) { const obj = {}; message.groupId !== undefined && (obj.groupId = base64FromBytes(message.groupId !== undefined ? message.groupId : new Uint8Array())); message.commitLogEpoch !== undefined && (obj.commitLogEpoch = (message.commitLogEpoch || long_1.default.UZERO).toString()); return obj; }, fromPartial(object) { var _a; const message = createBaseReaddRequest(); message.groupId = (_a = object.groupId) !== null && _a !== void 0 ? _a : new Uint8Array(); message.commitLogEpoch = object.commitLogEpoch !== undefined && object.commitLogEpoch !== null ? long_1.default.fromValue(object.commitLogEpoch) : long_1.default.UZERO; return message; }, }; var globalThis = (() => { if (typeof globalThis !== "undefined") return globalThis; if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; throw "Unable to locate global object"; })(); function bytesFromBase64(b64) { if (globalThis.Buffer) { return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); } return arr; } } function base64FromBytes(arr) { if (globalThis.Buffer) { return globalThis.Buffer.from(arr).toString("base64"); } else { const bin = []; arr.forEach((byte) => { bin.push(String.fromCharCode(byte)); }); return globalThis.btoa(bin.join("")); } } if (minimal_1.default.util.Long !== long_1.default) { minimal_1.default.util.Long = long_1.default; minimal_1.default.configure(); } function isSet(value) { return value !== null && value !== undefined; } //# sourceMappingURL=out_of_band.pb.js.map