UNPKG

node-red-contrib-nostr

Version:

Node-RED nodes for seamless Nostr protocol integration. Features robust WebSocket handling, event filtering, and NPUB-based routing. Built with TypeScript for type safety and extensive testing. Perfect for Nostr automation flows.

53 lines (52 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FilterBuilder = void 0; class FilterBuilder { constructor() { this.filter = {}; } withIds(ids) { this.filter.ids = ids; return this; } withAuthors(authors) { this.filter.authors = authors; return this; } withKinds(kinds) { this.filter.kinds = kinds; return this; } withSince(timestamp) { this.filter.since = timestamp; return this; } withUntil(timestamp) { this.filter.until = timestamp; return this; } withLimit(limit) { this.filter.limit = limit; return this; } withSearch(search) { this.filter.search = search; return this; } build() { return { ...this.filter }; } static createTextNoteFilter(limit = 10) { return new FilterBuilder() .withKinds([1]) .withLimit(limit) .build(); } static createUserMetadataFilter(pubkeys) { return new FilterBuilder() .withKinds([0]) .withAuthors(pubkeys) .build(); } } exports.FilterBuilder = FilterBuilder;