From fc73cb29611f18a7eadbca59a93ff7c9645b633f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 23 Sep 2024 22:16:03 -0500 Subject: [PATCH] Upgrade Nostrify --- deno.json | 5 +- deno.lock | 88 ++++++++++++++++++++++++----------- src/storages.ts | 4 +- src/storages/InternalRelay.ts | 4 ++ src/workers/policy.worker.ts | 2 +- 5 files changed, 72 insertions(+), 31 deletions(-) diff --git a/deno.json b/deno.json index 80c72b20..b702e9e5 100644 --- a/deno.json +++ b/deno.json @@ -32,8 +32,9 @@ "@isaacs/ttlcache": "npm:@isaacs/ttlcache@^1.4.1", "@lambdalisue/async": "jsr:@lambdalisue/async@^2.1.1", "@noble/secp256k1": "npm:@noble/secp256k1@^2.0.0", - "@nostrify/db": "jsr:@nostrify/db@^0.32.2", - "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.30.1", + "@nostrify/db": "jsr:@nostrify/db@^0.35.0", + "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.36.0", + "@nostrify/policies": "jsr:@nostrify/policies@^0.35.0", "@scure/base": "npm:@scure/base@^1.1.6", "@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs", "@soapbox/kysely-pglite": "jsr:@soapbox/kysely-pglite@^0.0.1", diff --git a/deno.lock b/deno.lock index ff81d4bb..088afce8 100644 --- a/deno.lock +++ b/deno.lock @@ -17,21 +17,23 @@ "jsr:@gleasonator/policy@0.6.1": "jsr:@gleasonator/policy@0.6.1", "jsr:@gleasonator/policy@0.6.3": "jsr:@gleasonator/policy@0.6.3", "jsr:@gleasonator/policy@0.6.4": "jsr:@gleasonator/policy@0.6.4", - "jsr:@hono/hono@^4.4.6": "jsr:@hono/hono@4.5.11", + "jsr:@hono/hono@^4.4.6": "jsr:@hono/hono@4.6.2", "jsr:@lambdalisue/async@^2.1.1": "jsr:@lambdalisue/async@2.1.1", - "jsr:@nostrify/db@^0.32.2": "jsr:@nostrify/db@0.32.2", + "jsr:@nostrify/db@^0.35.0": "jsr:@nostrify/db@0.35.0", "jsr:@nostrify/nostrify@^0.22.1": "jsr:@nostrify/nostrify@0.22.5", "jsr:@nostrify/nostrify@^0.22.4": "jsr:@nostrify/nostrify@0.22.4", "jsr:@nostrify/nostrify@^0.22.5": "jsr:@nostrify/nostrify@0.22.5", - "jsr:@nostrify/nostrify@^0.30.0": "jsr:@nostrify/nostrify@0.30.1", - "jsr:@nostrify/nostrify@^0.30.1": "jsr:@nostrify/nostrify@0.30.1", "jsr:@nostrify/nostrify@^0.31.0": "jsr:@nostrify/nostrify@0.31.0", "jsr:@nostrify/nostrify@^0.32.0": "jsr:@nostrify/nostrify@0.32.0", + "jsr:@nostrify/nostrify@^0.35.0": "jsr:@nostrify/nostrify@0.35.0", + "jsr:@nostrify/nostrify@^0.36.0": "jsr:@nostrify/nostrify@0.36.0", "jsr:@nostrify/policies@^0.33.0": "jsr:@nostrify/policies@0.33.0", "jsr:@nostrify/policies@^0.33.1": "jsr:@nostrify/policies@0.33.1", "jsr:@nostrify/policies@^0.34.0": "jsr:@nostrify/policies@0.34.0", + "jsr:@nostrify/policies@^0.35.0": "jsr:@nostrify/policies@0.35.0", "jsr:@nostrify/types@^0.30.0": "jsr:@nostrify/types@0.30.1", "jsr:@nostrify/types@^0.30.1": "jsr:@nostrify/types@0.30.1", + "jsr:@nostrify/types@^0.35.0": "jsr:@nostrify/types@0.35.0", "jsr:@soapbox/kysely-pglite@^0.0.1": "jsr:@soapbox/kysely-pglite@0.0.1", "jsr:@soapbox/stickynotes@^0.4.0": "jsr:@soapbox/stickynotes@0.4.0", "jsr:@std/assert@^0.213.1": "jsr:@std/assert@0.213.1", @@ -55,7 +57,7 @@ "jsr:@std/fs@^0.229.3": "jsr:@std/fs@0.229.3", "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.3", "jsr:@std/io@^0.223.0": "jsr:@std/io@0.223.0", - "jsr:@std/io@^0.224": "jsr:@std/io@0.224.7", + "jsr:@std/io@^0.224": "jsr:@std/io@0.224.8", "jsr:@std/json@^0.223.0": "jsr:@std/json@0.223.0", "jsr:@std/media-types@^0.224.1": "jsr:@std/media-types@0.224.1", "jsr:@std/path@0.213.1": "jsr:@std/path@0.213.1", @@ -229,14 +231,17 @@ "@hono/hono@4.5.9": { "integrity": "47f561e67aedbd6d1e21e3a1ae26c1b80ffdb62a51c161d502e75bee17ca40af" }, + "@hono/hono@4.6.2": { + "integrity": "35fcf3be4687825080b01bed7bbe2ac66f8d8b8939f0bad459661bf3b46d916f" + }, "@lambdalisue/async@2.1.1": { "integrity": "1fc9bc6f4ed50215cd2f7217842b18cea80f81c25744f88f8c5eb4be5a1c9ab4" }, - "@nostrify/db@0.32.2": { - "integrity": "265fb41e9d5810b99f1003ce56c89e4b468e6d0c04e7b9d9e3126c4efd49c1c2", + "@nostrify/db@0.35.0": { + "integrity": "637191c41812544e361b7997dc44ea098f8bd7efebb28f37a8a7142a0ecada8d", "dependencies": [ - "jsr:@nostrify/nostrify@^0.31.0", - "jsr:@nostrify/types@^0.30.1", + "jsr:@nostrify/nostrify@^0.35.0", + "jsr:@nostrify/types@^0.35.0", "npm:kysely@^0.27.3", "npm:nostr-tools@^2.7.0" ] @@ -285,21 +290,6 @@ "npm:zod@^3.23.8" ] }, - "@nostrify/nostrify@0.30.1": { - "integrity": "fcc923707e87a9fbecc82dbb18756d1d3d134cd0763f4b1254c4bce709e811eb", - "dependencies": [ - "jsr:@nostrify/types@^0.30.0", - "jsr:@std/crypto@^0.224.0", - "jsr:@std/encoding@^0.224.1", - "npm:@scure/base@^1.1.6", - "npm:@scure/bip32@^1.4.0", - "npm:@scure/bip39@^1.3.0", - "npm:lru-cache@^10.2.0", - "npm:nostr-tools@^2.7.0", - "npm:websocket-ts@^2.1.5", - "npm:zod@^3.23.8" - ] - }, "@nostrify/nostrify@0.31.0": { "integrity": "1c1b686bb9ca3ad8d19807e3b96ef3793a65d70fd0f433fe6ef8b3fdb9f45557", "dependencies": [ @@ -326,6 +316,34 @@ "npm:zod@^3.23.8" ] }, + "@nostrify/nostrify@0.35.0": { + "integrity": "9bfef4883838b8b4cb2e2b28a60b72de95391ca5b789bc7206a2baea054dea55", + "dependencies": [ + "jsr:@nostrify/types@^0.35.0", + "jsr:@std/encoding@^0.224.1", + "npm:@scure/bip32@^1.4.0", + "npm:@scure/bip39@^1.3.0", + "npm:lru-cache@^10.2.0", + "npm:nostr-tools@^2.7.0", + "npm:websocket-ts@^2.1.5", + "npm:zod@^3.23.8" + ] + }, + "@nostrify/nostrify@0.36.0": { + "integrity": "f00dbff1f02a2c496c5e85eeeb7a84101b7dd874d87456449dc71b6d037e40fc", + "dependencies": [ + "jsr:@nostrify/types@^0.35.0", + "jsr:@std/crypto@^0.224.0", + "jsr:@std/encoding@^0.224.1", + "npm:@scure/base@^1.1.6", + "npm:@scure/bip32@^1.4.0", + "npm:@scure/bip39@^1.3.0", + "npm:lru-cache@^10.2.0", + "npm:nostr-tools@^2.7.0", + "npm:websocket-ts@^2.1.5", + "npm:zod@^3.23.8" + ] + }, "@nostrify/policies@0.33.0": { "integrity": "c946b06d0527298b4d7c9819d142a10f522ba09eee76c37525aa4acfc5d87aee", "dependencies": [ @@ -348,12 +366,23 @@ "npm:nostr-tools@^2.7.0" ] }, + "@nostrify/policies@0.35.0": { + "integrity": "b828fac9f253e460a9587c05588b7dae6a0a32c5a9c9083e449219887b9e8e20", + "dependencies": [ + "jsr:@nostrify/nostrify@^0.35.0", + "jsr:@nostrify/types@^0.35.0", + "npm:nostr-tools@^2.7.0" + ] + }, "@nostrify/types@0.30.0": { "integrity": "1f38fa849cff930bd709edbf94ef9ac02f46afb8b851f86c8736517b354616da" }, "@nostrify/types@0.30.1": { "integrity": "245da176f6893a43250697db51ad32bfa29bf9b1cdc1ca218043d9abf6de5ae5" }, + "@nostrify/types@0.35.0": { + "integrity": "b8d515563d467072694557d5626fa1600f74e83197eef45dd86a9a99c64f7fe6" + }, "@soapbox/kysely-pglite@0.0.1": { "integrity": "7a4221aa780aad6fba9747c45c59dfb1c62017ba8cad9db5607f6e5822c058d5", "dependencies": [ @@ -483,6 +512,12 @@ "jsr:@std/bytes@^1.0.2" ] }, + "@std/io@0.224.8": { + "integrity": "f525d05d51fd873de6352b9afcf35cab9ab5dc448bf3c20e0c8b521ded9be392", + "dependencies": [ + "jsr:@std/bytes@^1.0.2" + ] + }, "@std/json@0.223.0": { "integrity": "9a4a255931dd0397924c6b10bb6a72fe3e28ddd876b981ada2e3b8dd0764163f", "dependencies": [ @@ -2064,8 +2099,9 @@ "jsr:@bradenmacdonald/s3-lite-client@^0.7.4", "jsr:@hono/hono@^4.4.6", "jsr:@lambdalisue/async@^2.1.1", - "jsr:@nostrify/db@^0.32.2", - "jsr:@nostrify/nostrify@^0.30.1", + "jsr:@nostrify/db@^0.35.0", + "jsr:@nostrify/nostrify@^0.36.0", + "jsr:@nostrify/policies@^0.35.0", "jsr:@soapbox/kysely-pglite@^0.0.1", "jsr:@soapbox/stickynotes@^0.4.0", "jsr:@std/assert@^0.225.1", diff --git a/src/storages.ts b/src/storages.ts index 8c7f2d28..643de7a5 100644 --- a/src/storages.ts +++ b/src/storages.ts @@ -15,7 +15,7 @@ export class Storages { private static _db: Promise | undefined; private static _database: Promise | undefined; private static _admin: Promise | undefined; - private static _client: Promise | undefined; + private static _client: Promise> | undefined; private static _pubsub: Promise | undefined; private static _search: Promise | undefined; @@ -68,7 +68,7 @@ export class Storages { } /** Relay pool storage. */ - public static async client(): Promise { + public static async client(): Promise> { if (!this._client) { this._client = (async () => { const db = await this.db(); diff --git a/src/storages/InternalRelay.ts b/src/storages/InternalRelay.ts index 71a13b31..4400b562 100644 --- a/src/storages/InternalRelay.ts +++ b/src/storages/InternalRelay.ts @@ -79,4 +79,8 @@ export class InternalRelay implements NRelay { async query(): Promise { return []; } + + async close(): Promise { + return Promise.resolve(); + } } diff --git a/src/workers/policy.worker.ts b/src/workers/policy.worker.ts index 0c115821..ae6ef8b1 100644 --- a/src/workers/policy.worker.ts +++ b/src/workers/policy.worker.ts @@ -1,6 +1,6 @@ import 'deno-safe-fetch/load'; import { NostrEvent, NostrRelayOK, NPolicy } from '@nostrify/nostrify'; -import { NoOpPolicy, ReadOnlyPolicy } from '@nostrify/nostrify/policies'; +import { NoOpPolicy, ReadOnlyPolicy } from '@nostrify/policies'; import * as Comlink from 'comlink'; import { DittoDB } from '@/db/DittoDB.ts';