@owlmeans/postgres 0.1.15 → 0.1.16
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
CHANGED
|
@@ -124,10 +124,9 @@ Extends `PostgresDbService` from `@owlmeans/postgres-resource`:
|
|
|
124
124
|
<!-- owlmeans:agent-guidance:start -->
|
|
125
125
|
## Agent guidance
|
|
126
126
|
|
|
127
|
-
This package ships embedded
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
(`.claude/skills/` and `.github/instructions/`):
|
|
127
|
+
This package ships embedded agent skills under `agent-meta/`. After installing your
|
|
128
|
+
`@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
|
|
129
|
+
your project's skill store (`.agents/skills/`):
|
|
131
130
|
|
|
132
131
|
```sh
|
|
133
132
|
npx @owlmeans/agent-skills
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
2
|
+
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/postgres",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"generatedAt": "2026-08-
|
|
4
|
+
"version": "0.1.16",
|
|
5
|
+
"generatedAt": "2026-08-14T10:14:48.861Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -10,14 +10,7 @@
|
|
|
10
10
|
"name": "postgres",
|
|
11
11
|
"category": "package-specific",
|
|
12
12
|
"file": "skills/postgres/SKILL.md",
|
|
13
|
-
"canonicalPath": ".
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"kind": "instruction",
|
|
17
|
-
"name": "postgres",
|
|
18
|
-
"category": "package-specific",
|
|
19
|
-
"file": "instructions/postgres.instructions.md",
|
|
20
|
-
"canonicalPath": ".github/instructions/postgres.instructions.md"
|
|
13
|
+
"canonicalPath": ".agents/skills/postgres/SKILL.md"
|
|
21
14
|
}
|
|
22
15
|
]
|
|
23
16
|
}
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/postgres
|
|
9
9
|
|
|
10
10
|
**Layer:** Infra
|
|
11
|
-
**Install:** `"@owlmeans/postgres": "^0.1.
|
|
11
|
+
**Install:** `"@owlmeans/postgres": "^0.1.16"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
Pooled `pg` connections for a server context, plus the admin path that provisions the role, database
|
|
14
14
|
and schema an app connects with. All DDL for application tables belongs to [[postgres-resource]] —
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/postgres",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@owlmeans/basic-keys": "^0.1.
|
|
26
|
-
"@owlmeans/context": "^0.1.
|
|
27
|
-
"@owlmeans/postgres-resource": "^0.1.
|
|
28
|
-
"@owlmeans/resource": "^0.1.
|
|
29
|
-
"@owlmeans/server-context": "^0.1.
|
|
25
|
+
"@owlmeans/basic-keys": "^0.1.16",
|
|
26
|
+
"@owlmeans/context": "^0.1.16",
|
|
27
|
+
"@owlmeans/postgres-resource": "^0.1.16",
|
|
28
|
+
"@owlmeans/resource": "^0.1.16",
|
|
29
|
+
"@owlmeans/server-context": "^0.1.16",
|
|
30
30
|
"drizzle-orm": "~0.45.2",
|
|
31
31
|
"pg": "^8.22.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@owlmeans/dep-config": "workspace:*",
|
|
35
|
-
"@owlmeans/test-integration": "^0.1.
|
|
35
|
+
"@owlmeans/test-integration": "^0.1.16",
|
|
36
36
|
"@types/bun": "^1.3.14",
|
|
37
37
|
"@types/node": "^26.1.0",
|
|
38
38
|
"@types/pg": "^8.20.4",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "How to use @owlmeans/postgres — PostgreSQL connection service (makePostgresDbService / appendPostgres) registered on a server context, plus the least-privilege bootstrap admin path."
|
|
3
|
-
applyTo: "**/context.ts, **/config.ts, **/*.ts, **/*.tsx"
|
|
4
|
-
---
|
|
5
|
-
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
-
|
|
7
|
-
# @owlmeans/postgres
|
|
8
|
-
|
|
9
|
-
**Layer:** Infra
|
|
10
|
-
**Install:** `"@owlmeans/postgres": "^0.1.15"` in `dependencies`
|
|
11
|
-
|
|
12
|
-
## Key Exports
|
|
13
|
-
|
|
14
|
-
| Export | Description |
|
|
15
|
-
|--------|-------------|
|
|
16
|
-
| `makePostgresDbService(alias?)` | PostgreSQL connection service factory |
|
|
17
|
-
| `appendPostgres(context, alias?)` | Registers the service **and** its drain middleware |
|
|
18
|
-
| `PostgresService`, `BootstrapOptions`, `BootstrapReport` | Service contract and the admin path |
|
|
19
|
-
| `bootstrapDb`, `drainMiddleware`, `parseUrl`, `prepareConfig`, `probe`, `ensureSchema` | Helpers |
|
|
20
|
-
| `DEFAULT_ALIAS` (`'postgres'`), `DEF_ADMIN_ALIAS` (`'pg-admin'`), `DEF_POOL_SIZE`, `DEF_RETRIES` | Constants |
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import { appendPostgres } from '@owlmeans/postgres'
|
|
26
|
-
appendPostgres<C, T>(context)
|
|
27
|
-
|
|
28
|
-
cfg.dbs = [{
|
|
29
|
-
service: 'postgres', alias: 'postgres',
|
|
30
|
-
host: '/etc/app-config/pg-host', user: '/etc/app-config/pg-role-name',
|
|
31
|
-
secret: '/etc/master-secret/pg-app-password',
|
|
32
|
-
schema: 'app', meta: { database: '/etc/app-config/pg-db-name' }
|
|
33
|
-
}]
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Rules
|
|
37
|
-
|
|
38
|
-
- Use `appendPostgres`, not a bare `registerService` — the drain middleware is half the wiring.
|
|
39
|
-
- `DbConfig.schema` is the Postgres **SCHEMA** (layer-suffixed by `dbName()`); the **DATABASE** is
|
|
40
|
-
`meta.database` and is never suffixed. `meta.url` accepts a whole connection string and wins over
|
|
41
|
-
`host`/`user`/`secret`. A value starting with `/` is read as a file.
|
|
42
|
-
- `init()` already probes readiness (`SELECT 1`, 30×2s) and creates the schema — do not hand-roll a
|
|
43
|
-
retry loop. Auth / missing-database / permission codes fail fast instead of retrying.
|
|
44
|
-
- Keep the pool small; `max_connections` is a cluster-wide cap, so an oversized pool starves other
|
|
45
|
-
clients. Default `DEF_POOL_SIZE` is 10.
|
|
46
|
-
- All application-table DDL belongs to `@owlmeans/postgres-resource`. This service only creates the
|
|
47
|
-
schema.
|
|
48
|
-
- Superuser credentials go under a **separate** config alias (`pg-admin`), never the app's own entry.
|
|
49
|
-
- `bootstrap()` is idempotent and replaces hand-written `CREATE ROLE` / `CREATE DATABASE` / `GRANT`
|
|
50
|
-
SQL. If such SQL exists in a deployment script or doc, collapse it into a `bootstrap()` call.
|
|
51
|
-
- Use `defer()` for work that depends on another resource being initialized (foreign keys); it is
|
|
52
|
-
drained by the middleware once the context is up.
|
|
53
|
-
|
|
54
|
-
## Depends On
|
|
55
|
-
|
|
56
|
-
- `@owlmeans/postgres-resource`, `@owlmeans/resource`, `@owlmeans/context`,
|
|
57
|
-
`@owlmeans/server-context`, `@owlmeans/basic-keys`, `pg`, `drizzle-orm`
|