From 9c91e41e87e053d6a7fb7cf9374344bfd3c17470 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 19 Apr 2024 16:39:35 -0500 Subject: [PATCH] Switch NSpec to Nostrify, update imports --- deno.json | 6 +++++- src/app.ts | 3 ++- src/controllers/api/accounts.ts | 2 +- src/controllers/api/search.ts | 4 ++-- src/controllers/api/statuses.ts | 3 ++- src/controllers/api/streaming.ts | 2 +- src/controllers/api/timelines.ts | 2 +- src/controllers/nostr/relay.ts | 2 +- src/db/users.ts | 3 ++- src/deps.ts | 13 ------------- src/filter.ts | 3 ++- src/firehose.ts | 3 ++- src/interfaces/DittoEvent.ts | 2 +- src/interfaces/DittoFilter.ts | 5 ++--- src/middleware/auth98.ts | 3 ++- src/pipeline.ts | 4 ++-- src/pipeline/DVM.ts | 2 +- src/queries.ts | 3 ++- src/signers/APISigner.ts | 3 ++- src/signers/AdminSigner.ts | 2 +- src/stats.ts | 3 ++- src/storages.ts | 2 +- src/storages/events-db.ts | 15 +++++++++------ src/storages/hydrate.ts | 2 +- src/storages/optimizer.ts | 8 ++++---- src/storages/pool-store.ts | 18 +++++------------- src/storages/reqmeister.ts | 7 ++++--- src/storages/search-store.ts | 8 ++++---- src/subs.ts | 2 +- src/subscription.ts | 4 ++-- src/utils.ts | 3 ++- src/utils/api.ts | 13 ++----------- src/utils/lnurl.ts | 3 ++- src/utils/lookup.ts | 2 +- src/utils/nip05.ts | 3 ++- src/utils/nip98.ts | 3 ++- src/views.ts | 2 +- src/views/activitypub/actor.ts | 2 +- src/views/mastodon/notifications.ts | 2 +- src/workers/verify.ts | 3 ++- src/workers/verify.worker.ts | 3 ++- 41 files changed, 85 insertions(+), 93 deletions(-) diff --git a/deno.json b/deno.json index f015e0d..0774fd9 100644 --- a/deno.json +++ b/deno.json @@ -11,7 +11,11 @@ "nsec": "deno run scripts/nsec.ts" }, "exclude": ["./public"], - "imports": { "@/": "./src/", "@soapbox/nspec": "jsr:@soapbox/nspec@^0.8.1", "~/fixtures/": "./fixtures/" }, + "imports": { + "@/": "./src/", + "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.9.7", + "~/fixtures/": "./fixtures/" + }, "lint": { "include": ["src/", "scripts/"], "rules": { diff --git a/src/app.ts b/src/app.ts index 099db06..2806961 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,3 +1,5 @@ +import { NostrEvent } from '@nostrify/nostrify'; + import { Conf } from '@/config.ts'; import '@/cron.ts'; import { type User } from '@/db/users.ts'; @@ -10,7 +12,6 @@ import { type HonoEnv, logger, type MiddlewareHandler, - type NostrEvent, sentryMiddleware, serveStatic, } from '@/deps.ts'; diff --git a/src/controllers/api/accounts.ts b/src/controllers/api/accounts.ts index 7762783..9e250fa 100644 --- a/src/controllers/api/accounts.ts +++ b/src/controllers/api/accounts.ts @@ -1,4 +1,4 @@ -import { NostrFilter } from '@soapbox/nspec'; +import { NostrFilter } from '@nostrify/nostrify'; import { type AppController } from '@/app.ts'; import { Conf } from '@/config.ts'; import { nip19, z } from '@/deps.ts'; diff --git a/src/controllers/api/search.ts b/src/controllers/api/search.ts index fba315a..5fa268a 100644 --- a/src/controllers/api/search.ts +++ b/src/controllers/api/search.ts @@ -1,6 +1,6 @@ -import { NostrFilter } from '@soapbox/nspec'; +import { NostrEvent, NostrFilter } from '@nostrify/nostrify'; import { AppController } from '@/app.ts'; -import { nip19, type NostrEvent, z } from '@/deps.ts'; +import { nip19, z } from '@/deps.ts'; import { booleanParamSchema } from '@/schema.ts'; import { nostrIdSchema } from '@/schemas/nostr.ts'; import { searchStore } from '@/storages.ts'; diff --git a/src/controllers/api/statuses.ts b/src/controllers/api/statuses.ts index 7838cc9..b063abd 100644 --- a/src/controllers/api/statuses.ts +++ b/src/controllers/api/statuses.ts @@ -1,7 +1,8 @@ +import { NIP05, NostrEvent, NostrFilter } from '@nostrify/nostrify'; import { type AppController } from '@/app.ts'; import { Conf } from '@/config.ts'; import { getUnattachedMediaByIds } from '@/db/unattached-media.ts'; -import { ISO6391, NIP05, nip19, type NostrEvent, NostrFilter, z } from '@/deps.ts'; +import { ISO6391, nip19, z } from '@/deps.ts'; import { getAncestors, getAuthor, getDescendants, getEvent } from '@/queries.ts'; import { jsonMetaContentSchema } from '@/schemas/nostr.ts'; import { addTag, deleteTag } from '@/tags.ts'; diff --git a/src/controllers/api/streaming.ts b/src/controllers/api/streaming.ts index 40316be..4ad878e 100644 --- a/src/controllers/api/streaming.ts +++ b/src/controllers/api/streaming.ts @@ -1,4 +1,4 @@ -import { NostrFilter } from '@soapbox/nspec'; +import { NostrFilter } from '@nostrify/nostrify'; import { type AppController } from '@/app.ts'; import { Conf } from '@/config.ts'; import { Debug, z } from '@/deps.ts'; diff --git a/src/controllers/api/timelines.ts b/src/controllers/api/timelines.ts index 7e0e323..ebf1912 100644 --- a/src/controllers/api/timelines.ts +++ b/src/controllers/api/timelines.ts @@ -1,4 +1,4 @@ -import { NostrFilter } from '@soapbox/nspec'; +import { NostrFilter } from '@nostrify/nostrify'; import { type AppContext, type AppController } from '@/app.ts'; import { Conf } from '@/config.ts'; import { z } from '@/deps.ts'; diff --git a/src/controllers/nostr/relay.ts b/src/controllers/nostr/relay.ts index f695222..2921aaa 100644 --- a/src/controllers/nostr/relay.ts +++ b/src/controllers/nostr/relay.ts @@ -1,3 +1,4 @@ +import { NostrEvent, NostrFilter } from '@nostrify/nostrify'; import { relayInfoController } from '@/controllers/nostr/relay-info.ts'; import { eventsDB } from '@/storages.ts'; import * as pipeline from '@/pipeline.ts'; @@ -13,7 +14,6 @@ import { import { Sub } from '@/subs.ts'; import type { AppController } from '@/app.ts'; -import type { NostrEvent, NostrFilter } from '@/deps.ts'; /** Limit of initial events returned for a subscription. */ const FILTER_LIMIT = 100; diff --git a/src/db/users.ts b/src/db/users.ts index 5b99b51..61c7341 100644 --- a/src/db/users.ts +++ b/src/db/users.ts @@ -1,5 +1,6 @@ +import { NostrFilter } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; -import { Debug, type NostrFilter } from '@/deps.ts'; +import { Debug } from '@/deps.ts'; import * as pipeline from '@/pipeline.ts'; import { AdminSigner } from '@/signers/AdminSigner.ts'; import { eventsDB } from '@/storages.ts'; diff --git a/src/deps.ts b/src/deps.ts index a23fe10..07ad53d 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -79,19 +79,6 @@ export { EventEmitter } from 'npm:tseep@^1.1.3'; export { default as stringifyStable } from 'npm:fast-stable-stringify@^1.0.0'; export { default as Debug } from 'https://gitlab.com/soapbox-pub/stickynotes/-/raw/v0.3.0/debug.ts'; export { Stickynotes } from 'https://gitlab.com/soapbox-pub/stickynotes/-/raw/v0.3.0/mod.ts'; -export { - LNURL, - type LNURLDetails, - NCache, - NIP05, - type NostrEvent, - type NostrFilter, - type NostrSigner, - NSecSigner, - NSet, - type NStore, - type NStoreOpts, -} from 'https://gitlab.com/soapbox-pub/NSpec/-/raw/v0.3.0/mod.ts'; export type * as TypeFest from 'npm:type-fest@^4.3.0'; diff --git a/src/filter.ts b/src/filter.ts index 79e5b27..7dc7523 100644 --- a/src/filter.ts +++ b/src/filter.ts @@ -1,4 +1,5 @@ -import { type NostrEvent, type NostrFilter, stringifyStable, z } from '@/deps.ts'; +import { NostrEvent, NostrFilter } from '@nostrify/nostrify'; +import { stringifyStable, z } from '@/deps.ts'; import { isReplaceableKind } from '@/kinds.ts'; import { nostrIdSchema } from '@/schemas/nostr.ts'; diff --git a/src/firehose.ts b/src/firehose.ts index 7014302..98cb4db 100644 --- a/src/firehose.ts +++ b/src/firehose.ts @@ -1,4 +1,5 @@ -import { Debug, type NostrEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; +import { Debug } from '@/deps.ts'; import { activeRelays, pool } from '@/pool.ts'; import { nostrNow } from '@/utils.ts'; diff --git a/src/interfaces/DittoEvent.ts b/src/interfaces/DittoEvent.ts index c1d85ae..84c8a3e 100644 --- a/src/interfaces/DittoEvent.ts +++ b/src/interfaces/DittoEvent.ts @@ -1,4 +1,4 @@ -import { type NostrEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; /** Ditto internal stats for the event's author. */ export interface AuthorStats { diff --git a/src/interfaces/DittoFilter.ts b/src/interfaces/DittoFilter.ts index dfdc098..f7f1a9e 100644 --- a/src/interfaces/DittoFilter.ts +++ b/src/interfaces/DittoFilter.ts @@ -1,6 +1,5 @@ -import { type NostrEvent } from '@/deps.ts'; - -import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; +import { NostrEvent } from '@nostrify/nostrify'; +import { DittoEvent } from '@/interfaces/DittoEvent.ts'; /** Additional properties that may be added by Ditto to events. */ export type DittoRelation = Exclude; diff --git a/src/middleware/auth98.ts b/src/middleware/auth98.ts index 9f8db63..6c99553 100644 --- a/src/middleware/auth98.ts +++ b/src/middleware/auth98.ts @@ -1,5 +1,6 @@ +import { NostrEvent } from '@nostrify/nostrify'; import { type AppContext, type AppMiddleware } from '@/app.ts'; -import { HTTPException, type NostrEvent } from '@/deps.ts'; +import { HTTPException } from '@/deps.ts'; import { buildAuthEventTemplate, parseAuthRequest, diff --git a/src/pipeline.ts b/src/pipeline.ts index d858cc7..56d7bb2 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -1,9 +1,9 @@ -import { NSchema as n } from '@soapbox/nspec'; +import { LNURL, NostrEvent, NSchema as n } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; import { db } from '@/db.ts'; import { addRelays } from '@/db/relays.ts'; import { deleteAttachedMedia } from '@/db/unattached-media.ts'; -import { Debug, LNURL, type NostrEvent, sql } from '@/deps.ts'; +import { Debug, sql } from '@/deps.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { isEphemeralKind } from '@/kinds.ts'; import { DVM } from '@/pipeline/DVM.ts'; diff --git a/src/pipeline/DVM.ts b/src/pipeline/DVM.ts index 542aa75..96e3c40 100644 --- a/src/pipeline/DVM.ts +++ b/src/pipeline/DVM.ts @@ -1,4 +1,4 @@ -import { NIP05, NostrEvent } from '@soapbox/nspec'; +import { NIP05, NostrEvent } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; import * as pipeline from '@/pipeline.ts'; diff --git a/src/queries.ts b/src/queries.ts index 03bd2f0..61887b2 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -1,6 +1,7 @@ +import { NostrEvent, NostrFilter } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; import { eventsDB, optimizer } from '@/storages.ts'; -import { Debug, type NostrEvent, type NostrFilter } from '@/deps.ts'; +import { Debug } from '@/deps.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; import { type DittoRelation } from '@/interfaces/DittoFilter.ts'; import { findReplyTag, getTagSet } from '@/tags.ts'; diff --git a/src/signers/APISigner.ts b/src/signers/APISigner.ts index 3960a1e..a2a657e 100644 --- a/src/signers/APISigner.ts +++ b/src/signers/APISigner.ts @@ -1,6 +1,7 @@ +import { NostrEvent, NostrSigner, NSecSigner } from '@nostrify/nostrify'; import { type AppContext } from '@/app.ts'; import { Conf } from '@/config.ts'; -import { HTTPException, type NostrEvent, type NostrSigner, NSecSigner, Stickynotes } from '@/deps.ts'; +import { HTTPException, Stickynotes } from '@/deps.ts'; import { connectResponseSchema } from '@/schemas/nostr.ts'; import { jsonSchema } from '@/schema.ts'; import { AdminSigner } from '@/signers/AdminSigner.ts'; diff --git a/src/signers/AdminSigner.ts b/src/signers/AdminSigner.ts index d7205eb..5aea2e2 100644 --- a/src/signers/AdminSigner.ts +++ b/src/signers/AdminSigner.ts @@ -1,5 +1,5 @@ +import { NSecSigner } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; -import { NSecSigner } from '@/deps.ts'; /** Sign events as the Ditto server. */ export class AdminSigner extends NSecSigner { diff --git a/src/stats.ts b/src/stats.ts index 0d6c8e8..884778e 100644 --- a/src/stats.ts +++ b/src/stats.ts @@ -1,5 +1,6 @@ +import { NostrEvent } from '@nostrify/nostrify'; import { type AuthorStatsRow, db, type DittoDB, type EventStatsRow } from '@/db.ts'; -import { Debug, type InsertQueryBuilder, type NostrEvent } from '@/deps.ts'; +import { Debug, type InsertQueryBuilder } from '@/deps.ts'; import { eventsDB } from '@/storages.ts'; import { findReplyTag } from '@/tags.ts'; diff --git a/src/storages.ts b/src/storages.ts index 17876e5..107aa17 100644 --- a/src/storages.ts +++ b/src/storages.ts @@ -1,6 +1,6 @@ +import { NCache } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; import { db } from '@/db.ts'; -import { NCache } from '@/deps.ts'; import * as pipeline from '@/pipeline.ts'; import { activeRelays, pool } from '@/pool.ts'; import { EventsDB } from '@/storages/events-db.ts'; diff --git a/src/storages/events-db.ts b/src/storages/events-db.ts index 22d08a9..3359064 100644 --- a/src/storages/events-db.ts +++ b/src/storages/events-db.ts @@ -1,7 +1,7 @@ -import { NIP50, NostrFilter } from '@soapbox/nspec'; +import { NIP50, NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; import { type DittoDB } from '@/db.ts'; -import { Debug, Kysely, type NostrEvent, type NStore, type NStoreOpts, type SelectQueryBuilder } from '@/deps.ts'; +import { Debug, Kysely, type SelectQueryBuilder } from '@/deps.ts'; import { normalizeFilters } from '@/filter.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { isDittoInternalKind, isParameterizedReplaceableKind, isReplaceableKind } from '@/kinds.ts'; @@ -66,7 +66,7 @@ class EventsDB implements NStore { } /** Insert an event (and its tags) into the database. */ - async event(event: NostrEvent, _opts?: NStoreOpts): Promise { + async event(event: NostrEvent, _opts?: { signal?: AbortSignal }): Promise { event = purifyEvent(event); this.#debug('EVENT', JSON.stringify(event)); @@ -258,7 +258,7 @@ class EventsDB implements NStore { } /** Get events for filters from the database. */ - async query(filters: NostrFilter[], opts: NStoreOpts = {}): Promise { + async query(filters: NostrFilter[], opts: { signal?: AbortSignal; limit?: number } = {}): Promise { filters = await this.expandFilters(filters); if (opts.signal?.aborted) return Promise.resolve([]); @@ -328,7 +328,7 @@ class EventsDB implements NStore { } /** Delete events based on filters from the database. */ - async remove(filters: NostrFilter[], _opts?: NStoreOpts): Promise { + async remove(filters: NostrFilter[], _opts?: { signal?: AbortSignal }): Promise { if (!filters.length) return Promise.resolve(); this.#debug('DELETE', JSON.stringify(filters)); @@ -336,7 +336,10 @@ class EventsDB implements NStore { } /** Get number of events that would be returned by filters. */ - async count(filters: NostrFilter[], opts: NStoreOpts = {}): Promise<{ count: number; approximate: boolean }> { + async count( + filters: NostrFilter[], + opts: { signal?: AbortSignal } = {}, + ): Promise<{ count: number; approximate: boolean }> { if (opts.signal?.aborted) return Promise.reject(abortError()); if (!filters.length) return Promise.resolve({ count: 0, approximate: false }); diff --git a/src/storages/hydrate.ts b/src/storages/hydrate.ts index e288084..56518e2 100644 --- a/src/storages/hydrate.ts +++ b/src/storages/hydrate.ts @@ -1,6 +1,6 @@ +import { NostrEvent, NStore } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; import { db } from '@/db.ts'; -import { type NostrEvent, type NStore } from '@/deps.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; import { type DittoRelation } from '@/interfaces/DittoFilter.ts'; diff --git a/src/storages/optimizer.ts b/src/storages/optimizer.ts index 68883f6..518fc15 100644 --- a/src/storages/optimizer.ts +++ b/src/storages/optimizer.ts @@ -1,5 +1,5 @@ -import { NostrFilter } from '@soapbox/nspec'; -import { Debug, NSet, type NStore, type NStoreOpts } from '@/deps.ts'; +import { NostrFilter, NSet, NStore } from '@nostrify/nostrify'; +import { Debug } from '@/deps.ts'; import { normalizeFilters } from '@/filter.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; import { abortError } from '@/utils/abort.ts'; @@ -23,7 +23,7 @@ class Optimizer implements NStore { this.#client = opts.client; } - async event(event: DittoEvent, opts?: NStoreOpts): Promise { + async event(event: DittoEvent, opts?: { signal?: AbortSignal }): Promise { if (opts?.signal?.aborted) return Promise.reject(abortError()); await Promise.all([ @@ -32,7 +32,7 @@ class Optimizer implements NStore { ]); } - async query(filters: NostrFilter[], opts: NStoreOpts = {}): Promise { + async query(filters: NostrFilter[], opts: { signal?: AbortSignal; limit?: number } = {}): Promise { if (opts?.signal?.aborted) return Promise.reject(abortError()); filters = normalizeFilters(filters); diff --git a/src/storages/pool-store.ts b/src/storages/pool-store.ts index ec32ab4..6620ec9 100644 --- a/src/storages/pool-store.ts +++ b/src/storages/pool-store.ts @@ -1,13 +1,5 @@ -import { - Debug, - matchFilters, - type NostrEvent, - type NostrFilter, - NSet, - type NStore, - type NStoreOpts, - type RelayPoolWorker, -} from '@/deps.ts'; +import { NostrEvent, NostrFilter, NSet, NStore } from '@nostrify/nostrify'; +import { Debug, matchFilters, type RelayPoolWorker } from '@/deps.ts'; import { normalizeFilters } from '@/filter.ts'; import { purifyEvent } from '@/storages/hydrate.ts'; import { abortError } from '@/utils/abort.ts'; @@ -36,7 +28,7 @@ class PoolStore implements NStore { this.#publisher = opts.publisher; } - async event(event: NostrEvent, opts: NStoreOpts = {}): Promise { + async event(event: NostrEvent, opts: { signal?: AbortSignal } = {}): Promise { if (opts.signal?.aborted) return Promise.reject(abortError()); const relaySet = await getRelays(event.pubkey); @@ -51,7 +43,7 @@ class PoolStore implements NStore { return Promise.resolve(); } - query(filters: NostrFilter[], opts: NStoreOpts = {}): Promise { + query(filters: NostrFilter[], opts: { signal?: AbortSignal; limit?: number } = {}): Promise { if (opts.signal?.aborted) return Promise.reject(abortError()); filters = normalizeFilters(filters); @@ -63,7 +55,7 @@ class PoolStore implements NStore { const unsub = this.#pool.subscribe( filters, - opts.relays ?? this.#relays, + this.#relays, (event: NostrEvent | null) => { if (event && matchFilters(filters, event)) { this.#publisher.handleEvent(event, AbortSignal.timeout(1000)).catch(() => {}); diff --git a/src/storages/reqmeister.ts b/src/storages/reqmeister.ts index 37556a0..6be5a56 100644 --- a/src/storages/reqmeister.ts +++ b/src/storages/reqmeister.ts @@ -1,4 +1,5 @@ -import { Debug, EventEmitter, type NostrEvent, type NostrFilter, type NStore, type NStoreOpts } from '@/deps.ts'; +import { NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify'; +import { Debug, EventEmitter } from '@/deps.ts'; import { eventToMicroFilter, getFilterId, isMicrofilter, type MicroFilter } from '@/filter.ts'; import { Time } from '@/utils/time.ts'; import { abortError } from '@/utils/abort.ts'; @@ -110,7 +111,7 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: NostrEvent) }); } - event(event: NostrEvent, _opts?: NStoreOpts): Promise { + event(event: NostrEvent, _opts?: { signal?: AbortSignal }): Promise { const filterId = getFilterId(eventToMicroFilter(event)); this.#queue = this.#queue.filter(([id]) => id !== filterId); this.emit(filterId, event); @@ -122,7 +123,7 @@ class Reqmeister extends EventEmitter<{ [filterId: string]: (event: NostrEvent) return this.#queue.some(([id]) => id === filterId); } - query(filters: NostrFilter[], opts?: NStoreOpts): Promise { + query(filters: NostrFilter[], opts?: { signal?: AbortSignal }): Promise { if (opts?.signal?.aborted) return Promise.reject(abortError()); this.#debug('REQ', JSON.stringify(filters)); diff --git a/src/storages/search-store.ts b/src/storages/search-store.ts index 115f60d..5164108 100644 --- a/src/storages/search-store.ts +++ b/src/storages/search-store.ts @@ -1,5 +1,5 @@ -import { NostrFilter, NRelay1 } from '@soapbox/nspec'; -import { Debug, type NostrEvent, type NStore, type NStoreOpts } from '@/deps.ts'; +import { NostrEvent, NostrFilter, NRelay1, NStore } from '@nostrify/nostrify'; +import { Debug } from '@/deps.ts'; import { normalizeFilters } from '@/filter.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; import { hydrateEvents } from '@/storages/hydrate.ts'; @@ -27,11 +27,11 @@ class SearchStore implements NStore { } } - event(_event: NostrEvent, _opts?: NStoreOpts): Promise { + event(_event: NostrEvent, _opts?: { signal?: AbortSignal }): Promise { return Promise.reject(new Error('EVENT not implemented.')); } - async query(filters: NostrFilter[], opts?: NStoreOpts): Promise { + async query(filters: NostrFilter[], opts?: { signal?: AbortSignal; limit?: number }): Promise { filters = normalizeFilters(filters); if (opts?.signal?.aborted) return Promise.reject(abortError()); diff --git a/src/subs.ts b/src/subs.ts index 089f346..d3610c2 100644 --- a/src/subs.ts +++ b/src/subs.ts @@ -1,4 +1,4 @@ -import { NostrFilter } from '@soapbox/nspec'; +import { NostrFilter } from '@nostrify/nostrify'; import { Debug } from '@/deps.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; import { Subscription } from '@/subscription.ts'; diff --git a/src/subscription.ts b/src/subscription.ts index b288c5d..840a0b4 100644 --- a/src/subscription.ts +++ b/src/subscription.ts @@ -1,5 +1,5 @@ -import { NIP50, NostrFilter } from '@soapbox/nspec'; -import { Machina, matchFilter, type NostrEvent } from '@/deps.ts'; +import { NIP50, NostrEvent, NostrFilter } from '@nostrify/nostrify'; +import { Machina, matchFilter } from '@/deps.ts'; import { type DittoEvent } from '@/interfaces/DittoEvent.ts'; class Subscription implements AsyncIterable { diff --git a/src/utils.ts b/src/utils.ts index fa90b2c..d3b17d4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,5 @@ -import { type EventTemplate, getEventHash, nip19, type NostrEvent, z } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; +import { type EventTemplate, getEventHash, nip19, z } from '@/deps.ts'; import { nostrIdSchema } from '@/schemas/nostr.ts'; /** Get the current time in Nostr format. */ diff --git a/src/utils/api.ts b/src/utils/api.ts index c458c50..c33873e 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -1,16 +1,7 @@ +import { NostrEvent, NostrFilter } from '@nostrify/nostrify'; import { type AppContext } from '@/app.ts'; import { Conf } from '@/config.ts'; -import { - type Context, - Debug, - EventTemplate, - HTTPException, - type NostrEvent, - NostrFilter, - parseFormData, - type TypeFest, - z, -} from '@/deps.ts'; +import { type Context, Debug, EventTemplate, HTTPException, parseFormData, type TypeFest, z } from '@/deps.ts'; import * as pipeline from '@/pipeline.ts'; import { AdminSigner } from '@/signers/AdminSigner.ts'; import { APISigner } from '@/signers/APISigner.ts'; diff --git a/src/utils/lnurl.ts b/src/utils/lnurl.ts index 07aae1d..7b28435 100644 --- a/src/utils/lnurl.ts +++ b/src/utils/lnurl.ts @@ -1,4 +1,5 @@ -import { Debug, LNURL, type LNURLDetails } from '@/deps.ts'; +import { LNURL, LNURLDetails } from '@nostrify/nostrify'; +import { Debug } from '@/deps.ts'; import { SimpleLRU } from '@/utils/SimpleLRU.ts'; import { Time } from '@/utils/time.ts'; import { fetchWorker } from '@/workers/fetch.ts'; diff --git a/src/utils/lookup.ts b/src/utils/lookup.ts index c0f52ec..5fcad59 100644 --- a/src/utils/lookup.ts +++ b/src/utils/lookup.ts @@ -1,4 +1,4 @@ -import { type NostrEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; import { getAuthor } from '@/queries.ts'; import { bech32ToPubkey } from '@/utils.ts'; import { nip05Cache } from '@/utils/nip05.ts'; diff --git a/src/utils/nip05.ts b/src/utils/nip05.ts index c821c09..4de6411 100644 --- a/src/utils/nip05.ts +++ b/src/utils/nip05.ts @@ -1,5 +1,6 @@ +import { NIP05 } from '@nostrify/nostrify'; import { Conf } from '@/config.ts'; -import { Debug, NIP05, nip19 } from '@/deps.ts'; +import { Debug, nip19 } from '@/deps.ts'; import { SimpleLRU } from '@/utils/SimpleLRU.ts'; import { Time } from '@/utils/time.ts'; import { eventsDB } from '@/storages.ts'; diff --git a/src/utils/nip98.ts b/src/utils/nip98.ts index f41fd68..80df9ae 100644 --- a/src/utils/nip98.ts +++ b/src/utils/nip98.ts @@ -1,4 +1,5 @@ -import { type EventTemplate, nip13, type NostrEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; +import { type EventTemplate, nip13 } from '@/deps.ts'; import { decode64Schema, jsonSchema } from '@/schema.ts'; import { signedEventSchema } from '@/schemas/nostr.ts'; import { eventAge, findTag, nostrNow, sha256 } from '@/utils.ts'; diff --git a/src/views.ts b/src/views.ts index 0ccab9f..618bd9f 100644 --- a/src/views.ts +++ b/src/views.ts @@ -1,5 +1,5 @@ +import { NostrFilter } from '@nostrify/nostrify'; import { AppContext } from '@/app.ts'; -import { type NostrFilter } from '@/deps.ts'; import { eventsDB } from '@/storages.ts'; import { renderAccount } from '@/views/mastodon/accounts.ts'; import { renderStatus } from '@/views/mastodon/statuses.ts'; diff --git a/src/views/activitypub/actor.ts b/src/views/activitypub/actor.ts index 648d95c..9ca9a27 100644 --- a/src/views/activitypub/actor.ts +++ b/src/views/activitypub/actor.ts @@ -2,7 +2,7 @@ import { Conf } from '@/config.ts'; import { jsonMetaContentSchema } from '@/schemas/nostr.ts'; import { getPublicKeyPem } from '@/utils/rsa.ts'; -import type { NostrEvent } from '@/deps.ts'; +import type { NostrEvent } from '@nostrify/nostrify'; import type { Actor } from '@/schemas/activitypub.ts'; /** Nostr metadata event to ActivityPub actor. */ diff --git a/src/views/mastodon/notifications.ts b/src/views/mastodon/notifications.ts index cb91dec..a153140 100644 --- a/src/views/mastodon/notifications.ts +++ b/src/views/mastodon/notifications.ts @@ -1,4 +1,4 @@ -import { type NostrEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; import { getAuthor } from '@/queries.ts'; import { nostrDate } from '@/utils.ts'; import { accountFromPubkey } from '@/views/mastodon/accounts.ts'; diff --git a/src/workers/verify.ts b/src/workers/verify.ts index 21147cf..0dde872 100644 --- a/src/workers/verify.ts +++ b/src/workers/verify.ts @@ -1,4 +1,5 @@ -import { Comlink, type NostrEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; +import { Comlink } from '@/deps.ts'; import type { VerifyWorker } from './verify.worker.ts'; diff --git a/src/workers/verify.worker.ts b/src/workers/verify.worker.ts index be66424..0b5f668 100644 --- a/src/workers/verify.worker.ts +++ b/src/workers/verify.worker.ts @@ -1,4 +1,5 @@ -import { Comlink, type NostrEvent, type VerifiedEvent, verifyEvent } from '@/deps.ts'; +import { NostrEvent } from '@nostrify/nostrify'; +import { Comlink, type VerifiedEvent, verifyEvent } from '@/deps.ts'; export const VerifyWorker = { verifyEvent(event: NostrEvent): event is VerifiedEvent {