@owlmeans/postgres-resource 0.1.18-rc.41 → 0.1.18-rc.43
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 +13 -13
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/postgres-resource/SKILL.md +2 -2
- package/build/consts.d.ts +9 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +6 -0
- package/build/consts.js.map +1 -1
- package/build/declarations/types.d.ts +12 -0
- package/build/declarations/types.d.ts.map +1 -0
- package/build/declarations/types.js +2 -0
- package/build/declarations/types.js.map +1 -0
- package/build/declarations.d.ts +6 -9
- package/build/declarations.d.ts.map +1 -1
- package/build/declarations.js +25 -15
- package/build/declarations.js.map +1 -1
- package/build/errors.d.ts +0 -20
- package/build/errors.d.ts.map +1 -1
- package/build/errors.js +1 -111
- package/build/errors.js.map +1 -1
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/pg-error/types.d.ts +24 -0
- package/build/pg-error/types.d.ts.map +1 -0
- package/build/pg-error/types.js +2 -0
- package/build/pg-error/types.js.map +1 -0
- package/build/pg-error.d.ts +4 -0
- package/build/pg-error.d.ts.map +1 -0
- package/build/pg-error.js +100 -0
- package/build/pg-error.js.map +1 -0
- package/build/resource.d.ts +1 -1
- package/build/resource.d.ts.map +1 -1
- package/build/resource.js +15 -11
- package/build/resource.js.map +1 -1
- package/build/types.d.ts +6 -1
- package/build/types.d.ts.map +1 -1
- package/build/types.local.d.ts +14 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/build/utils/consts.local.d.ts +35 -0
- package/build/utils/consts.local.d.ts.map +1 -0
- package/build/utils/consts.local.js +63 -0
- package/build/utils/consts.local.js.map +1 -0
- package/build/utils/criteria/types.d.ts +31 -0
- package/build/utils/criteria/types.d.ts.map +1 -0
- package/build/utils/criteria/types.js +2 -0
- package/build/utils/criteria/types.js.map +1 -0
- package/build/utils/criteria.d.ts +3 -27
- package/build/utils/criteria.d.ts.map +1 -1
- package/build/utils/criteria.js +88 -107
- package/build/utils/criteria.js.map +1 -1
- package/build/utils/diff/types.d.ts +40 -0
- package/build/utils/diff/types.d.ts.map +1 -0
- package/build/utils/diff/types.js +2 -0
- package/build/utils/diff/types.js.map +1 -0
- package/build/utils/diff.d.ts +5 -35
- package/build/utils/diff.d.ts.map +1 -1
- package/build/utils/diff.js +321 -343
- package/build/utils/diff.js.map +1 -1
- package/build/utils/index.d.ts +10 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/introspect/types.d.ts +9 -0
- package/build/utils/introspect/types.d.ts.map +1 -0
- package/build/utils/introspect/types.js +2 -0
- package/build/utils/introspect/types.js.map +1 -0
- package/build/utils/introspect.d.ts +3 -3
- package/build/utils/introspect.d.ts.map +1 -1
- package/build/utils/introspect.js +42 -67
- package/build/utils/introspect.js.map +1 -1
- package/build/utils/life-cycle/types.d.ts +37 -0
- package/build/utils/life-cycle/types.d.ts.map +1 -0
- package/build/utils/life-cycle/types.js +2 -0
- package/build/utils/life-cycle/types.js.map +1 -0
- package/build/utils/life-cycle.d.ts +3 -38
- package/build/utils/life-cycle.d.ts.map +1 -1
- package/build/utils/life-cycle.js +90 -107
- package/build/utils/life-cycle.js.map +1 -1
- package/build/utils/marshal/types.d.ts +39 -0
- package/build/utils/marshal/types.d.ts.map +1 -0
- package/build/utils/marshal/types.js +2 -0
- package/build/utils/marshal/types.js.map +1 -0
- package/build/utils/marshal.d.ts +4 -32
- package/build/utils/marshal.d.ts.map +1 -1
- package/build/utils/marshal.js +124 -141
- package/build/utils/marshal.js.map +1 -1
- package/build/utils/migrations.d.ts.map +1 -1
- package/build/utils/migrations.js +41 -36
- package/build/utils/migrations.js.map +1 -1
- package/build/utils/name/types.d.ts +43 -0
- package/build/utils/name/types.d.ts.map +1 -0
- package/build/utils/name/types.js +2 -0
- package/build/utils/name/types.js.map +1 -0
- package/build/utils/name.d.ts +6 -35
- package/build/utils/name.d.ts.map +1 -1
- package/build/utils/name.js +40 -59
- package/build/utils/name.js.map +1 -1
- package/build/utils/schema/types.d.ts +22 -0
- package/build/utils/schema/types.d.ts.map +1 -0
- package/build/utils/schema/types.js +2 -0
- package/build/utils/schema/types.js.map +1 -0
- package/build/utils/schema.d.ts +4 -24
- package/build/utils/schema.d.ts.map +1 -1
- package/build/utils/schema.js +341 -352
- package/build/utils/schema.js.map +1 -1
- package/build/utils/sql/types.d.ts +25 -0
- package/build/utils/sql/types.d.ts.map +1 -0
- package/build/utils/sql/types.js +2 -0
- package/build/utils/sql/types.js.map +1 -0
- package/build/utils/sql.d.ts +5 -27
- package/build/utils/sql.d.ts.map +1 -1
- package/build/utils/sql.js +0 -0
- package/build/utils/sql.js.map +1 -1
- package/build/utils/sync/types.d.ts +25 -0
- package/build/utils/sync/types.d.ts.map +1 -0
- package/build/utils/sync/types.js +2 -0
- package/build/utils/sync/types.js.map +1 -0
- package/build/utils/sync.d.ts +2 -19
- package/build/utils/sync.d.ts.map +1 -1
- package/build/utils/sync.js +67 -84
- package/build/utils/sync.js.map +1 -1
- package/build/utils/types.d.ts +18 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -0
- package/build/utils/types.js.map +1 -0
- package/build/utils/types.local.d.ts +33 -0
- package/build/utils/types.local.d.ts.map +1 -0
- package/build/utils/types.local.js +2 -0
- package/build/utils/types.local.js.map +1 -0
- package/package.json +14 -13
- package/src/consts.ts +7 -0
- package/src/declarations/types.ts +12 -0
- package/src/declarations.ts +30 -23
- package/src/errors.ts +1 -131
- package/src/index.ts +3 -0
- package/src/pg-error/types.ts +23 -0
- package/src/pg-error.ts +114 -0
- package/src/resource.ts +20 -24
- package/src/types.local.ts +16 -0
- package/src/types.ts +8 -4
- package/src/utils/consts.local.ts +71 -0
- package/src/utils/criteria/types.ts +32 -0
- package/src/utils/criteria.ts +99 -129
- package/src/utils/diff/types.ts +41 -0
- package/src/utils/diff.ts +331 -348
- package/src/utils/index.ts +10 -0
- package/src/utils/introspect/types.ts +9 -0
- package/src/utils/introspect.ts +54 -79
- package/src/utils/life-cycle/types.ts +41 -0
- package/src/utils/life-cycle.ts +108 -134
- package/src/utils/marshal/types.ts +40 -0
- package/src/utils/marshal.ts +134 -147
- package/src/utils/migrations.ts +39 -33
- package/src/utils/name/types.ts +44 -0
- package/src/utils/name.ts +49 -63
- package/src/utils/schema/types.ts +26 -0
- package/src/utils/schema.ts +366 -397
- package/src/utils/sql/types.ts +25 -0
- package/src/utils/sql.ts +0 -0
- package/src/utils/sync/types.ts +25 -0
- package/src/utils/sync.ts +65 -83
- package/src/utils/types.local.ts +35 -0
- package/src/utils/types.ts +19 -0
- package/tests/criteria.spec.ts +4 -1
- package/tests/diff.spec.ts +28 -1
- package/tests/errors.spec.ts +4 -3
- package/tests/name.spec.ts +5 -3
- package/tests/schema.spec.ts +3 -1
- package/tests/sql.spec.ts +20 -22
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ SQL. Other stores fit other shapes:
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
bun add @owlmeans/postgres-resource@^0.1.18-rc.
|
|
16
|
+
bun add @owlmeans/postgres-resource@^0.1.18-rc.43 @owlmeans/postgres@^0.1.18-rc.45 pg
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`pg` and `ajv` are peer dependencies of this package. `@owlmeans/postgres` provides the connection
|
|
@@ -81,7 +81,7 @@ await projects.update({ ...record, title: 'Renamed' }) // replace
|
|
|
81
81
|
|
|
82
82
|
`size` defaults to `DEFAULT_PAGE_SIZE` (100); `list(where, { size: 0 })` lifts the limit. `total`
|
|
83
83
|
always describes the whole match, independently of the page. `entityId` is the organization's
|
|
84
|
-
stable record id from `
|
|
84
|
+
stable record id from `makeEntityScope(req).requireEntityKey()`, never a value read off the token.
|
|
85
85
|
|
|
86
86
|
### Schema to table
|
|
87
87
|
|
|
@@ -224,7 +224,7 @@ are `@>`/`<@`/`&&` on array columns.
|
|
|
224
224
|
`PostgresError` and its subclasses are `PostgresSyncError`, `PostgresCastRequired`,
|
|
225
225
|
`PostgresConstraintError`, `PostgresForeignKeyError`, `PostgresCheckError`, `PostgresDeadlockError`
|
|
226
226
|
(`retryable`), `PostgresPlaceholderError`, `PostgresConnectionError` and `PostgresBootstrapError`.
|
|
227
|
-
Driver errors are translated by `pgErrorToResourceError`, which unwraps Drizzle's
|
|
227
|
+
Driver errors are translated by `pgErrorHelper.pgErrorToResourceError`, which unwraps Drizzle's
|
|
228
228
|
`DrizzleQueryError` to reach the `pg` error underneath and preserves the raw
|
|
229
229
|
`code`/`detail`/`hint`/`severity` in the message. Unique violations surface as `RecordExists` and
|
|
230
230
|
not-null violations as `MisshapedRecord`.
|
|
@@ -240,17 +240,17 @@ not-null violations as `MisshapedRecord`.
|
|
|
240
240
|
| `PgPropertyOverride`, `PgRootOverride`, `PgIndexSpec`, `PgUniqueSpec`, `PgCheckSpec`, `PgReferenceSpec` | type | The `pg:` vocabulary and `index()` spec |
|
|
241
241
|
| `LiveTable`, `LiveColumn`, `LiveIndex`, `LiveConstraint`, `DdlPlan`, `DdlStatement`, `DdlKind` | type | Introspection results and the reconciliation plan |
|
|
242
242
|
| `pgKeyword` | const | `{ keyword: 'pg', valid: true }` for AJV strict mode |
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
246
|
-
| `pgTableName`, `pgIdentifier`, `assertSqlIdentifier`, `quoteIdent`, `quoteLiteral`, `qualify`, `advisoryKey` |
|
|
247
|
-
| `
|
|
248
|
-
| `
|
|
249
|
-
| `introspectTable`, `countNonNull`, `
|
|
243
|
+
| `pgSchemaHelper` (`PgSchemaHelper`) | helper | The schema compiler: `schemaToTableSpec`, `toFormatType` |
|
|
244
|
+
| `pgCriteriaHelper` (`PgCriteriaHelper`) | helper | `criteriaToSql` — `Criteria<T>` to a WHERE clause; `sortToSql` — `Sort<T>` to ORDER BY over the same table |
|
|
245
|
+
| `pgPlaceholdersOf(context)` (`makePgPlaceholderHelper`, `PgPlaceholderHelper`), `resetPlaceholderCache`, `PlaceholderContext` | helper / function / type | `{{alias}}` resolution through one context — `refOf(self, alias?)`, `resolvePlaceholders(text, self)` — identifiers only |
|
|
246
|
+
| `pgNameHelper` (`PgNameHelper`) | helper | Identifier helpers: `pgTableName`, `pgIdentifier`, `assertSqlIdentifier`, `quoteIdent`, `quoteLiteral`, `qualify`, `advisoryKey` |
|
|
247
|
+
| `pgMarshalHelper` (`PgMarshalHelper`), `specToTable` | helper / function | Row and record marshalling (`rowToRecord`, `resultToRecord`, `recordToValues`, `recordToFullValues`), Drizzle table construction |
|
|
248
|
+
| `makePgLifeCycleHelper(db)` (`PgLifeCycleHelper`), `TableInit` | helper / type | The `init()` lifecycle: `initializeTable`, `applyForeignKeys` |
|
|
249
|
+
| `makePgIntrospectHelper(client)`, `makePgSyncHelper(client)`, `pgDiffHelper` | helper | Reconciliation machinery: `introspectTable`, `countNonNull`; `acquireLock`, `releaseLock`, `ensureSchema`, `applyPlan`; `planSync`, `planForeignKeys`, `canonicalDefinition` |
|
|
250
250
|
| `makeTx`, `makeMigrationStore` | function | The migration façade and ledger |
|
|
251
|
-
| `
|
|
251
|
+
| `pgDeclarationHelper` (`PgDeclarationHelper`), `PostgresDeclaration` | helper / type | Module-scope declarations per alias: `getDeclaration`, and `resetDeclarations` — the testing seam |
|
|
252
252
|
| `getSchemaSecureFeilds` | function | `secure: true` properties used by `lock`/`unlock` |
|
|
253
|
-
| `
|
|
253
|
+
| `pgErrorHelper` (`PgErrorHelper`), `PostgresError` family | helper / class | Driver error translation: `pgErrorToResourceError`, `describePgError` |
|
|
254
254
|
| `DEFAULT_DB_ALIAS`, `DEFAULT_PAGE_SIZE`, `DEF_MIGRATIONS_TABLE` | const | `'postgres'`, `100`, `'_owlmeans_migrations'` |
|
|
255
255
|
| `PG_KEYWORD`, `PG_MAX_IDENTIFIER`, `ID_FIELD`, `DEF_SQL_TYPE`, `DEF_JSON_TYPE`, `DEF_ID_DEFAULT`, `STRING_RETURNING_TYPES` | const | Compiler constants |
|
|
256
256
|
| `PgAutoSync`, `PgIndexMethod`, `PgReferentialAction`, `PgErrorCode`, `PgTypeOid` | enum | Reconciliation policy, index methods, FK actions, driver codes, type OIDs |
|
|
@@ -293,7 +293,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
293
293
|
your project's skill store (`.agents/skills/`):
|
|
294
294
|
|
|
295
295
|
```sh
|
|
296
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
296
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.49
|
|
297
297
|
```
|
|
298
298
|
|
|
299
299
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/postgres-resource",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.43",
|
|
5
|
+
"generatedAt": "2026-10-05T21:03:06.396Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -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.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/postgres-resource": "^0.1.18-rc.43"` 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**
|
|
@@ -100,7 +100,7 @@ declaration sites merge into one `TableSpec` — the schema root, a per-property
|
|
|
100
100
|
not an error. Two entries under one name would emit the same `CREATE INDEX` twice in a single DDL
|
|
101
101
|
transaction, and Postgres answers the second with `42P07`, rolling back the plan that created the
|
|
102
102
|
table: the resource then fails every boot with an error naming an index that does not exist.
|
|
103
|
-
The compiler collapses the duplicates itself, keeps the first declaration and
|
|
103
|
+
The compiler collapses the duplicates itself, keeps the first declaration and logs a warning.
|
|
104
104
|
|
|
105
105
|
## Reconciliation is authoritative — `PgAutoSync`
|
|
106
106
|
|
package/build/consts.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export declare const DEFAULT_PAGE_SIZE = 100;
|
|
|
15
15
|
export declare const DEF_MIGRATIONS_TABLE = "_owlmeans_migrations";
|
|
16
16
|
/** JSON Schema keyword carrying the Postgres specific overrides. */
|
|
17
17
|
export declare const PG_KEYWORD = "pg";
|
|
18
|
+
/**
|
|
19
|
+
* AJV keyword registration for consumers running in strict mode. The mapper reads the raw
|
|
20
|
+
* schema object and never validates through AJV, so this is purely to stop strict mode
|
|
21
|
+
* rejecting a schema that carries `pg` overrides.
|
|
22
|
+
*/
|
|
23
|
+
export declare const pgKeyword: {
|
|
24
|
+
keyword: string;
|
|
25
|
+
valid: boolean;
|
|
26
|
+
};
|
|
18
27
|
/** Postgres `NAMEDATALEN - 1`. Identifiers past this are silently truncated by the server. */
|
|
19
28
|
export declare const PG_MAX_IDENTIFIER = 63;
|
|
20
29
|
/** Property name that carries the record identity across every OwlMeans resource. */
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,aAAa,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,yBAAyB,CAAA;AAE1D,oEAAoE;AACpE,eAAO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C9B,gBAAgB,UAAU;IAC1B,mBAAmB,UAAU;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,YAAI,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAU,CAAA;AAEhG,uFAAuF;AACvF,oBAAY,SAAS;IACnB,IAAI,OAAO;IACX,SAAS,OAAO;IAChB,WAAW,OAAO;CACnB"}
|
package/build/consts.js
CHANGED
|
@@ -15,6 +15,12 @@ export const DEFAULT_PAGE_SIZE = 100;
|
|
|
15
15
|
export const DEF_MIGRATIONS_TABLE = '_owlmeans_migrations';
|
|
16
16
|
/** JSON Schema keyword carrying the Postgres specific overrides. */
|
|
17
17
|
export const PG_KEYWORD = 'pg';
|
|
18
|
+
/**
|
|
19
|
+
* AJV keyword registration for consumers running in strict mode. The mapper reads the raw
|
|
20
|
+
* schema object and never validates through AJV, so this is purely to stop strict mode
|
|
21
|
+
* rejecting a schema that carries `pg` overrides.
|
|
22
|
+
*/
|
|
23
|
+
export const pgKeyword = { keyword: PG_KEYWORD, valid: true };
|
|
18
24
|
/** Postgres `NAMEDATALEN - 1`. Identifiers past this are silently truncated by the server. */
|
|
19
25
|
export const PG_MAX_IDENTIFIER = 63;
|
|
20
26
|
/** Property name that carries the record identity across every OwlMeans resource. */
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAA;AAE1D,oEAAoE;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA;AAE9B,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,C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'../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The per-alias declaration store every postgres resource maker reads and extends — schema,
|
|
4
|
+
* indexes and migrations, keyed by resource alias.
|
|
5
|
+
*/
|
|
6
|
+
export interface PgDeclarationHelper {
|
|
7
|
+
/** The declaration of an alias, created empty on first use. */
|
|
8
|
+
getDeclaration: (alias: string) => PostgresDeclaration;
|
|
9
|
+
/** Testing seam — drops every declaration so a spec can redeclare a resource from scratch. */
|
|
10
|
+
resetDeclarations: (alias?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/declarations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,mBAAmB,CAAA;IACtD,8FAA8F;IAC9F,iBAAiB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/declarations/types.ts"],"names":[],"mappings":""}
|
package/build/declarations.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
indexes: PgIndexSpec[];
|
|
7
|
-
migrations: MigrationRegistry<PostgresTx>;
|
|
8
|
-
}
|
|
1
|
+
import type { PgDeclarationHelper } from './declarations/types.js';
|
|
2
|
+
import type { PostgresDeclaration } from './types.js';
|
|
3
|
+
export declare const createPgDeclarationHelper: () => PgDeclarationHelper;
|
|
4
|
+
export declare const pgDeclarationHelper: PgDeclarationHelper;
|
|
5
|
+
/** @deprecated compat:factory-refactor — use `pgDeclarationHelper.getDeclaration(…)` */
|
|
9
6
|
export declare const getDeclaration: (alias: string) => PostgresDeclaration;
|
|
10
|
-
/**
|
|
7
|
+
/** @deprecated compat:factory-refactor — use `pgDeclarationHelper.resetDeclarations(…)` */
|
|
11
8
|
export declare const resetDeclarations: (alias?: string) => void;
|
|
12
9
|
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EAAc,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAgBjE,eAAO,MAAM,yBAAyB,QAAO,mBAoB5C,CAAA;AAED,eAAO,MAAM,mBAAmB,qBAA8B,CAAA;AAE9D,wFAAwF;AACxF,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,mBAAgE,CAAA;AAE/G,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,IAAoD,CAAA"}
|
package/build/declarations.js
CHANGED
|
@@ -7,22 +7,32 @@ import { createMigrationRegistry } from '@owlmeans/resource';
|
|
|
7
7
|
* a no-op: every run reads and extends the same schema, indexes and migrations, so nothing a
|
|
8
8
|
* caller chained onto an earlier resource object is lost. Losing a migration is silent — the
|
|
9
9
|
* data transformation simply never runs — which is why the store cannot live on the object.
|
|
10
|
+
*
|
|
11
|
+
* Process-wide for the same reason: it stays outside the factory, so every helper built from it
|
|
12
|
+
* reads the one store.
|
|
10
13
|
*/
|
|
11
14
|
const declarations = new Map();
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declaration
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
export const createPgDeclarationHelper = () => {
|
|
16
|
+
const getDeclaration = (alias) => {
|
|
17
|
+
let declaration = declarations.get(alias);
|
|
18
|
+
if (declaration == null) {
|
|
19
|
+
declaration = { indexes: [], migrations: createMigrationRegistry() };
|
|
20
|
+
declarations.set(alias, declaration);
|
|
21
|
+
}
|
|
22
|
+
return declaration;
|
|
23
|
+
};
|
|
24
|
+
const resetDeclarations = (alias) => {
|
|
25
|
+
if (alias == null) {
|
|
26
|
+
declarations.clear();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
declarations.delete(alias);
|
|
30
|
+
};
|
|
31
|
+
return { getDeclaration, resetDeclarations };
|
|
27
32
|
};
|
|
33
|
+
export const pgDeclarationHelper = createPgDeclarationHelper();
|
|
34
|
+
/** @deprecated compat:factory-refactor — use `pgDeclarationHelper.getDeclaration(…)` */
|
|
35
|
+
export const getDeclaration = (alias) => pgDeclarationHelper.getDeclaration(alias);
|
|
36
|
+
/** @deprecated compat:factory-refactor — use `pgDeclarationHelper.resetDeclarations(…)` */
|
|
37
|
+
export const resetDeclarations = (alias) => pgDeclarationHelper.resetDeclarations(alias);
|
|
28
38
|
//# sourceMappingURL=declarations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAK5D;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAqC,IAAI,GAAG,EAAE,CAAA;AAEhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAwB,EAAE;IACjE,MAAM,cAAc,GAAG,CAAC,KAAa,EAAuB,EAAE;QAC5D,IAAI,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACxB,WAAW,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,uBAAuB,EAAc,EAAE,CAAA;YAChF,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACtC,CAAC;QAED,OAAO,WAAW,CAAA;IACpB,CAAC,CAAA;IAED,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAQ,EAAE;QACjD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,YAAY,CAAC,KAAK,EAAE,CAAA;YACpB,OAAM;QACR,CAAC;QACD,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC,CAAA;IAED,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAA;AAC9C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,EAAE,CAAA;AAE9D,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAuB,EAAE,CAAC,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;AAE/G,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAQ,EAAE,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
|
package/build/errors.d.ts
CHANGED
|
@@ -49,24 +49,4 @@ export declare class PostgresBootstrapError extends PostgresError {
|
|
|
49
49
|
static typeName: string;
|
|
50
50
|
constructor(message: string);
|
|
51
51
|
}
|
|
52
|
-
/**
|
|
53
|
-
* The framework's error marshalling preserves only type, message and stack, so the
|
|
54
|
-
* Postgres diagnostics have to travel inside the message. Downstream tooling — notably
|
|
55
|
-
* the viable-agent fixer, which retries on `42P01` / `42703` — classifies on exactly
|
|
56
|
-
* this text, so the code always leads.
|
|
57
|
-
*
|
|
58
|
-
* `where` is deliberately never included: it can echo bound parameter values.
|
|
59
|
-
*
|
|
60
|
-
* Exported so a wrapper can quote the diagnostics without also quoting the translated error's
|
|
61
|
-
* own type prefix, which would nest one error vocabulary inside another's message.
|
|
62
|
-
*/
|
|
63
|
-
export declare const describePgError: (error: unknown) => string;
|
|
64
|
-
/**
|
|
65
|
-
* Translate a raw `pg` driver error into the framework's error vocabulary, so a driver
|
|
66
|
-
* type never escapes the package. Errors that already are `ResilientError`s pass through
|
|
67
|
-
* untouched — the reconciler and the migration runner raise their own.
|
|
68
|
-
* A migration may supply its resolved SQL; placeholders stay intact and parameter values
|
|
69
|
-
* are never added. The statement travels in the message so error marshalling preserves it.
|
|
70
|
-
*/
|
|
71
|
-
export declare const pgErrorToResourceError: (error: unknown, query?: string) => Error;
|
|
72
52
|
//# sourceMappingURL=errors.d.ts.map
|
package/build/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,qBAAa,aAAc,SAAQ,aAAa;IAC9C,OAAuB,QAAQ,SAA2C;IAE1E,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED,oFAAoF;AACpF,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,OAAuB,QAAQ,SAAuC;IAEtE,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IACzD,OAAuB,QAAQ,SAA8C;IAE7E,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,OAAuB,QAAQ,SAA6C;IAE5E,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,uBAAwB,SAAQ,uBAAuB;IAClE,OAAuB,QAAQ,SAAkD;IAEjF,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,kBAAmB,SAAQ,uBAAuB;IAC7D,OAAuB,QAAQ,SAA6C;IAE5E,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,sFAAsF;AACtF,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAuB,QAAQ,SAA2C;IAE1E,SAAgB,SAAS,EAAE,OAAO,CAAO;IAEzC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,oEAAoE;AACpE,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,OAAuB,QAAQ,SAA8C;IAE7E,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,OAAuB,QAAQ,SAA6C;IAE5E,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,6CAA6C;AAC7C,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,OAAuB,QAAQ,SAA4C;IAE3E,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF"}
|
package/build/errors.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ResilientError } from '@owlmeans/error';
|
|
2
|
-
import {
|
|
3
|
-
import { PgErrorCode } from './consts.js';
|
|
2
|
+
import { ResourceError } from '@owlmeans/resource';
|
|
4
3
|
export class PostgresError extends ResourceError {
|
|
5
4
|
static typeName = `${ResourceError.typeName}PostgresError`;
|
|
6
5
|
constructor(message = 'error') {
|
|
@@ -81,115 +80,6 @@ export class PostgresBootstrapError extends PostgresError {
|
|
|
81
80
|
this.type = PostgresBootstrapError.typeName;
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
|
-
const isDriverError = (error) => error != null && typeof error === 'object' && 'code' in error;
|
|
85
|
-
/**
|
|
86
|
-
* Reach the `pg` error inside whatever wrapped it.
|
|
87
|
-
*
|
|
88
|
-
* Drizzle raises `DrizzleQueryError` and hangs the driver error off `cause`, so a unique
|
|
89
|
-
* violation arriving through the query builder carries no `code` at the top level. Reading
|
|
90
|
-
* only the outer error is what makes the whole vocabulary below collapse to one opaque
|
|
91
|
-
* class on every CRUD path — and it is exactly the paths that go through Drizzle.
|
|
92
|
-
*
|
|
93
|
-
* The walk is bounded because `cause` chains can be circular.
|
|
94
|
-
*/
|
|
95
|
-
const unwrap = (error) => {
|
|
96
|
-
let current = error;
|
|
97
|
-
for (let depth = 0; depth < 8; depth += 1) {
|
|
98
|
-
if (isDriverError(current)) {
|
|
99
|
-
return current;
|
|
100
|
-
}
|
|
101
|
-
const cause = current?.cause;
|
|
102
|
-
if (cause == null || cause === current) {
|
|
103
|
-
return error;
|
|
104
|
-
}
|
|
105
|
-
current = cause;
|
|
106
|
-
}
|
|
107
|
-
return error;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* The framework's error marshalling preserves only type, message and stack, so the
|
|
111
|
-
* Postgres diagnostics have to travel inside the message. Downstream tooling — notably
|
|
112
|
-
* the viable-agent fixer, which retries on `42P01` / `42703` — classifies on exactly
|
|
113
|
-
* this text, so the code always leads.
|
|
114
|
-
*
|
|
115
|
-
* `where` is deliberately never included: it can echo bound parameter values.
|
|
116
|
-
*
|
|
117
|
-
* Exported so a wrapper can quote the diagnostics without also quoting the translated error's
|
|
118
|
-
* own type prefix, which would nest one error vocabulary inside another's message.
|
|
119
|
-
*/
|
|
120
|
-
export const describePgError = (error) => {
|
|
121
|
-
const driver = unwrap(error);
|
|
122
|
-
if (!isDriverError(driver)) {
|
|
123
|
-
return error instanceof Error ? error.message : `${error}`;
|
|
124
|
-
}
|
|
125
|
-
return describe(driver);
|
|
126
|
-
};
|
|
127
|
-
const describe = (error) => {
|
|
128
|
-
const parts = [error.code ?? 'unknown'];
|
|
129
|
-
if (error.message != null)
|
|
130
|
-
parts.push(error.message);
|
|
131
|
-
if (error.constraint != null)
|
|
132
|
-
parts.push(`constraint=${error.constraint}`);
|
|
133
|
-
if (error.table != null)
|
|
134
|
-
parts.push(`table=${error.table}`);
|
|
135
|
-
if (error.column != null)
|
|
136
|
-
parts.push(`column=${error.column}`);
|
|
137
|
-
if (error.detail != null)
|
|
138
|
-
parts.push(`detail=${error.detail}`);
|
|
139
|
-
if (error.hint != null)
|
|
140
|
-
parts.push(`hint=${error.hint}`);
|
|
141
|
-
if (error.severity != null)
|
|
142
|
-
parts.push(`severity=${error.severity}`);
|
|
143
|
-
return parts.join(' ');
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Translate a raw `pg` driver error into the framework's error vocabulary, so a driver
|
|
147
|
-
* type never escapes the package. Errors that already are `ResilientError`s pass through
|
|
148
|
-
* untouched — the reconciler and the migration runner raise their own.
|
|
149
|
-
* A migration may supply its resolved SQL; placeholders stay intact and parameter values
|
|
150
|
-
* are never added. The statement travels in the message so error marshalling preserves it.
|
|
151
|
-
*/
|
|
152
|
-
export const pgErrorToResourceError = (error, query) => {
|
|
153
|
-
if (error instanceof ResilientError) {
|
|
154
|
-
return error;
|
|
155
|
-
}
|
|
156
|
-
const driver = unwrap(error);
|
|
157
|
-
if (!isDriverError(driver)) {
|
|
158
|
-
return error instanceof Error ? error : new PostgresError(`${error}`);
|
|
159
|
-
}
|
|
160
|
-
const message = describe(driver) + (query == null ? '' : `\nSQL: ${query}`);
|
|
161
|
-
const produce = () => {
|
|
162
|
-
switch (driver.code) {
|
|
163
|
-
case PgErrorCode.UniqueViolation:
|
|
164
|
-
return new RecordExists(message);
|
|
165
|
-
case PgErrorCode.NotNullViolation:
|
|
166
|
-
return new MisshapedRecord(message);
|
|
167
|
-
case PgErrorCode.ForeignKeyViolation:
|
|
168
|
-
return new PostgresForeignKeyError(message);
|
|
169
|
-
case PgErrorCode.CheckViolation:
|
|
170
|
-
return new PostgresCheckError(message);
|
|
171
|
-
case PgErrorCode.DatatypeMismatch:
|
|
172
|
-
case PgErrorCode.CannotCoerce:
|
|
173
|
-
return new PostgresCastRequired(message);
|
|
174
|
-
case PgErrorCode.SerializationFailure:
|
|
175
|
-
case PgErrorCode.DeadlockDetected:
|
|
176
|
-
return new PostgresDeadlockError(message);
|
|
177
|
-
default:
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
if (driver.code != null && driver.code.startsWith('08')) {
|
|
181
|
-
return new PostgresConnectionError(message);
|
|
182
|
-
}
|
|
183
|
-
if (driver.code != null && driver.code.startsWith('23')) {
|
|
184
|
-
return new PostgresConstraintError(message);
|
|
185
|
-
}
|
|
186
|
-
return new PostgresError(message);
|
|
187
|
-
};
|
|
188
|
-
const produced = produce();
|
|
189
|
-
/** The *original* error, wrapper and all — unwrapping is for classification, not for loss. */
|
|
190
|
-
produced.cause = error;
|
|
191
|
-
return produced;
|
|
192
|
-
};
|
|
193
83
|
ResilientError.registerErrorClass(PostgresError);
|
|
194
84
|
ResilientError.registerErrorClass(PostgresSyncError);
|
|
195
85
|
ResilientError.registerErrorClass(PostgresCastRequired);
|
package/build/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,OAAO,aAAc,SAAQ,aAAa;IACvC,MAAM,CAAU,QAAQ,GAAG,GAAG,aAAa,CAAC,QAAQ,eAAe,CAAA;IAE1E,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,YAAY,OAAO,EAAE,CAAC,CAA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CACF;AAED,cAAc,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAA;AAChD,cAAc,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AACpD,cAAc,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;AACvD,cAAc,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;AAC1D,cAAc,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;AAC1D,cAAc,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;AACrD,cAAc,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAA;AACxD,cAAc,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAA;AAC3D,cAAc,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;AAC1D,cAAc,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export type * from './types.js';
|
|
2
2
|
export * from './consts.js';
|
|
3
3
|
export * from './declarations.js';
|
|
4
|
+
export type * from './declarations/types.js';
|
|
4
5
|
export * from './errors.js';
|
|
6
|
+
export * from './pg-error.js';
|
|
7
|
+
export type * from './pg-error/types.js';
|
|
5
8
|
export * from './helper.js';
|
|
6
9
|
export * from './resource.js';
|
|
7
10
|
export * from './utils/index.js';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,mBAAmB,yBAAyB,CAAA;AAC5C,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,mBAAmB,qBAAqB,CAAA;AACxC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
|
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AAEjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAE7B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Reading and translating the errors the `pg` driver raises. */
|
|
2
|
+
export interface PgErrorHelper {
|
|
3
|
+
/**
|
|
4
|
+
* The framework's error marshalling preserves only type, message and stack, so the
|
|
5
|
+
* Postgres diagnostics have to travel inside the message. Downstream tooling — notably
|
|
6
|
+
* the viable-agent fixer, which retries on `42P01` / `42703` — classifies on exactly
|
|
7
|
+
* this text, so the code always leads.
|
|
8
|
+
*
|
|
9
|
+
* `where` is deliberately never included: it can echo bound parameter values.
|
|
10
|
+
*
|
|
11
|
+
* Exported so a wrapper can quote the diagnostics without also quoting the translated error's
|
|
12
|
+
* own type prefix, which would nest one error vocabulary inside another's message.
|
|
13
|
+
*/
|
|
14
|
+
describePgError: (error: unknown) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Translate a raw `pg` driver error into the framework's error vocabulary, so a driver
|
|
17
|
+
* type never escapes the package. Errors that already are `ResilientError`s pass through
|
|
18
|
+
* untouched — the reconciler and the migration runner raise their own.
|
|
19
|
+
* A migration may supply its resolved SQL; placeholders stay intact and parameter values
|
|
20
|
+
* are never added. The statement travels in the message so error marshalling preserves it.
|
|
21
|
+
*/
|
|
22
|
+
pgErrorToResourceError: (error: unknown, query?: string) => Error;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pg-error/types.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;OAUG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAA;IAC3C;;;;;;OAMG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,KAAK,CAAA;CAClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/pg-error/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pg-error.d.ts","sourceRoot":"","sources":["../src/pg-error.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,eAAO,MAAM,mBAAmB,QAAO,aAmGtC,CAAA;AAED,eAAO,MAAM,aAAa,eAAwB,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ResilientError } from '@owlmeans/error';
|
|
2
|
+
import { MisshapedRecord, RecordExists } from '@owlmeans/resource';
|
|
3
|
+
import { PgErrorCode } from './consts.js';
|
|
4
|
+
import { PostgresCastRequired, PostgresCheckError, PostgresConnectionError, PostgresConstraintError, PostgresDeadlockError, PostgresError, PostgresForeignKeyError } from './errors.js';
|
|
5
|
+
export const createPgErrorHelper = () => {
|
|
6
|
+
const isDriverError = (error) => error != null && typeof error === 'object' && 'code' in error;
|
|
7
|
+
/**
|
|
8
|
+
* Reach the `pg` error inside whatever wrapped it.
|
|
9
|
+
*
|
|
10
|
+
* Drizzle raises `DrizzleQueryError` and hangs the driver error off `cause`, so a unique
|
|
11
|
+
* violation arriving through the query builder carries no `code` at the top level. Reading
|
|
12
|
+
* only the outer error is what makes the whole vocabulary below collapse to one opaque
|
|
13
|
+
* class on every CRUD path — and it is exactly the paths that go through Drizzle.
|
|
14
|
+
*
|
|
15
|
+
* The walk is bounded because `cause` chains can be circular.
|
|
16
|
+
*/
|
|
17
|
+
const unwrap = (error) => {
|
|
18
|
+
let current = error;
|
|
19
|
+
for (let depth = 0; depth < 8; depth += 1) {
|
|
20
|
+
if (isDriverError(current)) {
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
const cause = current?.cause;
|
|
24
|
+
if (cause == null || cause === current) {
|
|
25
|
+
return error;
|
|
26
|
+
}
|
|
27
|
+
current = cause;
|
|
28
|
+
}
|
|
29
|
+
return error;
|
|
30
|
+
};
|
|
31
|
+
const describePgError = (error) => {
|
|
32
|
+
const driver = unwrap(error);
|
|
33
|
+
if (!isDriverError(driver)) {
|
|
34
|
+
return error instanceof Error ? error.message : `${error}`;
|
|
35
|
+
}
|
|
36
|
+
return describe(driver);
|
|
37
|
+
};
|
|
38
|
+
const describe = (error) => {
|
|
39
|
+
const parts = [error.code ?? 'unknown'];
|
|
40
|
+
if (error.message != null)
|
|
41
|
+
parts.push(error.message);
|
|
42
|
+
if (error.constraint != null)
|
|
43
|
+
parts.push(`constraint=${error.constraint}`);
|
|
44
|
+
if (error.table != null)
|
|
45
|
+
parts.push(`table=${error.table}`);
|
|
46
|
+
if (error.column != null)
|
|
47
|
+
parts.push(`column=${error.column}`);
|
|
48
|
+
if (error.detail != null)
|
|
49
|
+
parts.push(`detail=${error.detail}`);
|
|
50
|
+
if (error.hint != null)
|
|
51
|
+
parts.push(`hint=${error.hint}`);
|
|
52
|
+
if (error.severity != null)
|
|
53
|
+
parts.push(`severity=${error.severity}`);
|
|
54
|
+
return parts.join(' ');
|
|
55
|
+
};
|
|
56
|
+
const pgErrorToResourceError = (error, query) => {
|
|
57
|
+
if (error instanceof ResilientError) {
|
|
58
|
+
return error;
|
|
59
|
+
}
|
|
60
|
+
const driver = unwrap(error);
|
|
61
|
+
if (!isDriverError(driver)) {
|
|
62
|
+
return error instanceof Error ? error : new PostgresError(`${error}`);
|
|
63
|
+
}
|
|
64
|
+
const message = describe(driver) + (query == null ? '' : `\nSQL: ${query}`);
|
|
65
|
+
const produce = () => {
|
|
66
|
+
switch (driver.code) {
|
|
67
|
+
case PgErrorCode.UniqueViolation:
|
|
68
|
+
return new RecordExists(message);
|
|
69
|
+
case PgErrorCode.NotNullViolation:
|
|
70
|
+
return new MisshapedRecord(message);
|
|
71
|
+
case PgErrorCode.ForeignKeyViolation:
|
|
72
|
+
return new PostgresForeignKeyError(message);
|
|
73
|
+
case PgErrorCode.CheckViolation:
|
|
74
|
+
return new PostgresCheckError(message);
|
|
75
|
+
case PgErrorCode.DatatypeMismatch:
|
|
76
|
+
case PgErrorCode.CannotCoerce:
|
|
77
|
+
return new PostgresCastRequired(message);
|
|
78
|
+
case PgErrorCode.SerializationFailure:
|
|
79
|
+
case PgErrorCode.DeadlockDetected:
|
|
80
|
+
return new PostgresDeadlockError(message);
|
|
81
|
+
default:
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
if (driver.code != null && driver.code.startsWith('08')) {
|
|
85
|
+
return new PostgresConnectionError(message);
|
|
86
|
+
}
|
|
87
|
+
if (driver.code != null && driver.code.startsWith('23')) {
|
|
88
|
+
return new PostgresConstraintError(message);
|
|
89
|
+
}
|
|
90
|
+
return new PostgresError(message);
|
|
91
|
+
};
|
|
92
|
+
const produced = produce();
|
|
93
|
+
/** The *original* error, wrapper and all — unwrapping is for classification, not for loss. */
|
|
94
|
+
produced.cause = error;
|
|
95
|
+
return produced;
|
|
96
|
+
};
|
|
97
|
+
return { describePgError, pgErrorToResourceError };
|
|
98
|
+
};
|
|
99
|
+
export const pgErrorHelper = createPgErrorHelper();
|
|
100
|
+
//# sourceMappingURL=pg-error.js.map
|