From f61d29eb668eaaa2675f832b7feaf2c09340a719 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 26 Apr 2024 12:33:52 -0500 Subject: [PATCH] Upgrade Nostrify to v0.15, use MockRelay in tests instead of NCache --- deno.json | 2 +- src/pipeline.ts | 3 ++- src/storages/InternalRelay.ts | 2 +- src/storages/hydrate.test.ts | 10 +++++----- src/utils/lnurl.ts | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/deno.json b/deno.json index f345fc8..c5681e3 100644 --- a/deno.json +++ b/deno.json @@ -16,7 +16,7 @@ "exclude": ["./public"], "imports": { "@/": "./src/", - "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.14.3", + "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.15.0", "@std/cli": "jsr:@std/cli@^0.223.0", "@std/json": "jsr:@std/json@^0.223.0", "@std/streams": "jsr:@std/streams@^0.223.0", diff --git a/src/pipeline.ts b/src/pipeline.ts index c3feeab..1b19a78 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -1,4 +1,5 @@ -import { LNURL, NostrEvent, NSchema as n } from '@nostrify/nostrify'; +import { NostrEvent, NSchema as n } from '@nostrify/nostrify'; +import { LNURL } from '@nostrify/nostrify/ln'; import { Conf } from '@/config.ts'; import { db } from '@/db.ts'; import { addRelays } from '@/db/relays.ts'; diff --git a/src/storages/InternalRelay.ts b/src/storages/InternalRelay.ts index d99dda2..d42f94f 100644 --- a/src/storages/InternalRelay.ts +++ b/src/storages/InternalRelay.ts @@ -1,6 +1,5 @@ // deno-lint-ignore-file require-await import { - Machina, NIP50, NostrEvent, NostrFilter, @@ -9,6 +8,7 @@ import { NostrRelayEVENT, NRelay, } from '@nostrify/nostrify'; +import { Machina } from '@nostrify/nostrify/utils'; import { matchFilter } from '@/deps.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; diff --git a/src/storages/hydrate.test.ts b/src/storages/hydrate.test.ts index de69008..c0c0a42 100644 --- a/src/storages/hydrate.test.ts +++ b/src/storages/hydrate.test.ts @@ -1,6 +1,6 @@ import { assertEquals } from '@/deps-test.ts'; import { hydrateEvents } from '@/storages/hydrate.ts'; -import { NCache } from 'jsr:@nostrify/nostrify'; +import { MockRelay } from '@nostrify/nostrify/test'; import event0 from '~/fixtures/events/event-0.json' with { type: 'json' }; import event0madePost from '~/fixtures/events/event-0-the-one-who-post-and-users-repost.json' with { type: 'json' }; @@ -24,7 +24,7 @@ import event6ofQuoteRepost from '~/fixtures/events/event-6-of-quote-repost.json' import { DittoEvent } from '@/interfaces/DittoEvent.ts'; Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => { - const db = new NCache({ max: 100 }); + const db = new MockRelay(); const event0copy = structuredClone(event0); const event1copy = structuredClone(event1); @@ -45,7 +45,7 @@ Deno.test('hydrateEvents(): author --- WITHOUT stats', async () => { }); Deno.test('hydrateEvents(): repost --- WITHOUT stats', async () => { - const db = new NCache({ max: 100 }); + const db = new MockRelay(); const event0madePostCopy = structuredClone(event0madePost); const event0madeRepostCopy = structuredClone(event0madeRepost); @@ -75,7 +75,7 @@ Deno.test('hydrateEvents(): repost --- WITHOUT stats', async () => { }); Deno.test('hydrateEvents(): quote repost --- WITHOUT stats', async () => { - const db = new NCache({ max: 100 }); + const db = new MockRelay(); const event0madeQuoteRepostCopy = structuredClone(event0madeQuoteRepost); const event0copy = structuredClone(event0); @@ -103,7 +103,7 @@ Deno.test('hydrateEvents(): quote repost --- WITHOUT stats', async () => { }); Deno.test('hydrateEvents(): repost of quote repost --- WITHOUT stats', async () => { - const db = new NCache({ max: 100 }); + const db = new MockRelay(); const event0copy = structuredClone(event0madeRepostWithQuoteRepost); const event1copy = structuredClone(event1futureIsMine); diff --git a/src/utils/lnurl.ts b/src/utils/lnurl.ts index 7b28435..a84d20b 100644 --- a/src/utils/lnurl.ts +++ b/src/utils/lnurl.ts @@ -1,4 +1,4 @@ -import { LNURL, LNURLDetails } from '@nostrify/nostrify'; +import { LNURL, LNURLDetails } from '@nostrify/nostrify/ln'; import { Debug } from '@/deps.ts'; import { SimpleLRU } from '@/utils/SimpleLRU.ts'; import { Time } from '@/utils/time.ts';