diff --git a/deno.json b/deno.json index a617569..5174dc1 100644 --- a/deno.json +++ b/deno.json @@ -18,6 +18,7 @@ "@/": "./src/", "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.15.0", "@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs", + "@soapbox/kysely-deno-sqlite": "jsr:@soapbox/kysely-deno-sqlite@^2.0.2", "@std/cli": "jsr:@std/cli@^0.223.0", "@std/crypto": "jsr:@std/crypto@^0.224.0", "@std/encoding": "jsr:@std/encoding@^0.224.0", @@ -26,10 +27,10 @@ "@std/streams": "jsr:@std/streams@^0.223.0", "hono": "https://deno.land/x/hono@v3.10.1/mod.ts", "hono/middleware": "https://deno.land/x/hono@v3.10.1/middleware.ts", + "kysely": "npm:kysely@^0.27.3", + "kysely_deno_postgres": "https://deno.land/x/kysely_deno_postgres@v0.4.0/mod.ts", "nostr-tools": "npm:nostr-tools@^2.5.1", "nostr-wasm": "npm:nostr-wasm@^0.1.0", - "kysely": "npm:kysely@^0.26.3", - "kysely_deno_postgres": "https://deno.land/x/kysely_deno_postgres@v0.4.0/mod.ts", "zod": "npm:zod@^3.23.4", "~/fixtures/": "./fixtures/" }, diff --git a/src/db.ts b/src/db.ts index 7125f13..1a5f06d 100644 --- a/src/db.ts +++ b/src/db.ts @@ -1,8 +1,9 @@ import fs from 'node:fs/promises'; import path from 'node:path'; +import { FileMigrationProvider, Migrator } from 'kysely'; + import { DittoDB } from '@/db/DittoDB.ts'; -import { FileMigrationProvider, Migrator } from '@/deps.ts'; const db = await DittoDB.getInstance(); diff --git a/src/db/DittoDB.ts b/src/db/DittoDB.ts index 8ebe5e6..abe068b 100644 --- a/src/db/DittoDB.ts +++ b/src/db/DittoDB.ts @@ -1,8 +1,9 @@ +import { Kysely } from 'kysely'; + import { Conf } from '@/config.ts'; import { DittoPostgres } from '@/db/adapters/DittoPostgres.ts'; import { DittoSQLite } from '@/db/adapters/DittoSQLite.ts'; import { DittoTables } from '@/db/DittoTables.ts'; -import { Kysely } from '@/deps.ts'; export class DittoDB { static getInstance(): Promise> { diff --git a/src/db/adapters/DittoSQLite.ts b/src/db/adapters/DittoSQLite.ts index c91407a..6848aee 100644 --- a/src/db/adapters/DittoSQLite.ts +++ b/src/db/adapters/DittoSQLite.ts @@ -1,6 +1,8 @@ +import { PolySqliteDialect } from '@soapbox/kysely-deno-sqlite'; +import { Kysely, sql } from 'kysely'; + import { Conf } from '@/config.ts'; import { DittoTables } from '@/db/DittoTables.ts'; -import { Kysely, PolySqliteDialect, sql } from '@/deps.ts'; import SqliteWorker from '@/workers/sqlite.ts'; export class DittoSQLite { diff --git a/src/db/migrations/002_events_fts.ts b/src/db/migrations/002_events_fts.ts index 9324195..ffaf5fb 100644 --- a/src/db/migrations/002_events_fts.ts +++ b/src/db/migrations/002_events_fts.ts @@ -1,5 +1,6 @@ +import { Kysely, sql } from 'kysely'; + import { Conf } from '@/config.ts'; -import { Kysely, sql } from '@/deps.ts'; export async function up(db: Kysely): Promise { if (Conf.databaseUrl.protocol === 'sqlite:') { diff --git a/src/db/migrations/005_rework_tags.ts b/src/db/migrations/005_rework_tags.ts index f274670..1f95810 100644 --- a/src/db/migrations/005_rework_tags.ts +++ b/src/db/migrations/005_rework_tags.ts @@ -1,4 +1,4 @@ -import { Kysely, sql } from '@/deps.ts'; +import { Kysely, sql } from 'kysely'; export async function up(db: Kysely): Promise { await db.schema diff --git a/src/deps.ts b/src/deps.ts index 1c001d7..2c84d9e 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -30,19 +30,6 @@ export { } from 'https://raw.githubusercontent.com/alexgleason/deno-sqlite/325f66d8c395e7f6f5ee78ebfa42a0eeea4a942b/mod.ts'; export { Database as DenoSqlite3 } from 'https://deno.land/x/sqlite3@0.9.1/mod.ts'; export * as dotenv from 'https://deno.land/std@0.198.0/dotenv/mod.ts'; -export { - type CompiledQuery, - FileMigrationProvider, - type Insertable, - type InsertQueryBuilder, - Kysely, - Migrator, - type NullableInsertKeys, - type QueryResult, - type SelectQueryBuilder, - sql, -} from 'npm:kysely@^0.26.3'; -export { PolySqliteDialect } from 'https://gitlab.com/soapbox-pub/kysely-deno-sqlite/-/raw/v2.0.0/mod.ts'; export { default as tldts } from 'npm:tldts@^6.0.14'; export * as cron from 'https://deno.land/x/deno_cron@v1.0.0/cron.ts'; export { S3Client } from 'https://deno.land/x/s3_lite_client@0.6.1/mod.ts'; diff --git a/src/pipeline.ts b/src/pipeline.ts index 1b19a78..c4b94be 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -1,10 +1,12 @@ import { NostrEvent, NSchema as n } from '@nostrify/nostrify'; import { LNURL } from '@nostrify/nostrify/ln'; +import { sql } from 'kysely'; + 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, sql } from '@/deps.ts'; +import { Debug } from '@/deps.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { isEphemeralKind } from '@/kinds.ts'; import { DVM } from '@/pipeline/DVM.ts'; diff --git a/src/stats.ts b/src/stats.ts index 48cc41b..6bfe568 100644 --- a/src/stats.ts +++ b/src/stats.ts @@ -1,7 +1,9 @@ import { NostrEvent } from '@nostrify/nostrify'; +import { InsertQueryBuilder } from 'kysely'; + import { db } from '@/db.ts'; import { DittoTables } from '@/db/DittoTables.ts'; -import { Debug, type InsertQueryBuilder } from '@/deps.ts'; +import { Debug } from '@/deps.ts'; import { eventsDB } from '@/storages.ts'; import { findReplyTag } from '@/tags.ts'; diff --git a/src/storages/events-db.ts b/src/storages/events-db.ts index 6d80f70..22f15e1 100644 --- a/src/storages/events-db.ts +++ b/src/storages/events-db.ts @@ -1,7 +1,9 @@ import { NIP50, NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify'; +import { Kysely, type SelectQueryBuilder } from 'kysely'; + import { Conf } from '@/config.ts'; import { DittoTables } from '@/db/DittoTables.ts'; -import { Debug, Kysely, type SelectQueryBuilder } from '@/deps.ts'; +import { Debug } from '@/deps.ts'; import { normalizeFilters } from '@/filter.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { isDittoInternalKind, isParameterizedReplaceableKind, isReplaceableKind } from '@/kinds.ts'; diff --git a/src/workers/sqlite.ts b/src/workers/sqlite.ts index a6d2fac..1d29d4a 100644 --- a/src/workers/sqlite.ts +++ b/src/workers/sqlite.ts @@ -1,7 +1,8 @@ +import type { CompiledQuery, QueryResult } from 'kysely'; + import { Comlink } from '@/deps.ts'; import type { SqliteWorker as _SqliteWorker } from './sqlite.worker.ts'; -import type { CompiledQuery, QueryResult } from '@/deps.ts'; class SqliteWorker { #worker: Worker; diff --git a/src/workers/sqlite.worker.ts b/src/workers/sqlite.worker.ts index 1222e33..4739638 100644 --- a/src/workers/sqlite.worker.ts +++ b/src/workers/sqlite.worker.ts @@ -1,6 +1,8 @@ /// import { ScopedPerformance } from 'https://deno.land/x/scoped_performance@v2.0.0/mod.ts'; -import { Comlink, type CompiledQuery, DenoSqlite3, type QueryResult, Stickynotes } from '@/deps.ts'; +import { CompiledQuery, QueryResult } from 'kysely'; + +import { Comlink, DenoSqlite3, Stickynotes } from '@/deps.ts'; import '@/sentry.ts'; let db: DenoSqlite3 | undefined;