diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48c5b253..2ec0892f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: denoland/deno:1.46.3 +image: denoland/deno:2.0.0-rc.3 default: interruptible: true diff --git a/scripts/db-export.ts b/scripts/db-export.ts index 71939105..780a5ebc 100644 --- a/scripts/db-export.ts +++ b/scripts/db-export.ts @@ -102,7 +102,7 @@ async function exportEvents(args: ExportFilter) { let filter: NostrFilter = {}; try { filter = buildFilter(args); - } catch (e) { + } catch (e: any) { die(1, e.message || e.toString()); } diff --git a/src/controllers/nostr/relay.ts b/src/controllers/nostr/relay.ts index b2bb8dba..3fd6b29a 100644 --- a/src/controllers/nostr/relay.ts +++ b/src/controllers/nostr/relay.ts @@ -104,7 +104,7 @@ function connectStream(socket: WebSocket, ip: string | undefined) { for (const event of await store.query(filters, { limit: FILTER_LIMIT, timeout: Conf.db.timeouts.relay })) { send(['EVENT', subId, event]); } - } catch (e) { + } catch (e: any) { if (e instanceof RelayError) { send(['CLOSED', subId, e.message]); } else if (e.message.includes('timeout')) { diff --git a/src/signers/ConnectSigner.ts b/src/signers/ConnectSigner.ts index 6501bb8b..26a9cbc9 100644 --- a/src/signers/ConnectSigner.ts +++ b/src/signers/ConnectSigner.ts @@ -30,7 +30,7 @@ export class ConnectSigner implements NostrSigner { const signer = await this.signer; try { return await signer.signEvent(event); - } catch (e) { + } catch (e: any) { if (e.name === 'AbortError') { throw new HTTPException(408, { message: 'The event was not signed quickly enough' }); } else { @@ -44,7 +44,7 @@ export class ConnectSigner implements NostrSigner { const signer = await this.signer; try { return await signer.nip04.encrypt(pubkey, plaintext); - } catch (e) { + } catch (e: any) { if (e.name === 'AbortError') { throw new HTTPException(408, { message: 'Text was not encrypted quickly enough', @@ -59,7 +59,7 @@ export class ConnectSigner implements NostrSigner { const signer = await this.signer; try { return await signer.nip04.decrypt(pubkey, ciphertext); - } catch (e) { + } catch (e: any) { if (e.name === 'AbortError') { throw new HTTPException(408, { message: 'Text was not decrypted quickly enough', @@ -76,7 +76,7 @@ export class ConnectSigner implements NostrSigner { const signer = await this.signer; try { return await signer.nip44.encrypt(pubkey, plaintext); - } catch (e) { + } catch (e: any) { if (e.name === 'AbortError') { throw new HTTPException(408, { message: 'Text was not encrypted quickly enough', @@ -91,7 +91,7 @@ export class ConnectSigner implements NostrSigner { const signer = await this.signer; try { return await signer.nip44.decrypt(pubkey, ciphertext); - } catch (e) { + } catch (e: any) { if (e.name === 'AbortError') { throw new HTTPException(408, { message: 'Text was not decrypted quickly enough', diff --git a/src/storages/EventsDB.ts b/src/storages/EventsDB.ts index 7d61c2de..1bf3cd86 100644 --- a/src/storages/EventsDB.ts +++ b/src/storages/EventsDB.ts @@ -59,7 +59,7 @@ class EventsDB extends NPostgres { } /** Insert an event (and its tags) into the database. */ - async event(event: NostrEvent, opts: { signal?: AbortSignal; timeout?: number } = {}): Promise { + override async event(event: NostrEvent, opts: { signal?: AbortSignal; timeout?: number } = {}): Promise { event = purifyEvent(event); this.console.debug('EVENT', JSON.stringify(event)); dbEventsCounter.inc({ kind: event.kind }); @@ -72,7 +72,7 @@ class EventsDB extends NPostgres { try { await super.event(event, { ...opts, timeout: opts.timeout ?? this.opts.timeout }); - } catch (e) { + } catch (e: any) { if (e.message === 'Cannot add a deleted event') { throw new RelayError('blocked', 'event deleted by user'); } else if (e.message === 'Cannot replace an event with an older event') { @@ -144,7 +144,7 @@ class EventsDB extends NPostgres { } } - protected getFilterQuery(trx: Kysely, filter: NostrFilter) { + protected override getFilterQuery(trx: Kysely, filter: NostrFilter) { if (filter.search) { const tokens = NIP50.parseInput(filter.search); @@ -172,7 +172,7 @@ class EventsDB extends NPostgres { } /** Get events for filters from the database. */ - async query( + override async query( filters: NostrFilter[], opts: { signal?: AbortSignal; timeout?: number; limit?: number } = {}, ): Promise { @@ -200,13 +200,13 @@ class EventsDB extends NPostgres { } /** Delete events based on filters from the database. */ - async remove(filters: NostrFilter[], opts: { signal?: AbortSignal; timeout?: number } = {}): Promise { + override async remove(filters: NostrFilter[], opts: { signal?: AbortSignal; timeout?: number } = {}): Promise { this.console.debug('DELETE', JSON.stringify(filters)); return super.remove(filters, { ...opts, timeout: opts.timeout ?? this.opts.timeout }); } /** Get number of events that would be returned by filters. */ - async count( + override async count( filters: NostrFilter[], opts: { signal?: AbortSignal; timeout?: number } = {}, ): Promise<{ count: number; approximate: any }> { @@ -218,7 +218,7 @@ class EventsDB extends NPostgres { } /** Return only the tags that should be indexed. */ - static indexTags(event: NostrEvent): string[][] { + static override indexTags(event: NostrEvent): string[][] { const tagCounts: Record = {}; function getCount(name: string) { @@ -325,7 +325,7 @@ class EventsDB extends NPostgres { return filters; } - async transaction(callback: (store: NPostgres, kysely: Kysely) => Promise): Promise { + override async transaction(callback: (store: NPostgres, kysely: Kysely) => Promise): Promise { return super.transaction((store, kysely) => callback(store, kysely as unknown as Kysely)); } } diff --git a/src/trends.ts b/src/trends.ts index de91a33d..23f7ea4d 100644 --- a/src/trends.ts +++ b/src/trends.ts @@ -106,7 +106,7 @@ export async function updateTrendingTags( await handleEvent(label, signal); console.info(`Trending ${l} updated.`); - } catch (e) { + } catch (e: any) { console.error(`Error updating trending ${l}: ${e.message}`); } } diff --git a/src/workers/policy.ts b/src/workers/policy.ts index f86f9d9b..7bf3f7bf 100644 --- a/src/workers/policy.ts +++ b/src/workers/policy.ts @@ -31,7 +31,7 @@ try { adminPubkey: Conf.pubkey, }); console.debug(`Using custom policy: ${Conf.policy}`); -} catch (e) { +} catch (e: any) { if (e.message.includes('Module not found')) { console.debug('Custom policy not found '); } else { diff --git a/src/workers/policy.worker.ts b/src/workers/policy.worker.ts index 1d65f405..c7a16e30 100644 --- a/src/workers/policy.worker.ts +++ b/src/workers/policy.worker.ts @@ -45,7 +45,7 @@ export class CustomPolicy implements NPolicy { try { const Policy = (await import(path)).default; this.policy = new Policy({ store }); - } catch (e) { + } catch (e: any) { if (e.message.includes('Module not found')) { this.policy = new NoOpPolicy(); }