@dbsp/adapter-pgsql 5.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/chunk-5BBN6TPD.js +59253 -0
- package/dist/chunk-5BBN6TPD.js.map +1 -0
- package/dist/index.d.ts +317 -2088
- package/dist/index.js +783 -37156
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +599 -5
- package/dist/internal.js +47 -1
- package/dist/outcome-protocol-B3vRIj2q.d.ts +3057 -0
- package/package.json +3 -3
- package/dist/chunk-KZ3NLIZ5.js +0 -13043
- package/dist/chunk-KZ3NLIZ5.js.map +0 -1
- package/dist/outcome-protocol-CACJDzli.d.ts +0 -1088
package/README.md
CHANGED
|
@@ -15,14 +15,14 @@ pnpm add @dbsp/adapter-pgsql pg
|
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
17
|
import { createOrm } from '@dbsp/core';
|
|
18
|
-
import {
|
|
18
|
+
import { createPgAdapter } from '@dbsp/adapter-pgsql';
|
|
19
19
|
import { Pool } from 'pg';
|
|
20
20
|
|
|
21
21
|
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
22
22
|
|
|
23
23
|
const orm = createOrm({
|
|
24
24
|
schema: db,
|
|
25
|
-
adapter:
|
|
25
|
+
adapter: createPgAdapter(pool),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const rows = await orm.select('users').where(eq('active', true)).all();
|
|
@@ -34,11 +34,11 @@ Compile SQL without a database connection — useful for CLI tooling, CI plan in
|
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
36
|
import { createOrm, eq } from '@dbsp/core';
|
|
37
|
-
import {
|
|
37
|
+
import { createPgCompileOnlyAdapter } from '@dbsp/adapter-pgsql';
|
|
38
38
|
|
|
39
|
-
// This is a connectionless
|
|
40
|
-
// refuse at runtime until you instead construct
|
|
41
|
-
const adapter =
|
|
39
|
+
// This is a connectionless PgAdapter: dump() works; database operations
|
|
40
|
+
// refuse at runtime until you instead construct createPgAdapter(pool).
|
|
41
|
+
const adapter = createPgCompileOnlyAdapter();
|
|
42
42
|
const orm = createOrm({ schema: db, adapter });
|
|
43
43
|
const { sql, params } = orm.select('users').where(eq('active', true)).dump();
|
|
44
44
|
// sql, params — no Pool needed
|
|
@@ -53,8 +53,8 @@ const { sql, params } = orm.select('users').where(eq('active', true)).dump();
|
|
|
53
53
|
- **Parameterized queries** — All user values use `$N` positional parameters; no SQL injection surface
|
|
54
54
|
- **Identifier quoting** — All table/column/schema names are double-quoted automatically
|
|
55
55
|
- **AST-based compiler** — SQL is built from the plan AST, never from string templates
|
|
56
|
-
- **DDL provisioning** — pure model-to-model `compareSchemata()` + `generateDDL()` with 12-phase topological sort; use live `
|
|
57
|
-
- **Schema migrations** — `generateMigrationSQL()` with UP/DOWN sections and destructive-change safety gate
|
|
56
|
+
- **DDL provisioning** — build one `PgPhysicalModel` with `createPgPhysicalModel()`, then use pure model-to-model `compareSchemata()` + `generateDDL()` with 12-phase topological sort; use live `comparePgDatabaseSchema()` when provisioning from an introspected PostgreSQL database
|
|
57
|
+
- **Schema migrations** — `generateMigrationSQL()` consumes the physical-model comparison with UP/DOWN sections and destructive-change safety gate
|
|
58
58
|
- **Schema introspection** — Reflect live database structure back into `ModelIR`
|
|
59
59
|
- **Row-Level Security** — `rlsEnabled` + `policies[]` on `TableIR`, compiled to `CREATE POLICY` DDL
|
|
60
60
|
- **Streaming & cursors** — `orm.select(...).stream()` and server-side cursor support
|