PostgreSQL backend adapter for @owservable/core: live data via LISTEN/NOTIFY triggers over MikroORM entities.
- PostgresBackend: implements
IObservableBackendover a MikroORM entity — change feed, queries with Mongo-style operators, relation population - PostgresListener: one dedicated LISTEN connection with automatic reconnection; stores force a reload after reconnect to cover missed notifications
- PostgresObservableTable: normalizes trigger notifications into change events (PK-refetch enrichment, column→property mapping) shaped exactly like MongoDB change streams
- installPostgresTriggers: idempotent
CREATE OR REPLACEbootstrap (PostgreSQL 14+) — no migration files - @PostgresLiveUpdates(): one-line decorator to opt an entity's table into live updates
- processPostgresEntities: scans per-module entity folders and returns the classes for
MikroORM.init - PostgresConnector: MikroORM init, advisory-locked
updateSchema({safe: true}), trigger install and backend registration in one call
npm install @owservable/core @owservable/postgres @mikro-orm/core @mikro-orm/postgresqlor
pnpm add @owservable/core @owservable/postgres @mikro-orm/core @mikro-orm/postgresql@owservable/core, @mikro-orm/core, @mikro-orm/postgresql and rxjs are peer dependencies.
Unlicense — see LICENSE.