New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

applesauce-core

Package Overview
Dependencies
Maintainers
0
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

applesauce-core

AppleSauce Core is an interpretation layer for nostr clients, Push events into the in-memory [database](https://hzrd149.github.io/applesauce/typedoc/classes/Database.html) and get nicely formatted data out with [queries](https://hzrd149.github.io/applesau

  • 0.0.0-next-20250130174055
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
increased by26.51%
Maintainers
0
Weekly downloads
 
Created
Source

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);
});

Keywords

FAQs

Package last updated on 30 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc