@jskit-ai/database-runtime-postgres 0.1.249 → 0.1.250

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/database-runtime-postgres",
3
- "version": "0.1.249",
3
+ "version": "0.1.250",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test --test-concurrency=1"
@@ -12,11 +12,11 @@
12
12
  "./shared/dialect": "./src/shared/dialect.js"
13
13
  },
14
14
  "dependencies": {
15
- "@jskit-ai/database-runtime": "0.1.252",
15
+ "@jskit-ai/database-runtime": "0.1.253",
16
16
  "pg": "^8.13.1"
17
17
  },
18
18
  "peerDependencies": {
19
- "@jskit-ai/kernel": "0.2.3"
19
+ "@jskit-ai/kernel": "0.2.4"
20
20
  },
21
21
  "jskit": {
22
22
  "kind": "runtime",
@@ -38,7 +38,10 @@ decisions, not framework questions.
38
38
  ## Framework APIs
39
39
 
40
40
  Use `createKnexMigrationConfigFromApp()` from
41
- `@jskit-ai/database-runtime/server/knexMigrationConfig`. The running JSKIT
41
+ `@jskit-ai/database-runtime/server/knexMigrationConfig`, and
42
+ `prepareDatabaseFromApp()` from `@jskit-ai/database-runtime/server/databaseSetup`.
43
+ Both take the dialect and the application's environment
44
+ (`environment: process.env`), which they never read on their own. The running JSKIT
42
45
  application automatically selects the sole installed database driver, while
43
46
  Knex discovers package-owned migrations from the installed dependency graph.
44
47
 
@@ -50,6 +53,14 @@ dialect. `example/scripts/prepare-database.js` is the portable
50
53
  migrate-then-seed entrypoint for managed sessions and deployments.
51
54
  `example/.env.example` names the five connection values without a secret.
52
55
 
56
+ `example/.github/workflows/verify.yml` is a normal app-owned CI workflow with
57
+ exactly one database service: `postgres` (`postgres:17`, `POSTGRES_*`
58
+ variables, port `5432`, a `pg_isready` health check). Copy it whole from this
59
+ pattern and adapt it as source rather than generating it from package metadata.
60
+ Do not combine it with the MySQL pattern's workflow: a PostgreSQL application's
61
+ workflow has no `mariadb` service, `MARIADB_*` variables, port `3306`, or
62
+ `healthcheck.sh` option.
63
+
53
64
  ## Variation points
54
65
 
55
66
  Change scripts, migration location, connection values, and secret injection to
@@ -66,10 +77,9 @@ it as `seed` to `prepareDatabaseFromApp()`.
66
77
  - Run `npm run db:migrate:status` and the application verification command.
67
78
  - Exercise one transaction and one negative connection case.
68
79
  - When a seed exists, run `db:prepare` twice and require the second run to be safe.
69
-
70
- `example/.github/workflows/verify.yml` is a normal app-owned CI workflow with
71
- an explicit PostgreSQL service. Adapt it as source rather than generating it
72
- from package metadata.
80
+ - Confirm `.github/workflows/verify.yml` parses as YAML and declares only the
81
+ `postgres` service. GitHub reports an unparseable workflow only as a failed
82
+ run with "no jobs were run".
73
83
 
74
84
  ## Avoid
75
85
 
@@ -77,4 +87,5 @@ from package metadata.
77
87
  - generated `.env` secrets
78
88
  - depending on a live schema as the source contract
79
89
  - a second driver installed “just in case”
90
+ - any file, service, port, or variable copied from the MySQL pattern
80
91
  - migration receipts, provenance, replay logs, or generator ownership
@@ -1,11 +1,11 @@
1
1
  import { createKnexMigrationConfigFromApp } from "@jskit-ai/database-runtime/server/knexMigrationConfig";
2
2
 
3
3
  try {
4
- process.loadEnvFile?.(".env");
4
+ process.loadEnvFile(".env");
5
5
  } catch (error) {
6
6
  if (error?.code !== "ENOENT") {
7
7
  throw error;
8
8
  }
9
9
  }
10
10
 
11
- export default await createKnexMigrationConfigFromApp({ client: "pg" });
11
+ export default await createKnexMigrationConfigFromApp({ client: "pg", environment: process.env });
@@ -8,6 +8,6 @@
8
8
  "db:migrate:status": "knex --knexfile ./knexfile.js migrate:list"
9
9
  },
10
10
  "dependencies": {
11
- "@jskit-ai/database-runtime-postgres": "0.1.249"
11
+ "@jskit-ai/database-runtime-postgres": "0.1.250"
12
12
  }
13
13
  }
@@ -1,3 +1,3 @@
1
1
  import { prepareDatabaseFromApp } from "@jskit-ai/database-runtime/server/databaseSetup";
2
2
 
3
- await prepareDatabaseFromApp({ client: "pg" });
3
+ await prepareDatabaseFromApp({ client: "pg", environment: process.env });
@@ -1,5 +1,5 @@
1
1
  import { defineProvider } from "@jskit-ai/kernel/shared/capabilities";
2
- import * as postgresDriver from "../../shared/index.js";
2
+ import { DIALECT_ID } from "../../shared/index.js";
3
3
 
4
4
  const PostgresDatabaseDriverProvider = defineProvider({
5
5
  id: "runtime.database.driver.postgres",
@@ -8,7 +8,7 @@ const PostgresDatabaseDriverProvider = defineProvider({
8
8
  },
9
9
  setup() {
10
10
  return {
11
- driver: Object.freeze({ ...postgresDriver })
11
+ driver: Object.freeze({ DIALECT_ID })
12
12
  };
13
13
  }
14
14
  });
@@ -1,7 +1,3 @@
1
1
  const DIALECT_ID = "pg";
2
2
 
3
- function getDialectId() {
4
- return DIALECT_ID;
5
- }
6
-
7
- export { DIALECT_ID, getDialectId };
3
+ export { DIALECT_ID };
@@ -1 +1 @@
1
- export { DIALECT_ID, getDialectId } from "./dialect.js";
1
+ export { DIALECT_ID } from "./dialect.js";
@@ -28,6 +28,5 @@ test("server provider module exports the declarative postgres driver provider",
28
28
 
29
29
  test("shared entrypoint exports postgres dialect helpers", () => {
30
30
  assert.equal(sharedApi.DIALECT_ID, "pg");
31
- assert.equal(sharedApi.getDialectId(), "pg");
32
31
  assert.equal(typeof sharedApi.PostgresDatabaseDriverProvider, "undefined");
33
32
  });
@@ -18,6 +18,5 @@ test("PostgresDatabaseDriverProvider provides the exclusive database driver capa
18
18
 
19
19
  await runtime.start();
20
20
  assert.equal(driver.DIALECT_ID, "pg");
21
- assert.equal(driver.getDialectId(), "pg");
22
21
  await runtime.shutdown();
23
22
  });