mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-11 21:15:01 +00:00
Merge branch 'master' into chore/new-store-tests
This commit is contained in:
commit
94d63f4548
@ -246,6 +246,16 @@ class Store extends BaseProtocol implements IStore {
|
|||||||
|
|
||||||
ensurePubsubTopicIsConfigured(pubSubTopicForQuery, this.pubSubTopics);
|
ensurePubsubTopicIsConfigured(pubSubTopicForQuery, this.pubSubTopics);
|
||||||
|
|
||||||
|
// check that the pubSubTopic from the Cursor and Decoder match
|
||||||
|
if (
|
||||||
|
options?.cursor?.pubsubTopic &&
|
||||||
|
options.cursor.pubsubTopic !== pubSubTopicForQuery
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Cursor pubsub topic (${options?.cursor?.pubsubTopic}) does not match decoder pubsub topic (${pubSubTopicForQuery})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const decodersAsMap = new Map();
|
const decodersAsMap = new Map();
|
||||||
decoders.forEach((dec) => {
|
decoders.forEach((dec) => {
|
||||||
if (decodersAsMap.has(dec.contentTopic)) {
|
if (decodersAsMap.has(dec.contentTopic)) {
|
||||||
@ -397,10 +407,7 @@ async function* paginate<T extends IDecodedMessage>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createCursor(
|
export async function createCursor(message: IDecodedMessage): Promise<Cursor> {
|
||||||
message: IDecodedMessage,
|
|
||||||
pubsubTopic: string = DefaultPubSubTopic
|
|
||||||
): Promise<Cursor> {
|
|
||||||
if (
|
if (
|
||||||
!message ||
|
!message ||
|
||||||
!message.timestamp ||
|
!message.timestamp ||
|
||||||
@ -418,7 +425,7 @@ export async function createCursor(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
digest,
|
digest,
|
||||||
pubsubTopic,
|
pubsubTopic: message.pubSubTopic,
|
||||||
senderTime: messageTime,
|
senderTime: messageTime,
|
||||||
receiverTime: messageTime
|
receiverTime: messageTime
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user