diff --git a/docs/nostr-event-schemas.md b/docs/nostr-event-schemas.md index 02074863..d3e97fd4 100644 --- a/docs/nostr-event-schemas.md +++ b/docs/nostr-event-schemas.md @@ -99,8 +99,11 @@ timestamps. `nostrClient` instance, registers it with the runtime via `registerNostrClient`, and exposes helpers like `requestDefaultExtensionPermissions`. Import the singleton or permission helper -from this module (or from the `js/nostr.js` barrel) whenever you need to run a -NIP-07 handshake. New NIP features should reuse this bootstrapper instead of +from this module or from the canonical export barrel at +[`js/nostr/index.js`](../js/nostr/index.js) whenever you need to run a NIP-07 +handshake. `js/nostr.js` re-exports the default client alongside the +singleton-aware bindings for view counters and watch history so legacy imports +continue to resolve. New NIP features should reuse this bootstrapper instead of creating bespoke clients so permission caching and relay wiring stay consistent.【F:js/nostr/defaultClient.js†L1-L25】 diff --git a/js/nostr.js b/js/nostr.js index 781ffda5..c71fedec 100644 --- a/js/nostr.js +++ b/js/nostr.js @@ -4,68 +4,19 @@ import { nostrClient, requestDefaultExtensionPermissions, } from "./nostr/defaultClient.js"; -import { + +export { nostrClient, requestDefaultExtensionPermissions }; + +export { recordVideoView, listVideoViewEvents, subscribeVideoViewEvents, countVideoViewEvents, } from "./nostr/viewEventBindings.js"; -import { + +export { updateWatchHistoryList, removeWatchHistoryItem, } from "./nostr/watchHistoryBindings.js"; -export { nostrClient, requestDefaultExtensionPermissions }; - -export { updateWatchHistoryList, removeWatchHistoryItem }; - -export { - recordVideoView, - listVideoViewEvents, - subscribeVideoViewEvents, - countVideoViewEvents, -}; - -export { - __testExports, - NostrClient, - getActiveSigner, - setActiveSigner, - clearActiveSigner, - resolveActiveSigner, - shouldRequestExtensionPermissions, -} from "./nostr/client.js"; -export { - DEFAULT_NIP07_ENCRYPTION_METHODS, - DEFAULT_NIP07_PERMISSION_METHODS, -} from "./nostr/nip07Permissions.js"; -export { - buildNip71MetadataTags, - buildNip71VideoEvent, - collectNip71PointerRequests, - extractNip71MetadataFromTags, - getDTagValueFromTags, - mergeNip71MetadataIntoVideo, - populateNip71MetadataForVideos, - processNip71Events, - buildVideoPointerValue, - stringFromInput, -} from "./nostr/nip71.js"; -export { - normalizePointerInput, - pointerKey, - chunkWatchHistoryPayloadItems, - normalizeActorKey, - parseWatchHistoryContentWithFallback, - isNip04EncryptedWatchHistoryEvent, - watchHistoryHelpers, -} from "./nostr/watchHistory.js"; -export { - deriveViewEventBucketIndex, - deriveViewEventPointerScope, - hasRecentViewPublish, - rememberViewPublish, - createVideoViewEventFilters, - getViewEventGuardWindowMs, -} from "./nostr/viewEvents.js"; -export { convertEventToVideo } from "./nostr/nip71.js"; +export * from "./nostr/index.js"; diff --git a/js/nostr/index.js b/js/nostr/index.js index f7e4b76e..7ace6392 100644 --- a/js/nostr/index.js +++ b/js/nostr/index.js @@ -1,4 +1,5 @@ export { + __testExports, NostrClient, getActiveSigner, setActiveSigner,