JSPM

applesauce-actions

0.0.0-next-20250723224513
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 105
    • Score
      100M100P100Q90639F
    • License MIT

    A package for performing common nostr actions

    Package Exports

    • applesauce-actions
    • applesauce-actions/actions
    • applesauce-actions/actions/__tests__/blossom.test
    • applesauce-actions/actions/__tests__/bookmarks.test
    • applesauce-actions/actions/__tests__/contacts.test
    • applesauce-actions/actions/__tests__/exports.test
    • applesauce-actions/actions/__tests__/follow-sets.test
    • applesauce-actions/actions/__tests__/mute.test
    • applesauce-actions/actions/blocked-relays
    • applesauce-actions/actions/blossom
    • applesauce-actions/actions/bookmarks
    • applesauce-actions/actions/calendar
    • applesauce-actions/actions/contacts
    • applesauce-actions/actions/dm-relays
    • applesauce-actions/actions/favorite-relays
    • applesauce-actions/actions/follow-sets
    • applesauce-actions/actions/index
    • applesauce-actions/actions/legacy-messages
    • applesauce-actions/actions/lists
    • applesauce-actions/actions/mailboxes
    • applesauce-actions/actions/mute
    • applesauce-actions/actions/pins
    • applesauce-actions/actions/profile
    • applesauce-actions/actions/relay-sets
    • applesauce-actions/actions/search-relays
    • applesauce-actions/actions/wrapped-messages

    Readme

    Applesauce Actions

    A collection of pre-built actions nostr clients can use. Built on top of applesauce-core and applesauce-factory.

    Documentation

    Installation

    npm install applesauce-actions

    Overview

    Actions are common pre-built async operations that apps can perform. They use:

    • EventStore for access to known nostr events
    • EventFactory to build and sign new nostr events
    • A publish method to publish or save the resulting events

    The package provides an ActionHub class that combines these components into a single manager for easier action execution.

    Basic Usage

    import { ActionHub } from "applesauce-actions";
    import { FollowUser } from "applesauce-actions/actions";
    
    async function publishEvent(event: NostrEvent) {
      await relayPool.publish(event, ["wss://relay.example.com"]);
    }
    
    // Create an action hub with your event store, factory and publish method
    const hub = new ActionHub(eventStore, eventFactory, publishEvent);
    
    // Example: Follow a user
    await hub
      .exec(FollowUser, "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d")
      .forEach((event) => publishEvent(event));

    For more detailed documentation and examples, visit the full documentation.