mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
chore(ai): doc js/nostr/client.js (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
0e9f9204a1
commit
3862415340
2 files changed
+4
-3
No files matched your search
@@ -20,7 +20,7 @@ The client maintains three primary state maps to ensure data consistency:
|
||||
|
||||
* **`activeMap`** (`Map<string, VideoObject>`):
|
||||
* The "materialized view" used by the UI.
|
||||
* Keys are `videoRootId` (for versioned edits) or `pubkey:dTag` (for addressable events).
|
||||
* Keys are `videoRootId` (prefixed with `ROOT:`) for versioned edits, or `pubkey:dTag` for addressable events.
|
||||
* Values are the *latest* valid version of the video.
|
||||
* **Invariant**: Only one entry exists per "video entity", ensuring the UI displays the most recent edit.
|
||||
|
||||
@@ -36,7 +36,7 @@ The `subscribeVideos` method implements a buffered ingestion pipeline to handle
|
||||
|
||||
1. **Subscription**: Opens a subscription to all connected relays.
|
||||
2. **Buffering**: Incoming events are pushed to an `eventBuffer` array immediately.
|
||||
3. **Debouncing**: A timer flushes the buffer every ~250ms (or when full).
|
||||
3. **Debouncing**: A timer flushes the buffer every ~75ms (or when full).
|
||||
4. **Processing (Flush)**:
|
||||
* Events are parsed and validated.
|
||||
* **Tombstone Check**: If an event predates a known deletion, it is discarded.
|
||||
|
||||
+2
-1
@@ -3881,7 +3881,7 @@ export class NostrClient {
|
||||
* - Updates the `SyncMetadataStore` with the new max `created_at` on success.
|
||||
*
|
||||
* **Concurrency:**
|
||||
* - Batches relay requests in chunks of 4 to avoid saturating network connections.
|
||||
* - Batches relay requests in chunks of 8 to avoid saturating network connections.
|
||||
*
|
||||
* @param {object} params
|
||||
* @param {number} params.kind - The event kind to fetch (e.g. 10000 for mute list).
|
||||
@@ -3889,6 +3889,7 @@ export class NostrClient {
|
||||
* @param {string} [params.dTag] - Optional d-tag for addressable events (NIP-33).
|
||||
* @param {string[]} [params.relayUrls] - List of relays to query. Defaults to client's configured relays.
|
||||
* @param {function} [params.fetchFn] - Custom fetch function (mocks or specialized logic). Defaults to `pool.list`.
|
||||
* @param {number} [params.since] - Explicit start timestamp (overrides storage).
|
||||
* @param {number} [params.timeoutMs] - Optional per-relay timeout for list fetches; defaults to a higher list-friendly baseline.
|
||||
* @returns {Promise<import("nostr-tools").Event[]>} Deduplicated list of events found across all relays.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user