@shivaedev/local-postgres 0.5.0 → 0.7.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/CHANGELOG.md +18 -0
- package/README.md +17 -17
- package/dist/server/localPostgres.d.ts +1 -1
- package/dist/server/localPostgres.d.ts.map +1 -1
- package/dist/server/localPostgres.js +2 -2
- package/dist/server/localPostgres.js.map +1 -1
- package/package.json +8 -8
- package/src/server/localPostgres.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0 - 2026-10-25
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- Rename `localServer` to `LOCAL_SERVER`. Change the imported name to `LOCAL_SERVER` in imports from `@shivaedev/local-postgres/server/localPostgres.ts`.
|
|
8
|
+
|
|
9
|
+
## 0.6.0 - 2026-10-19
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Quality's `manifests/exports-shape` rule checks exports at the package root and in workspace members by default. Modules use one file-preserving TypeScript wildcard with matching source, types and runtime targets; root entries, exact non-code assets, package metadata and null blocks are allowed.
|
|
14
|
+
|
|
15
|
+
### Breaking
|
|
16
|
+
|
|
17
|
+
- Quality's Biome preset moves from `@shivaedev/quality/biome` to `@shivaedev/quality/biome/preset.json`. Change the `extends` entry in your Biome config to the new path; the old alias is removed. TypeScript preset paths are unchanged.
|
|
18
|
+
- `@shivaedev/effect-pg-boss`, `@shivaedev/effect-test-sql`, `@shivaedev/local-postgres` and `@shivaedev/test-story` expose server modules at their file paths. Add `/server/` after the package name in imports, for example `@shivaedev/test-story/server/storyKit.ts`. The shortened paths are removed; internal server modules remain blocked.
|
|
19
|
+
- Work Board moves `@shivaedev/work-board/client/client.ts` to `@shivaedev/work-board/browserClient.ts`; change browser-client imports to that file path. `@shivaedev/work-board/client/document/View.ts` is removed: consume document queries with your own renderer, or use the bundled Board browser UI. The client bundle stays private and the old export overrides are removed.
|
|
20
|
+
|
|
3
21
|
## 0.5.0 - 2026-10-19
|
|
4
22
|
|
|
5
23
|
### Added
|
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ Make development and integration tests share one persistent local PostgreSQL ser
|
|
|
7
7
|
A setup command should make a machine ready to work without erasing the work already on it. Reimplementing PostgreSQL startup in every repository makes that promise harder to keep. This package gives a setup script one place to prepare the service and its databases:
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import {
|
|
10
|
+
import { LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
|
|
11
11
|
|
|
12
|
-
const development = process.env.DATABASE_URL ?? `${
|
|
12
|
+
const development = process.env.DATABASE_URL ?? `${LOCAL_SERVER}/example_dev`;
|
|
13
13
|
localPostgres(process.env).prepareDatabases([development]);
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -34,10 +34,10 @@ There are three separate responsibilities:
|
|
|
34
34
|
When database names come from the application's configured URLs, pass those URLs directly to preparation:
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
import {
|
|
37
|
+
import { LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
|
|
38
38
|
|
|
39
|
-
const development = process.env.DATABASE_URL ?? `${
|
|
40
|
-
const tests = process.env.TEST_DATABASE_URL ?? `${
|
|
39
|
+
const development = process.env.DATABASE_URL ?? `${LOCAL_SERVER}/example_dev`;
|
|
40
|
+
const tests = process.env.TEST_DATABASE_URL ?? `${LOCAL_SERVER}/example_test`;
|
|
41
41
|
|
|
42
42
|
localPostgres(process.env).prepareDatabases([development, tests]);
|
|
43
43
|
```
|
|
@@ -47,10 +47,10 @@ Generated applications use this configuration-driven approach. An allowlist buil
|
|
|
47
47
|
Use `assertLocalDatabase` when the setup script owns a fixed set of database names, as this repository's `script/setup-database.ts` does. Its allowlist restricts configuration to the names the script intends to touch:
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
|
-
import { assertLocalDatabase,
|
|
50
|
+
import { assertLocalDatabase, LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
|
|
51
51
|
|
|
52
|
-
const development = process.env.DATABASE_URL ?? `${
|
|
53
|
-
const tests = process.env.TEST_DATABASE_URL ?? `${
|
|
52
|
+
const development = process.env.DATABASE_URL ?? `${LOCAL_SERVER}/example_dev`;
|
|
53
|
+
const tests = process.env.TEST_DATABASE_URL ?? `${LOCAL_SERVER}/example_test`;
|
|
54
54
|
|
|
55
55
|
assertLocalDatabase(development, ["example_dev"]);
|
|
56
56
|
assertLocalDatabase(tests, ["example_test"]);
|
|
@@ -68,9 +68,9 @@ After `prepareDatabases`, run the application's own schema or migration entry po
|
|
|
68
68
|
### 3. In daily setup: prepare again and inspect with SQL
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import {
|
|
71
|
+
import { LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
|
|
72
72
|
|
|
73
|
-
const database = process.env.DATABASE_URL ?? `${
|
|
73
|
+
const database = process.env.DATABASE_URL ?? `${LOCAL_SERVER}/example_dev`;
|
|
74
74
|
|
|
75
75
|
const postgres = localPostgres(process.env);
|
|
76
76
|
postgres.prepareDatabases([database]);
|
|
@@ -79,26 +79,26 @@ console.log(postgres.sql(database, "SHOW server_version"));
|
|
|
79
79
|
|
|
80
80
|
The version query returns the string `18.6`. `sql` also accepts a `URL` and returns the command's trimmed text. URLs carrying the application's `schema` and `connection_limit` settings work for this query; those settings are removed before calling PostgreSQL's client.
|
|
81
81
|
|
|
82
|
-
`startPostgres(connection)` prepares the service without choosing an application database to create. Its connection defaults to `
|
|
82
|
+
`startPostgres(connection)` prepares the service without choosing an application database to create. Its connection defaults to `LOCAL_SERVER`. Prefer `prepareDatabases` when the setup script needs named databases as well.
|
|
83
83
|
|
|
84
|
-
On each start, setup reads `SHOW max_connections`. When the shared container allows fewer than 500 connections, setup applies `ALTER SYSTEM SET max_connections = 500`, restarts that same container, waits for readiness and confirms the setting. Existing data stays in place. A limit of 500 or higher causes no setting change or restart. If the setting cannot be applied, setup throws `PostgresSettingError` from
|
|
84
|
+
On each start, setup reads `SHOW max_connections`. When the shared container allows fewer than 500 connections, setup applies `ALTER SYSTEM SET max_connections = 500`, restarts that same container, waits for readiness and confirms the setting. Existing data stays in place. A limit of 500 or higher causes no setting change or restart. If the setting cannot be applied, setup throws `PostgresSettingError` from `@shivaedev/local-postgres/server/localConnections.ts`, with `_tag`, `container`, `setting` and the original `cause`.
|
|
85
85
|
|
|
86
86
|
### API
|
|
87
87
|
|
|
88
|
-
Import the setup API from `@shivaedev/local-postgres/localPostgres.ts`:
|
|
88
|
+
Import the setup API from `@shivaedev/local-postgres/server/localPostgres.ts`:
|
|
89
89
|
|
|
90
90
|
| Export | Purpose |
|
|
91
91
|
| --- | --- |
|
|
92
|
-
| `
|
|
92
|
+
| `LOCAL_SERVER` | The base URL `postgresql://postgres:postgres@127.0.0.1:55432`. Append the application database name. |
|
|
93
93
|
| `assertLocalDatabase(value: string, names: readonly string[]): URL` | Validate a local database URL against application-owned allowed names. |
|
|
94
94
|
| `localPostgres(environment: DockerEnvironment, readiness?: ReadinessOptions)` | Create the setup functions using the Docker settings to validate. After starting the container, `startPostgres` checks readiness `attempts` times (default 30), waiting `delayMillis` between checks (default 1000). |
|
|
95
95
|
| `prepareDatabases(values: readonly string[]): void` | Prepare the service and create absent databases. |
|
|
96
|
-
| `startPostgres(connection?: string): void` | Prepare the service; the default connection is `
|
|
96
|
+
| `startPostgres(connection?: string): void` | Prepare the service; the default connection is `LOCAL_SERVER`. |
|
|
97
97
|
| `sql(value: string \| URL, query: string): string` | Execute SQL through PostgreSQL's command-line client. |
|
|
98
98
|
|
|
99
99
|
The last three functions are members of the object returned by `localPostgres`, not module-level exports. They throw on failure; they are synchronous Node functions rather than Effects.
|
|
100
100
|
|
|
101
|
-
The module export pattern also exposes the lower-level Docker and container command functions in
|
|
101
|
+
The module export pattern also exposes the lower-level Docker and container command functions in `@shivaedev/local-postgres/server/localDocker.ts` and `@shivaedev/local-postgres/server/localContainer.ts`. Use `@shivaedev/local-postgres/server/localPostgres.ts` for application preparation.
|
|
102
102
|
|
|
103
103
|
### Install and machine setup
|
|
104
104
|
|
|
@@ -114,7 +114,7 @@ The shared baseline is PostgreSQL 18.6 on loopback port 55432. Docker preparatio
|
|
|
114
114
|
postgres:18.6-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
A newly created container uses username and password `postgres`; connection URLs supply credentials for client commands. Setup refuses a running version other than 18.6 with `PostgresVersionMismatch` from `@shivaedev/local-postgres/PostgresVersionMismatch.ts`. The error carries `_tag: "PostgresVersionMismatch"`, `expectedVersion` and `observedVersion`. A running PostgreSQL 17 service is refused without losing its existing rows; upgrading it while preserving its data is your job. Container preparation and container-client fallback also check the managed image; a successful host-`psql` version probe does not inspect that image.
|
|
117
|
+
A newly created container uses username and password `postgres`; connection URLs supply credentials for client commands. Setup refuses a running version other than 18.6 with `PostgresVersionMismatch` from `@shivaedev/local-postgres/server/PostgresVersionMismatch.ts`. The error carries `_tag: "PostgresVersionMismatch"`, `expectedVersion` and `observedVersion`. A running PostgreSQL 17 service is refused without losing its existing rows; upgrading it while preserving its data is your job. Container preparation and container-client fallback also check the managed image; a successful host-`psql` version probe does not inspect that image.
|
|
118
118
|
|
|
119
119
|
Pass the process's actual Docker settings to `localPostgres`, as `process.env` in the examples does. With `DOCKER_CONTEXT`, endpoint validation uses that context and ignores `DOCKER_HOST`; otherwise it validates `DOCKER_HOST` or the active context. Remote endpoints are rejected before a Docker operation. Docker subprocesses inherit the process environment. Supplying a different object does not configure those subprocesses.
|
|
120
120
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DockerEnvironment } from "./localDocker.ts";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LOCAL_SERVER = "postgresql://postgres:postgres@127.0.0.1:55432";
|
|
3
3
|
export declare function assertLocalDatabase(value: string, names: readonly string[]): import("url").URL;
|
|
4
4
|
export interface ReadinessOptions {
|
|
5
5
|
readonly attempts?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localPostgres.d.ts","sourceRoot":"","sources":["../../src/server/localPostgres.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAU,MAAM,kBAAkB,CAAC;AAGlE,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"localPostgres.d.ts","sourceRoot":"","sources":["../../src/server/localPostgres.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAU,MAAM,kBAAkB,CAAC;AAGlE,eAAO,MAAM,YAAY,mDAAmD,CAAC;AAE7E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,qBAY1E;AAQD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,iBAAiB,EAAE,EAAE,QAAa,EAAE,WAAkB,EAAE,GAAE,gBAAqB;+BAmEvF,SAAS,MAAM,EAAE;iBA/D/B,MAAM,GAAG,GAAG,SAAS,MAAM;;EAmF/C"}
|
|
@@ -4,7 +4,7 @@ import { ensureConnections } from "./localConnections.js";
|
|
|
4
4
|
import { sqlInContainer, startContainer } from "./localContainer.js";
|
|
5
5
|
import { docker } from "./localDocker.js";
|
|
6
6
|
import { PostgresVersionMismatch } from "./PostgresVersionMismatch.js";
|
|
7
|
-
export const
|
|
7
|
+
export const LOCAL_SERVER = "postgresql://postgres:postgres@127.0.0.1:55432";
|
|
8
8
|
export function assertLocalDatabase(value, names) {
|
|
9
9
|
const url = new URL(value);
|
|
10
10
|
const name = url.pathname.slice(1);
|
|
@@ -53,7 +53,7 @@ export function localPostgres(environment, { attempts = 30, delayMillis = 1000 }
|
|
|
53
53
|
throw new Error(error instanceof Error && "stderr" in error ? String(error.stderr) : "PostgreSQL query failed.", { cause: error });
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function startPostgres(connection =
|
|
56
|
+
function startPostgres(connection = LOCAL_SERVER) {
|
|
57
57
|
const server = new URL(connection);
|
|
58
58
|
server.pathname = "/postgres";
|
|
59
59
|
assertLocalDatabase(server.toString(), ["postgres"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localPostgres.js","sourceRoot":"","sources":["../../src/server/localPostgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAA0B,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"localPostgres.js","sourceRoot":"","sources":["../../src/server/localPostgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAA0B,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC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GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,8CAA8C,IAAI,GAAG,CAAC,EAAE,CAAC;gBACzE,GAAG,CAAC,MAAM,EAAE,oBAAoB,IAAI,GAAG,CAAC,CAAC;YAC1C,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/local-postgres",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Repeatable local PostgreSQL preparation with one shared persistent service",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/local-postgres#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
"./*.ts": {
|
|
27
|
-
"source": "./src
|
|
28
|
-
"types": "./dist
|
|
29
|
-
"default": "./dist
|
|
27
|
+
"source": "./src/*.ts",
|
|
28
|
+
"types": "./dist/*.d.ts",
|
|
29
|
+
"default": "./dist/*.js"
|
|
30
30
|
},
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"README.md"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@shivaedev/quality": "0.
|
|
44
|
-
"@shivaedev/test-story": "0.
|
|
43
|
+
"@shivaedev/quality": "0.35.0",
|
|
44
|
+
"@shivaedev/test-story": "0.18.2",
|
|
45
45
|
"@types/node": "24.19.2",
|
|
46
|
-
"effect": "4.0.
|
|
46
|
+
"effect": "4.0.5",
|
|
47
47
|
"typescript": "7.0.2",
|
|
48
|
-
"vitest": "5.0.
|
|
48
|
+
"vitest": "5.0.5"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=24"
|
|
@@ -5,7 +5,7 @@ import { sqlInContainer, startContainer } from "./localContainer.ts";
|
|
|
5
5
|
import { type DockerEnvironment, docker } from "./localDocker.ts";
|
|
6
6
|
import { PostgresVersionMismatch } from "./PostgresVersionMismatch.ts";
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const LOCAL_SERVER = "postgresql://postgres:postgres@127.0.0.1:55432";
|
|
9
9
|
|
|
10
10
|
export function assertLocalDatabase(value: string, names: readonly string[]) {
|
|
11
11
|
const url = new URL(value);
|
|
@@ -65,7 +65,7 @@ export function localPostgres(environment: DockerEnvironment, { attempts = 30, d
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
function startPostgres(connection =
|
|
68
|
+
function startPostgres(connection = LOCAL_SERVER) {
|
|
69
69
|
const server = new URL(connection);
|
|
70
70
|
server.pathname = "/postgres";
|
|
71
71
|
assertLocalDatabase(server.toString(), ["postgres"]);
|