@owlmeans/postgres 0.1.18-rc.42 → 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 CHANGED
@@ -14,7 +14,7 @@ provisioning, and an opt-in least-privilege bootstrap path.
14
14
  ## Installation
15
15
 
16
16
  ```bash
17
- bun add @owlmeans/postgres@^0.1.18-rc.42 @owlmeans/postgres-resource@^0.1.18-rc.40
17
+ bun add @owlmeans/postgres@^0.1.18-rc.43 @owlmeans/postgres-resource@^0.1.18-rc.41
18
18
  ```
19
19
 
20
20
  ## Usage
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/postgres",
4
- "version": "0.1.18-rc.42",
5
- "generatedAt": "2026-10-03T11:19:50.804Z",
4
+ "version": "0.1.18-rc.43",
5
+ "generatedAt": "2026-10-03T15:33:53.026Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/postgres
9
9
 
10
10
  **Layer:** Infra
11
- **Install:** `"@owlmeans/postgres": "^0.1.18-rc.42"` in `dependencies`
11
+ **Install:** `"@owlmeans/postgres": "^0.1.18-rc.43"` 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.18-rc.42",
3
+ "version": "0.1.18-rc.43",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@owlmeans/basic-keys": "^0.1.18-rc.45",
26
26
  "@owlmeans/context": "^0.1.18-rc.32",
27
- "@owlmeans/postgres-resource": "^0.1.18-rc.40",
27
+ "@owlmeans/postgres-resource": "^0.1.18-rc.41",
28
28
  "@owlmeans/resource": "^0.1.18-rc.37",
29
29
  "@owlmeans/server-context": "^0.1.18-rc.40",
30
30
  "drizzle-orm": "~0.45.2",
@@ -61,6 +61,13 @@ const failingBody = async (): Promise<void> => {
61
61
  throw new Error('deliberate')
62
62
  }
63
63
 
64
+ const failingSql = 'SELECT o."enquiryId" FROM {{}} o WHERE o."title" = $1'
65
+ const sqlFailures: Record<string, (tx: PostgresTx) => Promise<unknown>> = {
66
+ query: async tx => await tx.query(failingSql, ['private-bound-value']),
67
+ queryOne: async tx => await tx.queryOne(failingSql, ['private-bound-value']),
68
+ execute: async tx => await tx.execute(failingSql, ['private-bound-value']),
69
+ }
70
+
64
71
  const driftBody = async (tx: PostgresTx): Promise<void> => { await tx.execute('SELECT 1') }
65
72
  const driftEdited = async (tx: PostgresTx): Promise<void> => { await tx.execute('SELECT 2') }
66
73
 
@@ -214,6 +221,30 @@ describe('@owlmeans/postgres — code registered migrations', () => {
214
221
  expect(rows).toHaveLength(0)
215
222
  })
216
223
 
224
+ it('failed migration SQL survives all transaction methods, with placeholders resolved and values kept separate', async () => {
225
+ for (const [method, apply] of Object.entries(sqlFailures)) {
226
+ const alias = `mig-sql-${method.toLowerCase()}`
227
+ await boot({ alias })
228
+ let failure: unknown
229
+ try {
230
+ await boot({ alias, declare: resource => {
231
+ resource.migration('0001-bad-sql', async tx => { await apply(tx) }, MigrationStage.Post)
232
+ } })
233
+ } catch (error) {
234
+ failure = error
235
+ }
236
+ expect(failure).toBeInstanceOf(MigrationError)
237
+ const cause = (failure as Error).cause as Error
238
+ expect(cause.message).toContain('42703')
239
+ expect(cause.message).toContain('SQL: SELECT o."enquiryId" FROM')
240
+ expect(cause.message).toContain(suite.schema)
241
+ expect(cause.message).toContain('$1')
242
+ expect(cause.message).not.toContain('{{}}')
243
+ expect(cause.message).not.toContain('private-bound-value')
244
+ expect(cause.cause).toBeInstanceOf(Error)
245
+ }
246
+ })
247
+
217
248
  it('refuses to start when an applied migration body has been edited', async () => {
218
249
  await boot({ alias: 'mig-e' })
219
250
  await boot({