chore(deps): bump protons to 5.10, protons-runtime to 3.1.0

This commit is contained in:
fryorcraken.eth 2022-09-05 14:39:24 +10:00
parent 4d4c4430f4
commit ab76063f33
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
7 changed files with 2398 additions and 860 deletions

1462
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -113,7 +113,7 @@
"js-sha3": "^0.8.0",
"libp2p": "0.38.0",
"p-event": "^5.0.1",
"protons-runtime": "^1.0.4",
"protons-runtime": "^3.1.0",
"uint8arrays": "^3.0.0",
"uuid": "^8.3.2"
},
@ -159,7 +159,7 @@
"portfinder": "^1.0.28",
"prettier": "^2.1.1",
"process": "^0.11.10",
"protons": "^3.0.4",
"protons": "^5.1.0",
"puppeteer": "^13.0.1",
"rollup": "^2.75.0",
"size-limit": "^8.0.0",

View File

@ -1,17 +1,8 @@
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/no-namespace */
import {
encodeMessage,
decodeMessage,
message,
string,
bool,
bytes,
uint32,
double,
sint64,
} from "protons-runtime";
import { encodeMessage, decodeMessage, message } from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist";
import type { Codec } from "protons-runtime";
export interface FilterRequest {
@ -26,38 +17,139 @@ export namespace FilterRequest {
}
export namespace ContentFilter {
let _codec: Codec<ContentFilter>;
export const codec = (): Codec<ContentFilter> => {
return message<ContentFilter>({
1: { name: "contentTopic", codec: string, optional: true },
});
if (_codec == null) {
_codec = message<ContentFilter>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.contentTopic != null) {
writer.uint32(10);
writer.string(obj.contentTopic);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.contentTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: ContentFilter): Uint8Array => {
return encodeMessage(obj, ContentFilter.codec());
};
export const decode = (buf: Uint8Array): ContentFilter => {
export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {
return decodeMessage(buf, ContentFilter.codec());
};
}
let _codec: Codec<FilterRequest>;
export const codec = (): Codec<FilterRequest> => {
return message<FilterRequest>({
1: { name: "subscribe", codec: bool, optional: true },
2: { name: "topic", codec: string, optional: true },
3: {
name: "contentFilters",
codec: FilterRequest.ContentFilter.codec(),
repeats: true,
},
});
if (_codec == null) {
_codec = message<FilterRequest>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.subscribe != null) {
writer.uint32(8);
writer.bool(obj.subscribe);
}
if (obj.topic != null) {
writer.uint32(18);
writer.string(obj.topic);
}
if (obj.contentFilters != null) {
for (const value of obj.contentFilters) {
writer.uint32(26);
FilterRequest.ContentFilter.codec().encode(value, writer);
}
} else {
throw new Error(
'Protocol error: required field "contentFilters" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {
contentFilters: [],
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.subscribe = reader.bool();
break;
case 2:
obj.topic = reader.string();
break;
case 3:
obj.contentFilters.push(
FilterRequest.ContentFilter.codec().decode(
reader,
reader.uint32()
)
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: FilterRequest): Uint8Array => {
return encodeMessage(obj, FilterRequest.codec());
};
export const decode = (buf: Uint8Array): FilterRequest => {
export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRequest => {
return decodeMessage(buf, FilterRequest.codec());
};
}
@ -67,17 +159,66 @@ export interface MessagePush {
}
export namespace MessagePush {
let _codec: Codec<MessagePush>;
export const codec = (): Codec<MessagePush> => {
return message<MessagePush>({
1: { name: "messages", codec: WakuMessage.codec(), repeats: true },
});
if (_codec == null) {
_codec = message<MessagePush>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.messages != null) {
for (const value of obj.messages) {
writer.uint32(10);
WakuMessage.codec().encode(value, writer);
}
} else {
throw new Error(
'Protocol error: required field "messages" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {
messages: [],
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.messages.push(
WakuMessage.codec().decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: MessagePush): Uint8Array => {
return encodeMessage(obj, MessagePush.codec());
};
export const decode = (buf: Uint8Array): MessagePush => {
export const decode = (buf: Uint8Array | Uint8ArrayList): MessagePush => {
return decodeMessage(buf, MessagePush.codec());
};
}
@ -89,19 +230,75 @@ export interface FilterRPC {
}
export namespace FilterRPC {
let _codec: Codec<FilterRPC>;
export const codec = (): Codec<FilterRPC> => {
return message<FilterRPC>({
1: { name: "requestId", codec: string, optional: true },
2: { name: "request", codec: FilterRequest.codec(), optional: true },
3: { name: "push", codec: MessagePush.codec(), optional: true },
});
if (_codec == null) {
_codec = message<FilterRPC>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.requestId != null) {
writer.uint32(10);
writer.string(obj.requestId);
}
if (obj.request != null) {
writer.uint32(18);
FilterRequest.codec().encode(obj.request, writer);
}
if (obj.push != null) {
writer.uint32(26);
MessagePush.codec().encode(obj.push, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.request = FilterRequest.codec().decode(
reader,
reader.uint32()
);
break;
case 3:
obj.push = MessagePush.codec().decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: FilterRPC): Uint8Array => {
return encodeMessage(obj, FilterRPC.codec());
};
export const decode = (buf: Uint8Array): FilterRPC => {
export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRPC => {
return decodeMessage(buf, FilterRPC.codec());
};
}
@ -115,21 +312,88 @@ export interface WakuMessage {
}
export namespace WakuMessage {
let _codec: Codec<WakuMessage>;
export const codec = (): Codec<WakuMessage> => {
return message<WakuMessage>({
1: { name: "payload", codec: bytes, optional: true },
2: { name: "contentTopic", codec: string, optional: true },
3: { name: "version", codec: uint32, optional: true },
4: { name: "timestampDeprecated", codec: double, optional: true },
10: { name: "timestamp", codec: sint64, optional: true },
});
if (_codec == null) {
_codec = message<WakuMessage>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.payload != null) {
writer.uint32(10);
writer.bytes(obj.payload);
}
if (obj.contentTopic != null) {
writer.uint32(18);
writer.string(obj.contentTopic);
}
if (obj.version != null) {
writer.uint32(24);
writer.uint32(obj.version);
}
if (obj.timestampDeprecated != null) {
writer.uint32(33);
writer.double(obj.timestampDeprecated);
}
if (obj.timestamp != null) {
writer.uint32(80);
writer.sint64(obj.timestamp);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 4:
obj.timestampDeprecated = reader.double();
break;
case 10:
obj.timestamp = reader.sint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: WakuMessage): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec());
};
export const decode = (buf: Uint8Array): WakuMessage => {
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec());
};
}

View File

@ -1,17 +1,8 @@
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/no-namespace */
import {
encodeMessage,
decodeMessage,
message,
string,
bool,
bytes,
uint32,
double,
sint64,
} from "protons-runtime";
import { encodeMessage, decodeMessage, message } from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist";
import type { Codec } from "protons-runtime";
export interface PushRequest {
@ -20,18 +11,67 @@ export interface PushRequest {
}
export namespace PushRequest {
let _codec: Codec<PushRequest>;
export const codec = (): Codec<PushRequest> => {
return message<PushRequest>({
1: { name: "pubSubTopic", codec: string, optional: true },
2: { name: "message", codec: WakuMessage.codec(), optional: true },
});
if (_codec == null) {
_codec = message<PushRequest>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.pubSubTopic != null) {
writer.uint32(10);
writer.string(obj.pubSubTopic);
}
if (obj.message != null) {
writer.uint32(18);
WakuMessage.codec().encode(obj.message, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.pubSubTopic = reader.string();
break;
case 2:
obj.message = WakuMessage.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: PushRequest): Uint8Array => {
return encodeMessage(obj, PushRequest.codec());
};
export const decode = (buf: Uint8Array): PushRequest => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PushRequest => {
return decodeMessage(buf, PushRequest.codec());
};
}
@ -42,18 +82,64 @@ export interface PushResponse {
}
export namespace PushResponse {
let _codec: Codec<PushResponse>;
export const codec = (): Codec<PushResponse> => {
return message<PushResponse>({
1: { name: "isSuccess", codec: bool, optional: true },
2: { name: "info", codec: string, optional: true },
});
if (_codec == null) {
_codec = message<PushResponse>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.isSuccess != null) {
writer.uint32(8);
writer.bool(obj.isSuccess);
}
if (obj.info != null) {
writer.uint32(18);
writer.string(obj.info);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.isSuccess = reader.bool();
break;
case 2:
obj.info = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: PushResponse): Uint8Array => {
return encodeMessage(obj, PushResponse.codec());
};
export const decode = (buf: Uint8Array): PushResponse => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PushResponse => {
return decodeMessage(buf, PushResponse.codec());
};
}
@ -65,19 +151,78 @@ export interface PushRPC {
}
export namespace PushRPC {
let _codec: Codec<PushRPC>;
export const codec = (): Codec<PushRPC> => {
return message<PushRPC>({
1: { name: "requestId", codec: string, optional: true },
2: { name: "request", codec: PushRequest.codec(), optional: true },
3: { name: "response", codec: PushResponse.codec(), optional: true },
});
if (_codec == null) {
_codec = message<PushRPC>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.requestId != null) {
writer.uint32(10);
writer.string(obj.requestId);
}
if (obj.request != null) {
writer.uint32(18);
PushRequest.codec().encode(obj.request, writer);
}
if (obj.response != null) {
writer.uint32(26);
PushResponse.codec().encode(obj.response, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.request = PushRequest.codec().decode(
reader,
reader.uint32()
);
break;
case 3:
obj.response = PushResponse.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: PushRPC): Uint8Array => {
return encodeMessage(obj, PushRPC.codec());
};
export const decode = (buf: Uint8Array): PushRPC => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PushRPC => {
return decodeMessage(buf, PushRPC.codec());
};
}
@ -91,21 +236,88 @@ export interface WakuMessage {
}
export namespace WakuMessage {
let _codec: Codec<WakuMessage>;
export const codec = (): Codec<WakuMessage> => {
return message<WakuMessage>({
1: { name: "payload", codec: bytes, optional: true },
2: { name: "contentTopic", codec: string, optional: true },
3: { name: "version", codec: uint32, optional: true },
4: { name: "timestampDeprecated", codec: double, optional: true },
10: { name: "timestamp", codec: sint64, optional: true },
});
if (_codec == null) {
_codec = message<WakuMessage>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.payload != null) {
writer.uint32(10);
writer.bytes(obj.payload);
}
if (obj.contentTopic != null) {
writer.uint32(18);
writer.string(obj.contentTopic);
}
if (obj.version != null) {
writer.uint32(24);
writer.uint32(obj.version);
}
if (obj.timestampDeprecated != null) {
writer.uint32(33);
writer.double(obj.timestampDeprecated);
}
if (obj.timestamp != null) {
writer.uint32(80);
writer.sint64(obj.timestamp);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 4:
obj.timestampDeprecated = reader.double();
break;
case 10:
obj.timestamp = reader.sint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: WakuMessage): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec());
};
export const decode = (buf: Uint8Array): WakuMessage => {
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec());
};
}

View File

@ -1,16 +1,8 @@
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/no-namespace */
import {
encodeMessage,
decodeMessage,
message,
bytes,
string,
uint32,
double,
sint64,
} from "protons-runtime";
import { encodeMessage, decodeMessage, message } from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist";
import type { Codec } from "protons-runtime";
export interface WakuMessage {
@ -22,21 +14,88 @@ export interface WakuMessage {
}
export namespace WakuMessage {
let _codec: Codec<WakuMessage>;
export const codec = (): Codec<WakuMessage> => {
return message<WakuMessage>({
1: { name: "payload", codec: bytes, optional: true },
2: { name: "contentTopic", codec: string, optional: true },
3: { name: "version", codec: uint32, optional: true },
4: { name: "timestampDeprecated", codec: double, optional: true },
10: { name: "timestamp", codec: sint64, optional: true },
});
if (_codec == null) {
_codec = message<WakuMessage>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.payload != null) {
writer.uint32(10);
writer.bytes(obj.payload);
}
if (obj.contentTopic != null) {
writer.uint32(18);
writer.string(obj.contentTopic);
}
if (obj.version != null) {
writer.uint32(24);
writer.uint32(obj.version);
}
if (obj.timestampDeprecated != null) {
writer.uint32(33);
writer.double(obj.timestampDeprecated);
}
if (obj.timestamp != null) {
writer.uint32(80);
writer.sint64(obj.timestamp);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 4:
obj.timestampDeprecated = reader.double();
break;
case 10:
obj.timestamp = reader.sint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: WakuMessage): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec());
};
export const decode = (buf: Uint8Array): WakuMessage => {
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec());
};
}

View File

@ -5,14 +5,9 @@ import {
encodeMessage,
decodeMessage,
message,
bytes,
double,
enumeration,
uint64,
string,
uint32,
sint64,
} from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist";
import type { Codec } from "protons-runtime";
export interface Index {
@ -22,19 +17,72 @@ export interface Index {
}
export namespace Index {
let _codec: Codec<Index>;
export const codec = (): Codec<Index> => {
return message<Index>({
1: { name: "digest", codec: bytes, optional: true },
2: { name: "receivedTime", codec: double, optional: true },
3: { name: "senderTime", codec: double, optional: true },
});
if (_codec == null) {
_codec = message<Index>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.digest != null) {
writer.uint32(10);
writer.bytes(obj.digest);
}
if (obj.receivedTime != null) {
writer.uint32(17);
writer.double(obj.receivedTime);
}
if (obj.senderTime != null) {
writer.uint32(25);
writer.double(obj.senderTime);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.digest = reader.bytes();
break;
case 2:
obj.receivedTime = reader.double();
break;
case 3:
obj.senderTime = reader.double();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: Index): Uint8Array => {
return encodeMessage(obj, Index.codec());
};
export const decode = (buf: Uint8Array): Index => {
export const decode = (buf: Uint8Array | Uint8ArrayList): Index => {
return decodeMessage(buf, Index.codec());
};
}
@ -58,27 +106,76 @@ export namespace PagingInfo {
export namespace Direction {
export const codec = () => {
return enumeration<typeof Direction>(__DirectionValues);
return enumeration<Direction>(__DirectionValues);
};
}
let _codec: Codec<PagingInfo>;
export const codec = (): Codec<PagingInfo> => {
return message<PagingInfo>({
1: { name: "pageSize", codec: uint64, optional: true },
2: { name: "cursor", codec: Index.codec(), optional: true },
3: {
name: "direction",
codec: PagingInfo.Direction.codec(),
optional: true,
},
});
if (_codec == null) {
_codec = message<PagingInfo>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.pageSize != null) {
writer.uint32(8);
writer.uint64(obj.pageSize);
}
if (obj.cursor != null) {
writer.uint32(18);
Index.codec().encode(obj.cursor, writer);
}
if (obj.direction != null) {
writer.uint32(24);
PagingInfo.Direction.codec().encode(obj.direction, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.pageSize = reader.uint64();
break;
case 2:
obj.cursor = Index.codec().decode(reader, reader.uint32());
break;
case 3:
obj.direction = PagingInfo.Direction.codec().decode(reader);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: PagingInfo): Uint8Array => {
return encodeMessage(obj, PagingInfo.codec());
};
export const decode = (buf: Uint8Array): PagingInfo => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PagingInfo => {
return decodeMessage(buf, PagingInfo.codec());
};
}
@ -88,17 +185,56 @@ export interface ContentFilter {
}
export namespace ContentFilter {
let _codec: Codec<ContentFilter>;
export const codec = (): Codec<ContentFilter> => {
return message<ContentFilter>({
1: { name: "contentTopic", codec: string, optional: true },
});
if (_codec == null) {
_codec = message<ContentFilter>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.contentTopic != null) {
writer.uint32(10);
writer.string(obj.contentTopic);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.contentTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: ContentFilter): Uint8Array => {
return encodeMessage(obj, ContentFilter.codec());
};
export const decode = (buf: Uint8Array): ContentFilter => {
export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {
return decodeMessage(buf, ContentFilter.codec());
};
}
@ -112,25 +248,101 @@ export interface HistoryQuery {
}
export namespace HistoryQuery {
let _codec: Codec<HistoryQuery>;
export const codec = (): Codec<HistoryQuery> => {
return message<HistoryQuery>({
2: { name: "pubSubTopic", codec: string, optional: true },
3: {
name: "contentFilters",
codec: ContentFilter.codec(),
repeats: true,
},
4: { name: "pagingInfo", codec: PagingInfo.codec(), optional: true },
5: { name: "startTime", codec: double, optional: true },
6: { name: "endTime", codec: double, optional: true },
});
if (_codec == null) {
_codec = message<HistoryQuery>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.pubSubTopic != null) {
writer.uint32(18);
writer.string(obj.pubSubTopic);
}
if (obj.contentFilters != null) {
for (const value of obj.contentFilters) {
writer.uint32(26);
ContentFilter.codec().encode(value, writer);
}
} else {
throw new Error(
'Protocol error: required field "contentFilters" was not found in object'
);
}
if (obj.pagingInfo != null) {
writer.uint32(34);
PagingInfo.codec().encode(obj.pagingInfo, writer);
}
if (obj.startTime != null) {
writer.uint32(41);
writer.double(obj.startTime);
}
if (obj.endTime != null) {
writer.uint32(49);
writer.double(obj.endTime);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {
contentFilters: [],
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
obj.pubSubTopic = reader.string();
break;
case 3:
obj.contentFilters.push(
ContentFilter.codec().decode(reader, reader.uint32())
);
break;
case 4:
obj.pagingInfo = PagingInfo.codec().decode(
reader,
reader.uint32()
);
break;
case 5:
obj.startTime = reader.double();
break;
case 6:
obj.endTime = reader.double();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: HistoryQuery): Uint8Array => {
return encodeMessage(obj, HistoryQuery.codec());
};
export const decode = (buf: Uint8Array): HistoryQuery => {
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryQuery => {
return decodeMessage(buf, HistoryQuery.codec());
};
}
@ -154,27 +366,89 @@ export namespace HistoryResponse {
export namespace HistoryError {
export const codec = () => {
return enumeration<typeof HistoryError>(__HistoryErrorValues);
return enumeration<HistoryError>(__HistoryErrorValues);
};
}
let _codec: Codec<HistoryResponse>;
export const codec = (): Codec<HistoryResponse> => {
return message<HistoryResponse>({
2: { name: "messages", codec: WakuMessage.codec(), repeats: true },
3: { name: "pagingInfo", codec: PagingInfo.codec(), optional: true },
4: {
name: "error",
codec: HistoryResponse.HistoryError.codec(),
optional: true,
},
});
if (_codec == null) {
_codec = message<HistoryResponse>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.messages != null) {
for (const value of obj.messages) {
writer.uint32(18);
WakuMessage.codec().encode(value, writer);
}
} else {
throw new Error(
'Protocol error: required field "messages" was not found in object'
);
}
if (obj.pagingInfo != null) {
writer.uint32(26);
PagingInfo.codec().encode(obj.pagingInfo, writer);
}
if (obj.error != null) {
writer.uint32(32);
HistoryResponse.HistoryError.codec().encode(obj.error, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {
messages: [],
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
obj.messages.push(
WakuMessage.codec().decode(reader, reader.uint32())
);
break;
case 3:
obj.pagingInfo = PagingInfo.codec().decode(
reader,
reader.uint32()
);
break;
case 4:
obj.error = HistoryResponse.HistoryError.codec().decode(reader);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: HistoryResponse): Uint8Array => {
return encodeMessage(obj, HistoryResponse.codec());
};
export const decode = (buf: Uint8Array): HistoryResponse => {
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryResponse => {
return decodeMessage(buf, HistoryResponse.codec());
};
}
@ -186,19 +460,78 @@ export interface HistoryRPC {
}
export namespace HistoryRPC {
let _codec: Codec<HistoryRPC>;
export const codec = (): Codec<HistoryRPC> => {
return message<HistoryRPC>({
1: { name: "requestId", codec: string, optional: true },
2: { name: "query", codec: HistoryQuery.codec(), optional: true },
3: { name: "response", codec: HistoryResponse.codec(), optional: true },
});
if (_codec == null) {
_codec = message<HistoryRPC>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.requestId != null) {
writer.uint32(10);
writer.string(obj.requestId);
}
if (obj.query != null) {
writer.uint32(18);
HistoryQuery.codec().encode(obj.query, writer);
}
if (obj.response != null) {
writer.uint32(26);
HistoryResponse.codec().encode(obj.response, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.query = HistoryQuery.codec().decode(
reader,
reader.uint32()
);
break;
case 3:
obj.response = HistoryResponse.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: HistoryRPC): Uint8Array => {
return encodeMessage(obj, HistoryRPC.codec());
};
export const decode = (buf: Uint8Array): HistoryRPC => {
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryRPC => {
return decodeMessage(buf, HistoryRPC.codec());
};
}
@ -212,21 +545,88 @@ export interface WakuMessage {
}
export namespace WakuMessage {
let _codec: Codec<WakuMessage>;
export const codec = (): Codec<WakuMessage> => {
return message<WakuMessage>({
1: { name: "payload", codec: bytes, optional: true },
2: { name: "contentTopic", codec: string, optional: true },
3: { name: "version", codec: uint32, optional: true },
4: { name: "timestampDeprecated", codec: double, optional: true },
10: { name: "timestamp", codec: sint64, optional: true },
});
if (_codec == null) {
_codec = message<WakuMessage>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.payload != null) {
writer.uint32(10);
writer.bytes(obj.payload);
}
if (obj.contentTopic != null) {
writer.uint32(18);
writer.string(obj.contentTopic);
}
if (obj.version != null) {
writer.uint32(24);
writer.uint32(obj.version);
}
if (obj.timestampDeprecated != null) {
writer.uint32(33);
writer.double(obj.timestampDeprecated);
}
if (obj.timestamp != null) {
writer.uint32(80);
writer.sint64(obj.timestamp);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 4:
obj.timestampDeprecated = reader.double();
break;
case 10:
obj.timestamp = reader.sint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: WakuMessage): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec());
};
export const decode = (buf: Uint8Array): WakuMessage => {
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec());
};
}

View File

@ -5,14 +5,9 @@ import {
encodeMessage,
decodeMessage,
message,
bytes,
sint64,
string,
enumeration,
uint64,
uint32,
double,
} from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist";
import type { Codec } from "protons-runtime";
export interface Index {
@ -23,20 +18,80 @@ export interface Index {
}
export namespace Index {
let _codec: Codec<Index>;
export const codec = (): Codec<Index> => {
return message<Index>({
1: { name: "digest", codec: bytes, optional: true },
2: { name: "receivedTime", codec: sint64, optional: true },
3: { name: "senderTime", codec: sint64, optional: true },
4: { name: "pubsubTopic", codec: string, optional: true },
});
if (_codec == null) {
_codec = message<Index>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.digest != null) {
writer.uint32(10);
writer.bytes(obj.digest);
}
if (obj.receivedTime != null) {
writer.uint32(16);
writer.sint64(obj.receivedTime);
}
if (obj.senderTime != null) {
writer.uint32(24);
writer.sint64(obj.senderTime);
}
if (obj.pubsubTopic != null) {
writer.uint32(34);
writer.string(obj.pubsubTopic);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.digest = reader.bytes();
break;
case 2:
obj.receivedTime = reader.sint64();
break;
case 3:
obj.senderTime = reader.sint64();
break;
case 4:
obj.pubsubTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: Index): Uint8Array => {
return encodeMessage(obj, Index.codec());
};
export const decode = (buf: Uint8Array): Index => {
export const decode = (buf: Uint8Array | Uint8ArrayList): Index => {
return decodeMessage(buf, Index.codec());
};
}
@ -60,27 +115,76 @@ export namespace PagingInfo {
export namespace Direction {
export const codec = () => {
return enumeration<typeof Direction>(__DirectionValues);
return enumeration<Direction>(__DirectionValues);
};
}
let _codec: Codec<PagingInfo>;
export const codec = (): Codec<PagingInfo> => {
return message<PagingInfo>({
1: { name: "pageSize", codec: uint64, optional: true },
2: { name: "cursor", codec: Index.codec(), optional: true },
3: {
name: "direction",
codec: PagingInfo.Direction.codec(),
optional: true,
},
});
if (_codec == null) {
_codec = message<PagingInfo>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.pageSize != null) {
writer.uint32(8);
writer.uint64(obj.pageSize);
}
if (obj.cursor != null) {
writer.uint32(18);
Index.codec().encode(obj.cursor, writer);
}
if (obj.direction != null) {
writer.uint32(24);
PagingInfo.Direction.codec().encode(obj.direction, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.pageSize = reader.uint64();
break;
case 2:
obj.cursor = Index.codec().decode(reader, reader.uint32());
break;
case 3:
obj.direction = PagingInfo.Direction.codec().decode(reader);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: PagingInfo): Uint8Array => {
return encodeMessage(obj, PagingInfo.codec());
};
export const decode = (buf: Uint8Array): PagingInfo => {
export const decode = (buf: Uint8Array | Uint8ArrayList): PagingInfo => {
return decodeMessage(buf, PagingInfo.codec());
};
}
@ -90,17 +194,56 @@ export interface ContentFilter {
}
export namespace ContentFilter {
let _codec: Codec<ContentFilter>;
export const codec = (): Codec<ContentFilter> => {
return message<ContentFilter>({
1: { name: "contentTopic", codec: string, optional: true },
});
if (_codec == null) {
_codec = message<ContentFilter>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.contentTopic != null) {
writer.uint32(10);
writer.string(obj.contentTopic);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.contentTopic = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: ContentFilter): Uint8Array => {
return encodeMessage(obj, ContentFilter.codec());
};
export const decode = (buf: Uint8Array): ContentFilter => {
export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {
return decodeMessage(buf, ContentFilter.codec());
};
}
@ -114,25 +257,101 @@ export interface HistoryQuery {
}
export namespace HistoryQuery {
let _codec: Codec<HistoryQuery>;
export const codec = (): Codec<HistoryQuery> => {
return message<HistoryQuery>({
2: { name: "pubSubTopic", codec: string, optional: true },
3: {
name: "contentFilters",
codec: ContentFilter.codec(),
repeats: true,
},
4: { name: "pagingInfo", codec: PagingInfo.codec(), optional: true },
5: { name: "startTime", codec: sint64, optional: true },
6: { name: "endTime", codec: sint64, optional: true },
});
if (_codec == null) {
_codec = message<HistoryQuery>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.pubSubTopic != null) {
writer.uint32(18);
writer.string(obj.pubSubTopic);
}
if (obj.contentFilters != null) {
for (const value of obj.contentFilters) {
writer.uint32(26);
ContentFilter.codec().encode(value, writer);
}
} else {
throw new Error(
'Protocol error: required field "contentFilters" was not found in object'
);
}
if (obj.pagingInfo != null) {
writer.uint32(34);
PagingInfo.codec().encode(obj.pagingInfo, writer);
}
if (obj.startTime != null) {
writer.uint32(40);
writer.sint64(obj.startTime);
}
if (obj.endTime != null) {
writer.uint32(48);
writer.sint64(obj.endTime);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {
contentFilters: [],
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
obj.pubSubTopic = reader.string();
break;
case 3:
obj.contentFilters.push(
ContentFilter.codec().decode(reader, reader.uint32())
);
break;
case 4:
obj.pagingInfo = PagingInfo.codec().decode(
reader,
reader.uint32()
);
break;
case 5:
obj.startTime = reader.sint64();
break;
case 6:
obj.endTime = reader.sint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: HistoryQuery): Uint8Array => {
return encodeMessage(obj, HistoryQuery.codec());
};
export const decode = (buf: Uint8Array): HistoryQuery => {
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryQuery => {
return decodeMessage(buf, HistoryQuery.codec());
};
}
@ -156,27 +375,89 @@ export namespace HistoryResponse {
export namespace HistoryError {
export const codec = () => {
return enumeration<typeof HistoryError>(__HistoryErrorValues);
return enumeration<HistoryError>(__HistoryErrorValues);
};
}
let _codec: Codec<HistoryResponse>;
export const codec = (): Codec<HistoryResponse> => {
return message<HistoryResponse>({
2: { name: "messages", codec: WakuMessage.codec(), repeats: true },
3: { name: "pagingInfo", codec: PagingInfo.codec(), optional: true },
4: {
name: "error",
codec: HistoryResponse.HistoryError.codec(),
optional: true,
},
});
if (_codec == null) {
_codec = message<HistoryResponse>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.messages != null) {
for (const value of obj.messages) {
writer.uint32(18);
WakuMessage.codec().encode(value, writer);
}
} else {
throw new Error(
'Protocol error: required field "messages" was not found in object'
);
}
if (obj.pagingInfo != null) {
writer.uint32(26);
PagingInfo.codec().encode(obj.pagingInfo, writer);
}
if (obj.error != null) {
writer.uint32(32);
HistoryResponse.HistoryError.codec().encode(obj.error, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {
messages: [],
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
obj.messages.push(
WakuMessage.codec().decode(reader, reader.uint32())
);
break;
case 3:
obj.pagingInfo = PagingInfo.codec().decode(
reader,
reader.uint32()
);
break;
case 4:
obj.error = HistoryResponse.HistoryError.codec().decode(reader);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: HistoryResponse): Uint8Array => {
return encodeMessage(obj, HistoryResponse.codec());
};
export const decode = (buf: Uint8Array): HistoryResponse => {
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryResponse => {
return decodeMessage(buf, HistoryResponse.codec());
};
}
@ -188,19 +469,78 @@ export interface HistoryRPC {
}
export namespace HistoryRPC {
let _codec: Codec<HistoryRPC>;
export const codec = (): Codec<HistoryRPC> => {
return message<HistoryRPC>({
1: { name: "requestId", codec: string, optional: true },
2: { name: "query", codec: HistoryQuery.codec(), optional: true },
3: { name: "response", codec: HistoryResponse.codec(), optional: true },
});
if (_codec == null) {
_codec = message<HistoryRPC>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.requestId != null) {
writer.uint32(10);
writer.string(obj.requestId);
}
if (obj.query != null) {
writer.uint32(18);
HistoryQuery.codec().encode(obj.query, writer);
}
if (obj.response != null) {
writer.uint32(26);
HistoryResponse.codec().encode(obj.response, writer);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.requestId = reader.string();
break;
case 2:
obj.query = HistoryQuery.codec().decode(
reader,
reader.uint32()
);
break;
case 3:
obj.response = HistoryResponse.codec().decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: HistoryRPC): Uint8Array => {
return encodeMessage(obj, HistoryRPC.codec());
};
export const decode = (buf: Uint8Array): HistoryRPC => {
export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryRPC => {
return decodeMessage(buf, HistoryRPC.codec());
};
}
@ -214,21 +554,88 @@ export interface WakuMessage {
}
export namespace WakuMessage {
let _codec: Codec<WakuMessage>;
export const codec = (): Codec<WakuMessage> => {
return message<WakuMessage>({
1: { name: "payload", codec: bytes, optional: true },
2: { name: "contentTopic", codec: string, optional: true },
3: { name: "version", codec: uint32, optional: true },
4: { name: "timestampDeprecated", codec: double, optional: true },
10: { name: "timestamp", codec: sint64, optional: true },
});
if (_codec == null) {
_codec = message<WakuMessage>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.payload != null) {
writer.uint32(10);
writer.bytes(obj.payload);
}
if (obj.contentTopic != null) {
writer.uint32(18);
writer.string(obj.contentTopic);
}
if (obj.version != null) {
writer.uint32(24);
writer.uint32(obj.version);
}
if (obj.timestampDeprecated != null) {
writer.uint32(33);
writer.double(obj.timestampDeprecated);
}
if (obj.timestamp != null) {
writer.uint32(80);
writer.sint64(obj.timestamp);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(reader, length) => {
const obj: any = {};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.payload = reader.bytes();
break;
case 2:
obj.contentTopic = reader.string();
break;
case 3:
obj.version = reader.uint32();
break;
case 4:
obj.timestampDeprecated = reader.double();
break;
case 10:
obj.timestamp = reader.sint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: WakuMessage): Uint8Array => {
return encodeMessage(obj, WakuMessage.codec());
};
export const decode = (buf: Uint8Array): WakuMessage => {
export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {
return decodeMessage(buf, WakuMessage.codec());
};
}