import { PGlite } from '@electric-sql/pglite'; import { worker } from '@electric-sql/pglite/worker'; import { migrateCacheSchema } from './cache.schema.js'; import { startCacheMaintenance } from './cache-maintenance.js'; void worker({ async init(options) { const db = await PGlite.create({ dataDir: options.dataDir }); try { await migrateCacheSchema(db); await startCacheMaintenance(db); return db; } catch (error) { await db.close(); throw error; } } });