import { EventTemplate, NostrFilter } from '@napplet/core'; import { OutboxEventOptions, OutboxEventResult, OutboxPublishOptions, OutboxPublishResult, OutboxQueryOptions, OutboxResult, OutboxTarget, OutboxRelayPlan, OutboxSubscribeOptions, OutboxSubscription } from './types.js'; /** * Napplet NAP outbox sdk entrypoint. * * @module */ /** * @napplet/nap/outbox -- SDK helpers wrapping window.napplet.outbox. * * These convenience functions delegate to `window.napplet.outbox.*` at call time. * The shim must be imported somewhere to install the global. */ /** * Fetch one event by ID through shell-owned outbox routing. * * @param eventId Event id to fetch * @param options Optional author/relay hints and timeout * @returns Promise resolving to the outbox event result */ declare function outboxGetEvent(eventId: string, options?: OutboxEventOptions): Promise; /** Alias for {@link outboxGetEvent} on the SDK subpath. */ declare const getEvent: typeof outboxGetEvent; /** * Perform a one-shot outbox-aware query. * * @param filters NIP-01 filter or filters * @param options Optional query options * @returns Promise resolving to the outbox result * * @example * ```ts * import { outboxQuery } from '@napplet/nap/outbox'; * * const { events } = await outboxQuery([{ authors: ['ab12...'], kinds: [1] }]); * ``` */ declare function outboxQuery(filters: NostrFilter | NostrFilter[], options?: OutboxQueryOptions): Promise; /** Alias for {@link outboxQuery} on the SDK subpath. */ declare const query: typeof outboxQuery; /** * Open a live outbox-aware subscription. * * @param filters NIP-01 filter or filters * @param options Optional subscribe options * @returns An OutboxSubscription handle that streams `RelayEventResult` records * * @example * ```ts * import { outboxSubscribe } from '@napplet/nap/outbox'; * * const sub = outboxSubscribe([{ kinds: [1] }], { timeoutMs: 3000 }); * sub.on('event', (event) => render(event)); * ``` */ declare function outboxSubscribe(filters: NostrFilter | NostrFilter[], options?: OutboxSubscribeOptions): OutboxSubscription; /** Alias for {@link outboxSubscribe} on the SDK subpath. */ declare const subscribe: typeof outboxSubscribe; /** * Publish a shell-signed event using outbox-aware relay fanout. * * @param template Unsigned event template * @param options Optional publish fanout (`relays`, `toOutbox`, `toInboxes`); * `toOutbox` defaults to true when omitted * @returns Promise resolving to the outbox publish result */ declare function outboxPublish(template: EventTemplate, options?: OutboxPublishOptions): Promise; /** Alias for {@link outboxPublish} on the SDK subpath. */ declare const publish: typeof outboxPublish; /** * Resolve the relay plan the shell would use for a read/write target. * * @param target The read/write target * @returns Promise resolving to the relay plan */ declare function outboxResolveRelays(target: OutboxTarget): Promise; /** Alias for {@link outboxResolveRelays} on the SDK subpath. */ declare const resolveRelays: typeof outboxResolveRelays; export { getEvent, outboxGetEvent, outboxPublish, outboxQuery, outboxResolveRelays, outboxSubscribe, publish, query, resolveRelays, subscribe };