@owlmeans/postgres-resource 0.1.16-rc.0 → 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
@@ -204,10 +204,9 @@ surface as `RecordExists` and not-null violations as `MisshapedRecord`.
204
204
  <!-- owlmeans:agent-guidance:start -->
205
205
  ## Agent guidance
206
206
 
207
- This package ships embedded Claude Code skills and GitHub Copilot instructions under
208
- `agent-meta/`. After installing your `@owlmeans/*` packages, run the OwlMeans
209
- agent-skills installer to place them into your project's native locations
210
- (`.claude/skills/` and `.github/instructions/`):
207
+ This package ships embedded agent skills under `agent-meta/`. After installing your
208
+ `@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
209
+ your project's skill store (`.agents/skills/`):
211
210
 
212
211
  ```sh
213
212
  npx @owlmeans/agent-skills
@@ -1,8 +1,8 @@
1
1
  {
2
- "schemaVersion": 1,
2
+ "schemaVersion": 2,
3
3
  "package": "@owlmeans/postgres-resource",
4
- "version": "0.1.16-rc.0",
5
- "generatedAt": "2026-08-11T14:02:34.985Z",
4
+ "version": "0.1.16",
5
+ "generatedAt": "2026-08-14T10:14:48.854Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -10,14 +10,7 @@
10
10
  "name": "postgres-resource",
11
11
  "category": "package-specific",
12
12
  "file": "skills/postgres-resource/SKILL.md",
13
- "canonicalPath": ".claude/skills/postgres-resource/SKILL.md"
14
- },
15
- {
16
- "kind": "instruction",
17
- "name": "postgres-resource",
18
- "category": "package-specific",
19
- "file": "instructions/postgres-resource.instructions.md",
20
- "canonicalPath": ".github/instructions/postgres-resource.instructions.md"
13
+ "canonicalPath": ".agents/skills/postgres-resource/SKILL.md"
21
14
  }
22
15
  ]
23
16
  }
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/postgres-resource
9
9
 
10
10
  **Layer:** Infra
11
- **Install:** `"@owlmeans/postgres-resource": "^0.1.16-rc.0"` in `dependencies` (peers `pg`, `ajv`)
11
+ **Install:** `"@owlmeans/postgres-resource": "^0.1.16"` in `dependencies` (peers `pg`, `ajv`)
12
12
 
13
13
  The Postgres counterpart of [[mongo-resource]]. The difference that governs everything else: a
14
14
  Mongo collection has no structure, a Postgres table does — so **the resource layer owns the DDL**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/postgres-resource",
3
- "version": "0.1.16-rc.0",
3
+ "version": "0.1.16",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -27,16 +27,16 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@noble/hashes": "^1.5.0",
30
- "@owlmeans/basic-ids": "^0.1.16-rc.0",
31
- "@owlmeans/context": "^0.1.16-rc.0",
32
- "@owlmeans/resource": "^0.1.16-rc.0",
33
- "@owlmeans/server-context": "^0.1.16-rc.0",
30
+ "@owlmeans/basic-ids": "^0.1.16",
31
+ "@owlmeans/context": "^0.1.16",
32
+ "@owlmeans/resource": "^0.1.16",
33
+ "@owlmeans/server-context": "^0.1.16",
34
34
  "@scure/base": "^1.1.9",
35
35
  "drizzle-orm": "~0.45.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@owlmeans/dep-config": "workspace:*",
39
- "@owlmeans/test-integration": "^0.1.16-rc.0",
39
+ "@owlmeans/test-integration": "^0.1.16",
40
40
  "@types/bun": "^1.3.14",
41
41
  "@types/node": "^26.1.0",
42
42
  "@types/pg": "^8.20.4",
