From 09369a012242783e81110772e22801c3ca80343b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 16 Mar 2024 13:19:11 -0500 Subject: [PATCH] hydrateEvent -> purifyEvent (it sounds cooler) --- src/pipeline.ts | 4 ++-- src/storages/events-db.ts | 4 ++-- src/storages/hydrate.ts | 4 ++-- src/storages/pool-store.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index 2dc9230..d765711 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -5,7 +5,7 @@ import { Debug, LNURL, type NostrEvent } from '@/deps.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { isEphemeralKind } from '@/kinds.ts'; import { updateStats } from '@/stats.ts'; -import { dehydrateEvent } from '@/storages/hydrate.ts'; +import { purifyEvent } from '@/storages/hydrate.ts'; import { cache, client, eventsDB, reqmeister } from '@/storages.ts'; import { Sub } from '@/subs.ts'; import { getTagSet } from '@/tags.ts'; @@ -225,7 +225,7 @@ async function payZap(event: DittoEvent, signal: AbortSignal) { const { pr } = await LNURL.callback( details.callback, - { amount, nostr: dehydrateEvent(event), lnurl }, + { amount, nostr: purifyEvent(event), lnurl }, { fetch: fetchWorker, signal }, ); diff --git a/src/storages/events-db.ts b/src/storages/events-db.ts index 37573aa..0253ef3 100644 --- a/src/storages/events-db.ts +++ b/src/storages/events-db.ts @@ -6,7 +6,7 @@ import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { type DittoFilter } from '@/interfaces/DittoFilter.ts'; import { isDittoInternalKind, isParameterizedReplaceableKind, isReplaceableKind } from '@/kinds.ts'; import { jsonMetaContentSchema } from '@/schemas/nostr.ts'; -import { dehydrateEvent } from '@/storages/hydrate.ts'; +import { purifyEvent } from '@/storages/hydrate.ts'; import { isNostrId, isURL } from '@/utils.ts'; import { abortError } from '@/utils/abort.ts'; @@ -67,7 +67,7 @@ class EventsDB implements NStore { /** Insert an event (and its tags) into the database. */ async event(event: NostrEvent, _opts?: NStoreOpts): Promise { - event = dehydrateEvent(event); + event = purifyEvent(event); this.#debug('EVENT', JSON.stringify(event)); if (isDittoInternalKind(event.kind) && event.pubkey !== Conf.pubkey) { diff --git a/src/storages/hydrate.ts b/src/storages/hydrate.ts index 403a74a..91b3f43 100644 --- a/src/storages/hydrate.ts +++ b/src/storages/hydrate.ts @@ -30,7 +30,7 @@ async function hydrateEvents(opts: HydrateEventOpts): Promise { } /** Return a normalized event without any non-standard keys. */ -function dehydrateEvent(event: DittoEvent): NostrEvent { +function purifyEvent(event: DittoEvent): NostrEvent { return { id: event.id, pubkey: event.pubkey, @@ -42,4 +42,4 @@ function dehydrateEvent(event: DittoEvent): NostrEvent { }; } -export { dehydrateEvent, hydrateEvents }; +export { hydrateEvents, purifyEvent }; diff --git a/src/storages/pool-store.ts b/src/storages/pool-store.ts index c98cdab..3d4b5d4 100644 --- a/src/storages/pool-store.ts +++ b/src/storages/pool-store.ts @@ -9,7 +9,7 @@ import { type RelayPoolWorker, } from '@/deps.ts'; import { normalizeFilters } from '@/filter.ts'; -import { dehydrateEvent } from '@/storages/hydrate.ts'; +import { purifyEvent } from '@/storages/hydrate.ts'; import { abortError } from '@/utils/abort.ts'; interface PoolStoreOpts { @@ -38,7 +38,7 @@ class PoolStore implements NStore { if (opts.signal?.aborted) return Promise.reject(abortError()); const { relays = this.#relays } = opts; - event = dehydrateEvent(event); + event = purifyEvent(event); this.#debug('EVENT', event); this.#pool.publish(event, relays);