import type { Dialect } from '@enbox/dwn-sql-store'; import type { DidResolver } from '@enbox/dids'; import type { DwnServerConfig } from './config.js'; import type { EventBus } from './event-bus.js'; import type { DataStore, DwnConfig, EventLog, MessageStore, ResumableTaskStore, TenantGate } from '@enbox/dwn-sdk-js'; export declare enum StoreType { DataStore = 0, MessageStore = 1, ResumableTaskStore = 2 } export declare enum BackendTypes { LEVEL = "level", SQLITE = "sqlite", MYSQL = "mysql", POSTGRES = "postgres" } export type DwnStore = DataStore | MessageStore | ResumableTaskStore; type GetDwnConfigOptions = { didResolver?: DidResolver; tenantGate?: TenantGate; eventLog?: EventLog; eventBus?: EventBus; enableEventLog?: boolean; }; type EndablePool = { end(): Promise; }; /** * Memoize a shared Postgres pool's shutdown without wrapping the pool itself. * Several Kysely drivers can own the cached dialect and each destroys it, but * `pg` rejects a second `end()`. The first call evicts the ended dialect and * every Kysely driver observes the same underlying completion. */ export declare function makePostgresPoolEndIdempotent(pool: EndablePool, onFirstEnd?: () => void): void; export declare function getDwnConfig(config: DwnServerConfig, options: GetDwnConfigOptions): Promise; /** * Runs DWN server schema migrations (admin stores, registration, TTL cache) * if the given URL points to a SQL backend. Uses the `registrationStoreUrl` * (or the TTL cache URL) as the target database. * * Server migrations use a separate tracking table (`dwn_server_migration`) * so they do not conflict with the DWN store migrations. * * Call this once during server startup, before creating admin stores. * * @returns The dialect used for the target database (so the caller can reuse * it for the TTL cache and admin stores), or `undefined` if no SQL * backend was configured or needed. */ export declare function runServerMigrationsIfNeeded(config: DwnServerConfig): Promise; export declare function getDialectFromUrl(connectionUrl: URL): Dialect; export {}; //# sourceMappingURL=storage.d.ts.map