mirror of https://github.com/waku-org/js-waku.git
feat: template type on store APIs
This commit is contained in:
parent
879734b780
commit
cc3b46ffbb
|
@ -106,7 +106,7 @@ export class WakuStore {
|
||||||
*/
|
*/
|
||||||
async queryOrderedCallback<T extends Message>(
|
async queryOrderedCallback<T extends Message>(
|
||||||
decoders: Decoder<T>[],
|
decoders: Decoder<T>[],
|
||||||
callback: (message: Message) => Promise<void | boolean> | boolean | void,
|
callback: (message: T) => Promise<void | boolean> | boolean | void,
|
||||||
options?: QueryOptions
|
options?: QueryOptions
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const abort = false;
|
const abort = false;
|
||||||
|
@ -156,7 +156,7 @@ export class WakuStore {
|
||||||
async queryCallbackOnPromise<T extends Message>(
|
async queryCallbackOnPromise<T extends Message>(
|
||||||
decoders: Decoder<T>[],
|
decoders: Decoder<T>[],
|
||||||
callback: (
|
callback: (
|
||||||
message: Promise<Message | undefined>
|
message: Promise<T | undefined>
|
||||||
) => Promise<void | boolean> | boolean | void,
|
) => Promise<void | boolean> | boolean | void,
|
||||||
options?: QueryOptions
|
options?: QueryOptions
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -194,7 +194,7 @@ export class WakuStore {
|
||||||
async *queryGenerator<T extends Message>(
|
async *queryGenerator<T extends Message>(
|
||||||
decoders: Decoder<T>[],
|
decoders: Decoder<T>[],
|
||||||
options?: QueryOptions
|
options?: QueryOptions
|
||||||
): AsyncGenerator<Promise<Message | undefined>[]> {
|
): AsyncGenerator<Promise<T | undefined>[]> {
|
||||||
let startTime, endTime;
|
let startTime, endTime;
|
||||||
|
|
||||||
if (options?.timeFilter) {
|
if (options?.timeFilter) {
|
||||||
|
@ -245,7 +245,7 @@ export class WakuStore {
|
||||||
|
|
||||||
if (!connection) throw "Failed to get a connection to the peer";
|
if (!connection) throw "Failed to get a connection to the peer";
|
||||||
|
|
||||||
for await (const messages of paginate(
|
for await (const messages of paginate<T>(
|
||||||
connection,
|
connection,
|
||||||
protocol,
|
protocol,
|
||||||
queryOpts,
|
queryOpts,
|
||||||
|
|
Loading…
Reference in New Issue