Make Kysely an import alias

This commit is contained in:
Alex Gleason 2024-05-01 09:26:17 -05:00
parent 9c1760bcc0
commit 23e00b0042
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
9 changed files with 21 additions and 20 deletions

View File

@ -1,8 +1,9 @@
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import path from 'node:path'; import path from 'node:path';
import { FileMigrationProvider, Migrator } from 'kysely';
import { DittoDB } from '@/db/DittoDB.ts'; import { DittoDB } from '@/db/DittoDB.ts';
import { FileMigrationProvider, Migrator } from '@/deps.ts';
const db = await DittoDB.getInstance(); const db = await DittoDB.getInstance();

View File

@ -1,8 +1,9 @@
import { Kysely } from 'kysely';
import { Conf } from '@/config.ts'; import { Conf } from '@/config.ts';
import { DittoPostgres } from '@/db/adapters/DittoPostgres.ts'; import { DittoPostgres } from '@/db/adapters/DittoPostgres.ts';
import { DittoSQLite } from '@/db/adapters/DittoSQLite.ts'; import { DittoSQLite } from '@/db/adapters/DittoSQLite.ts';
import { DittoTables } from '@/db/DittoTables.ts'; import { DittoTables } from '@/db/DittoTables.ts';
import { Kysely } from '@/deps.ts';
export class DittoDB { export class DittoDB {
static getInstance(): Promise<Kysely<DittoTables>> { static getInstance(): Promise<Kysely<DittoTables>> {

View File

@ -1,6 +1,8 @@
import { Kysely, sql } from 'kysely';
import { Conf } from '@/config.ts'; import { Conf } from '@/config.ts';
import { DittoTables } from '@/db/DittoTables.ts'; import { DittoTables } from '@/db/DittoTables.ts';
import { Kysely, PolySqliteDialect, sql } from '@/deps.ts'; import { PolySqliteDialect } from '@/deps.ts';
import SqliteWorker from '@/workers/sqlite.ts'; import SqliteWorker from '@/workers/sqlite.ts';
export class DittoSQLite { export class DittoSQLite {

View File

@ -30,18 +30,6 @@ export {
} from 'https://raw.githubusercontent.com/alexgleason/deno-sqlite/325f66d8c395e7f6f5ee78ebfa42a0eeea4a942b/mod.ts'; } 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 { 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 * 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 { 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 { 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 * as cron from 'https://deno.land/x/deno_cron@v1.0.0/cron.ts';

View File

@ -1,10 +1,12 @@
import { NostrEvent, NSchema as n } from '@nostrify/nostrify'; import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
import { LNURL } from '@nostrify/nostrify/ln'; import { LNURL } from '@nostrify/nostrify/ln';
import { sql } from 'kysely';
import { Conf } from '@/config.ts'; import { Conf } from '@/config.ts';
import { db } from '@/db.ts'; import { db } from '@/db.ts';
import { addRelays } from '@/db/relays.ts'; import { addRelays } from '@/db/relays.ts';
import { deleteAttachedMedia } from '@/db/unattached-media.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 { DittoEvent } from '@/interfaces/DittoEvent.ts';
import { isEphemeralKind } from '@/kinds.ts'; import { isEphemeralKind } from '@/kinds.ts';
import { DVM } from '@/pipeline/DVM.ts'; import { DVM } from '@/pipeline/DVM.ts';

View File

@ -1,7 +1,9 @@
import { NostrEvent } from '@nostrify/nostrify'; import { NostrEvent } from '@nostrify/nostrify';
import { InsertQueryBuilder } from 'kysely';
import { db } from '@/db.ts'; import { db } from '@/db.ts';
import { DittoTables } from '@/db/DittoTables.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 { eventsDB } from '@/storages.ts';
import { findReplyTag } from '@/tags.ts'; import { findReplyTag } from '@/tags.ts';

View File

@ -1,7 +1,9 @@
import { NIP50, NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify'; import { NIP50, NostrEvent, NostrFilter, NStore } from '@nostrify/nostrify';
import { Kysely, type SelectQueryBuilder } from 'kysely';
import { Conf } from '@/config.ts'; import { Conf } from '@/config.ts';
import { DittoTables } from '@/db/DittoTables.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 { normalizeFilters } from '@/filter.ts';
import { DittoEvent } from '@/interfaces/DittoEvent.ts'; import { DittoEvent } from '@/interfaces/DittoEvent.ts';
import { isDittoInternalKind, isParameterizedReplaceableKind, isReplaceableKind } from '@/kinds.ts'; import { isDittoInternalKind, isParameterizedReplaceableKind, isReplaceableKind } from '@/kinds.ts';

View File

@ -1,7 +1,8 @@
import type { CompiledQuery, QueryResult } from 'kysely';
import { Comlink } from '@/deps.ts'; import { Comlink } from '@/deps.ts';
import type { SqliteWorker as _SqliteWorker } from './sqlite.worker.ts'; import type { SqliteWorker as _SqliteWorker } from './sqlite.worker.ts';
import type { CompiledQuery, QueryResult } from '@/deps.ts';
class SqliteWorker { class SqliteWorker {
#worker: Worker; #worker: Worker;

View File

@ -1,6 +1,8 @@
/// <reference lib="webworker" /> /// <reference lib="webworker" />
import { ScopedPerformance } from 'https://deno.land/x/scoped_performance@v2.0.0/mod.ts'; 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'; import '@/sentry.ts';
let db: DenoSqlite3 | undefined; let db: DenoSqlite3 | undefined;