File tree 1 file changed +12
-5
lines changed
packages/core/src/lib/store
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,16 @@ class Store extends BaseProtocol implements IStore {
246
246
247
247
ensurePubsubTopicIsConfigured ( pubSubTopicForQuery , this . pubSubTopics ) ;
248
248
249
+ // check that the pubSubTopic from the Cursor and Decoder match
250
+ if (
251
+ options ?. cursor ?. pubsubTopic &&
252
+ options . cursor . pubsubTopic !== pubSubTopicForQuery
253
+ ) {
254
+ throw new Error (
255
+ `Cursor pubsub topic (${ options ?. cursor ?. pubsubTopic } ) does not match decoder pubsub topic (${ pubSubTopicForQuery } )`
256
+ ) ;
257
+ }
258
+
249
259
const decodersAsMap = new Map ( ) ;
250
260
decoders . forEach ( ( dec ) => {
251
261
if ( decodersAsMap . has ( dec . contentTopic ) ) {
@@ -397,10 +407,7 @@ async function* paginate<T extends IDecodedMessage>(
397
407
}
398
408
}
399
409
400
- export async function createCursor (
401
- message : IDecodedMessage ,
402
- pubsubTopic : string = DefaultPubSubTopic
403
- ) : Promise < Cursor > {
410
+ export async function createCursor ( message : IDecodedMessage ) : Promise < Cursor > {
404
411
if (
405
412
! message ||
406
413
! message . timestamp ||
@@ -418,7 +425,7 @@ export async function createCursor(
418
425
419
426
return {
420
427
digest,
421
- pubsubTopic,
428
+ pubsubTopic : message . pubSubTopic ,
422
429
senderTime : messageTime ,
423
430
receiverTime : messageTime
424
431
} ;
You can’t perform that action at this time.
0 commit comments