@@ -1,60 +0,0 @@
1
- ---
2
- description: "How to use @owlmeans/postgres-resource — PostgreSQL-backed Resource implementation. The AJV schema is the single source of truth for the table; structure reconciliation, code migrations, and {{alias}} custom SQL."
3
- applyTo: "**/*.ts, **/*.tsx"
4
- ---
5
- <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
6
-
7
- # @owlmeans/postgres-resource
8
-
9
- **Layer:** Infra
10
- **Install:** `"@owlmeans/postgres-resource": "^0.1.16-rc.0"` in `dependencies` (peers `pg`, `ajv`)
11
-
12
- ## Key Exports
13
-
14
- | Export | Description |
15
- |--------|-------------|
16
- | `makePostgresResource<R, T>(alias, dbAlias?, serviceAlias?, maker?, tableName?)` | Resource factory; aliases default to `'postgres'` |
17
- | `PostgresResource<T>`, `PostgresTx`, `PostgresDb`, `TableSpec` | Resource, transaction, db handle and compiled table types |
18
- | `pgKeyword` | `{ keyword: 'pg', valid: true }` — register when AJV runs in strict mode |
19
- | `pgErrorToResourceError`, `PostgresError` family | Driver-error translation |
20
- | `PgAutoSync`, `PgErrorCode`, `DEF_MIGRATIONS_TABLE`, `DEFAULT_DB_ALIAS` | Constants |
21
-
22
- ## Usage
23
-
24
- ```typescript
25
- const resource = makePostgresResource<ProjectRecord, ProjectResource>(RES_PROJECT, dbAlias, serviceAlias, maker)
26
- resource.schema = ProjectSchema
27
- resource.index('idx_project_entity', { columns: ['entityId'] })
28
- context.registerResource(resource)
29
- ```
30
-
31
- ## Rules
32
-
33
- - **The AJV schema is the table.** Never call `pgTable`/`pgSchema`, never call `drizzle()`, never run
34
- `drizzle-kit`, never hand-write `CREATE TABLE`. Two owners of the same DDL means reconciliation
35
- drops what the other owner added.
36
- - Express what JSON Schema can't through the `pg:` keyword — per property (`type`, `length`,
37
- `unique`, `index`, `references`, `check`, `managed`, …) and at the root (`table`, `indexes`,
38
- `unmanaged`, `autoSync`, …).
39
- - `DbConfig.meta.autoSync` defaults to `Full`, which **DROPs** undeclared columns. Adopt a
40
- pre-existing table with `Additive` first, confirm an empty plan, then flip to `Full`. Use
41
- `pg.unmanaged` for columns reconciliation must never touch.
42
- - Thread `nullable` at **every** recursion level of the type mapper — `date-time` and optional nested
43
- objects are where the Mongo mapper broke twice.
44
- - Migration `Pre` runs before the structure sync (the only place to rescue data a drop would lose),
45
- `Post` after. Migrations on a freshly created table are baselined, not executed. Keep bodies at
46
- **module scope** — the checksum fingerprints the function's source text.
47
- - Custom SQL interpolates **identifiers only**: `{{}}`/`{{self}}`, `{{alias}}`, `{{alias.property}}`,
48
- `{{#alias}}`, `{{$}}`. Values stay in `params` as `$1..$n`.
49
- - `{{alias}}` needs the target resource **initialized** — unlike Mongo's `ref`, which is a pure
50
- function of config. For foreign keys use `service.defer()`; don't reorder registrations.
51
- - `create` refuses a caller-supplied id (use `insert`); `update` replaces the whole record (use
52
- `patch`); `pick` deletes the record it returns; `load` rejects `opts.ttl`.
53
- - Drizzle wraps driver errors in `DrizzleQueryError` with the `pg` error on `cause` — classify
54
- through `pgErrorToResourceError`, never by reading `error.code` off the outer error.
55
- - `DbConfig.schema` is the Postgres SCHEMA; the DATABASE is `meta.database`.
56
- - Unit specs live here; specs building a real `ServerContext` live in `@owlmeans/postgres`.
57
-
58
- ## Depends On
59
-
60
- - `@owlmeans/resource`, `@owlmeans/context`, `@owlmeans/server-context`, `drizzle-orm`, peer `pg`/`ajv`