@waku/proto
Version:
Protobuf definitions for Waku
127 lines • 5 kB
JavaScript
/* eslint-disable import/export */
/* eslint-disable complexity */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-empty-interface */
/* eslint-disable import/consistent-type-specifier-style */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { decodeMessage, encodeMessage, MaxLengthError, message } from 'protons-runtime';
export var WakuMetadataRequest;
(function (WakuMetadataRequest) {
let _codec;
WakuMetadataRequest.codec = () => {
if (_codec == null) {
_codec = message((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
w.fork();
}
if (obj.clusterId != null) {
w.uint32(8);
w.uint32(obj.clusterId);
}
if (obj.shards != null) {
for (const value of obj.shards) {
w.uint32(16);
w.uint32(value);
}
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
}, (reader, length, opts = {}) => {
const obj = {
shards: []
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
obj.clusterId = reader.uint32();
break;
}
case 2: {
if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {
throw new MaxLengthError('Decode error - map field "shards" had too many elements');
}
obj.shards.push(reader.uint32());
break;
}
default: {
reader.skipType(tag & 7);
break;
}
}
}
return obj;
});
}
return _codec;
};
WakuMetadataRequest.encode = (obj) => {
return encodeMessage(obj, WakuMetadataRequest.codec());
};
WakuMetadataRequest.decode = (buf, opts) => {
return decodeMessage(buf, WakuMetadataRequest.codec(), opts);
};
})(WakuMetadataRequest || (WakuMetadataRequest = {}));
export var WakuMetadataResponse;
(function (WakuMetadataResponse) {
let _codec;
WakuMetadataResponse.codec = () => {
if (_codec == null) {
_codec = message((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
w.fork();
}
if (obj.clusterId != null) {
w.uint32(8);
w.uint32(obj.clusterId);
}
if (obj.shards != null) {
for (const value of obj.shards) {
w.uint32(16);
w.uint32(value);
}
}
if (opts.lengthDelimited !== false) {
w.ldelim();
}
}, (reader, length, opts = {}) => {
const obj = {
shards: []
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
obj.clusterId = reader.uint32();
break;
}
case 2: {
if (opts.limits?.shards != null && obj.shards.length === opts.limits.shards) {
throw new MaxLengthError('Decode error - map field "shards" had too many elements');
}
obj.shards.push(reader.uint32());
break;
}
default: {
reader.skipType(tag & 7);
break;
}
}
}
return obj;
});
}
return _codec;
};
WakuMetadataResponse.encode = (obj) => {
return encodeMessage(obj, WakuMetadataResponse.codec());
};
WakuMetadataResponse.decode = (buf, opts) => {
return decodeMessage(buf, WakuMetadataResponse.codec(), opts);
};
})(WakuMetadataResponse || (WakuMetadataResponse = {}));
//# sourceMappingURL=metadata.js.map