Package Exports
- applesauce-core
- applesauce-core/event-store
- applesauce-core/helpers
- applesauce-core/helpers/__tests__/blossom.test
- applesauce-core/helpers/__tests__/emoji.test
- applesauce-core/helpers/__tests__/event.test
- applesauce-core/helpers/__tests__/file-metadata.test
- applesauce-core/helpers/__tests__/hidden-tags.test
- applesauce-core/helpers/__tests__/mailboxes.test
- applesauce-core/helpers/__tests__/relays.test
- applesauce-core/helpers/__tests__/tags.test
- applesauce-core/helpers/__tests__/threading.test
- applesauce-core/helpers/blossom
- applesauce-core/helpers/bolt11
- applesauce-core/helpers/bookmarks
- applesauce-core/helpers/cache
- applesauce-core/helpers/channels
- applesauce-core/helpers/comment
- applesauce-core/helpers/contacts
- applesauce-core/helpers/content
- applesauce-core/helpers/delete
- applesauce-core/helpers/dns-identity
- applesauce-core/helpers/emoji
- applesauce-core/helpers/event
- applesauce-core/helpers/external-id
- applesauce-core/helpers/file-metadata
- applesauce-core/helpers/filter
- applesauce-core/helpers/groups
- applesauce-core/helpers/hashtag
- applesauce-core/helpers/hidden-tags
- applesauce-core/helpers/index
- applesauce-core/helpers/json
- applesauce-core/helpers/lists
- applesauce-core/helpers/lnurl
- applesauce-core/helpers/lru
- applesauce-core/helpers/mailboxes
- applesauce-core/helpers/mutes
- applesauce-core/helpers/picture-post
- applesauce-core/helpers/pointers
- applesauce-core/helpers/profile
- applesauce-core/helpers/relays
- applesauce-core/helpers/share
- applesauce-core/helpers/string
- applesauce-core/helpers/tags
- applesauce-core/helpers/threading
- applesauce-core/helpers/time
- applesauce-core/helpers/url
- applesauce-core/helpers/user-status
- applesauce-core/helpers/zap
- applesauce-core/observable
- applesauce-core/promise
- applesauce-core/queries
- applesauce-core/queries/blossom
- applesauce-core/queries/bookmarks
- applesauce-core/queries/channels
- applesauce-core/queries/comments
- applesauce-core/queries/contacts
- applesauce-core/queries/index
- applesauce-core/queries/mailboxes
- applesauce-core/queries/mutes
- applesauce-core/queries/pins
- applesauce-core/queries/profile
- applesauce-core/queries/reactions
- applesauce-core/queries/simple
- applesauce-core/queries/thread
- applesauce-core/queries/user-status
- applesauce-core/queries/zaps
- applesauce-core/query-store
Readme
applesauce-core
AppleSauce Core is an interpretation layer for nostr clients, Push events into the in-memory database and get nicely formatted data out with queries
Example
import { EventStore, QueryStore } from "applesauce-core";
import { Relay } from "nostr-tools/relay";
// The EventStore handles all the events
const eventStore = new EventStore();
// The QueryStore handles queries and makes sure not to run multiple of the same query
const queryStore = new QueryStore(eventStore);
// Use nostr-tools or anything else to talk to relays
const relay = await Relay.connect("wss://relay.example.com");
const sub = relay.subscribe([{ authors: ["266815e0c9210dfa324c6cba3573b14bee49da4209a9456f9484e5106cd408a5"] }], {
onevent(event) {
eventStore.add(event);
},
});
// This will return an Observable<ProfileContent | undefined> of the parsed metadata
const profile = queryStore.profile("266815e0c9210dfa324c6cba3573b14bee49da4209a9456f9484e5106cd408a5");
profile.subscribe((parsed) => {
if (parsed) console.log(parsed);
});
// This will return an Observable<NostrEvent[]> of all kind 1 events sorted by created_at
const timeline = queryStore.timeline({ kinds: [1] });
timeline.subscribe((events) => {
console.log(events);
});