mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 23:24:22 +01:00
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
36 lines
1.9 KiB
TypeScript
36 lines
1.9 KiB
TypeScript
import { Observable } from "rxjs";
|
|
import { NostrEvent } from "nostr-tools";
|
|
import { EventFactory } from "applesauce-factory";
|
|
import { IEventStoreActions, IEventStoreRead } from "applesauce-core";
|
|
/** A callback used to tell the upstream app to publish an event */
|
|
export type PublishMethod = (event: NostrEvent) => void | Promise<void>;
|
|
/** The context that is passed to actions for them to use to preform actions */
|
|
export type ActionContext = {
|
|
/** The event store to load events from */
|
|
events: IEventStoreRead;
|
|
/** The pubkey of the signer in the event factory */
|
|
self: string;
|
|
/** The event factory used to build and modify events */
|
|
factory: EventFactory;
|
|
};
|
|
/** An action that can be run in a context to preform an action */
|
|
export type Action = (ctx: ActionContext) => Observable<NostrEvent> | AsyncGenerator<NostrEvent> | Generator<NostrEvent>;
|
|
export type ActionConstructor<Args extends Array<any>> = (...args: Args) => Action;
|
|
/** The main class that runs actions */
|
|
export declare class ActionHub {
|
|
events: IEventStoreRead & IEventStoreActions;
|
|
factory: EventFactory;
|
|
publish?: PublishMethod | undefined;
|
|
/** Whether to save all events created by actions to the event store */
|
|
saveToStore: boolean;
|
|
constructor(events: IEventStoreRead & IEventStoreActions, factory: EventFactory, publish?: PublishMethod | undefined);
|
|
protected context: ActionContext | undefined;
|
|
protected getContext(): Promise<ActionContext>;
|
|
/** Runs an action in a ActionContext and converts the result to an Observable */
|
|
static runAction(ctx: ActionContext, action: Action): Observable<NostrEvent>;
|
|
/** Run an action and publish events using the publish method */
|
|
run<Args extends Array<any>>(Action: ActionConstructor<Args>, ...args: Args): Promise<void>;
|
|
/** Run an action without publishing the events */
|
|
exec<Args extends Array<any>>(Action: ActionConstructor<Args>, ...args: Args): Observable<NostrEvent>;
|
|
}
|