Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 258 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
"dependencies": {
"@electric-sql/pglite": "^0.5.4",
"mimetext": "^3.0.28",
"pg": "^8.22.0",
"postal-mime": "^2.7.5"
},
"devDependencies": {
"@biomejs/biome": "2.5.3",
"@electric-sql/pglite-socket": "^0.2.7",
"@types/node": "^20.19.43",
"@types/pg": "^8.20.0",
"@vitest/coverage-v8": "4.1.10",
"typescript": "7.0.2",
"vitest": "4.1.10"
Expand Down
15 changes: 11 additions & 4 deletions src/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
/**
* Barrel for the DB layer (`src/db/**`). Store modules (`src/store/**`) and
* anything wiring up a database connection import from here — never reach
* into `client.ts`/`migrate.ts` directly, and never import `@electric-sql/pglite`
* outside this directory (see `src/db/client.ts` for why the raw-SQL seam
* exists: the same SQL must run unmodified against a future Supabase-backed
* `Db`, so nothing above this barrel should know PGlite exists).
* into `client.ts`/`migrate.ts`/`postgres.ts` directly, and never import
* `@electric-sql/pglite` or `pg` outside this directory (see
* `src/db/client.ts` for why the raw-SQL seam exists: the same SQL runs
* unmodified against PGlite locally and real Postgres/Supabase in
* production, so nothing above this barrel should know which one it got).
*/

export type { Db, Queryable, Row, SqlValue } from './client.js'
export { createPgliteDb, PgliteDb } from './client.js'
export type { Migration } from './migrate.js'
export { migrate } from './migrate.js'
export type { PostgresDbOptions } from './postgres.js'
// Factory only — deliberately NOT the PostgresDb class: its constructor
// skips createPostgresDb's schema validation/provisioning, so exposing it
// would offer an unvalidated side door. (postgres.ts still exports the class
// for its own tests; nothing above this barrel should touch it.)
export { createPostgresDb } from './postgres.js'
Loading
Loading