@shivaedev/local-postgres 0.6.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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.6.0 - 2026-10-19
4
10
 
5
11
  ### 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 { localPostgres, localServer } from "@shivaedev/local-postgres/server/localPostgres.ts";
10
+ import { LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
11
11
 
12
- const development = process.env.DATABASE_URL ?? `${localServer}/example_dev`;
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 { localPostgres, localServer } from "@shivaedev/local-postgres/server/localPostgres.ts";
37
+ import { LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
38
38
 
39
- const development = process.env.DATABASE_URL ?? `${localServer}/example_dev`;
40
- const tests = process.env.TEST_DATABASE_URL ?? `${localServer}/example_test`;
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, localPostgres, localServer } from "@shivaedev/local-postgres/server/localPostgres.ts";
50
+ import { assertLocalDatabase, LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
51
51
 
52
- const development = process.env.DATABASE_URL ?? `${localServer}/example_dev`;
53
- const tests = process.env.TEST_DATABASE_URL ?? `${localServer}/example_test`;
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 { localPostgres, localServer } from "@shivaedev/local-postgres/server/localPostgres.ts";
71
+ import { LOCAL_SERVER, localPostgres } from "@shivaedev/local-postgres/server/localPostgres.ts";
72
72
 
73
- const database = process.env.DATABASE_URL ?? `${localServer}/example_dev`;
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,7 +79,7 @@ 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 `localServer`. Prefer `prepareDatabases` when the setup script needs named databases as well.
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
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
 
@@ -89,11 +89,11 @@ Import the setup API from `@shivaedev/local-postgres/server/localPostgres.ts`:
89
89
 
90
90
  | Export | Purpose |
91
91
  | --- | --- |
92
- | `localServer` | The base URL `postgresql://postgres:postgres@127.0.0.1:55432`. Append the application database name. |
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 `localServer`. |
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.
@@ -1,5 +1,5 @@
1
1
  import { type DockerEnvironment } from "./localDocker.ts";
2
- export declare const localServer = "postgresql://postgres:postgres@127.0.0.1:55432";
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,WAAW,mDAAmD,CAAC;AAE5E,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"}
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 localServer = "postgresql://postgres:postgres@127.0.0.1:55432";
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 = localServer) {
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,WAAW,GAAG,gDAAgD,CAAC;AAE5E,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,KAAwB;IAC1E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,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AAC,cAAc,EAAE,CAAC,CACtC,CAAC;IACH,CAAC;IAED,SAAS,gBAAgB,CAAC,MAAyB;QAClD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,mBAAmB,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3C,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YACjD,CAAC;QACF,CAAC;QACD,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;YAC3B,MAAM,IAAI,GAAG,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.6.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": {
@@ -40,12 +40,12 @@
40
40
  "README.md"
41
41
  ],
42
42
  "devDependencies": {
43
- "@shivaedev/quality": "0.30.0",
44
- "@shivaedev/test-story": "0.17.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.4",
46
+ "effect": "4.0.5",
47
47
  "typescript": "7.0.2",
48
- "vitest": "5.0.3"
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 localServer = "postgresql://postgres:postgres@127.0.0.1:55432";
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 = localServer) {
68
+ function startPostgres(connection = LOCAL_SERVER) {
69
69
  const server = new URL(connection);
70
70
  server.pathname = "/postgres";
71
71
  assertLocalDatabase(server.toString(), ["postgres"]);