@jskit-ai/database-runtime-postgres 0.1.114 → 0.1.116

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.
@@ -1,7 +1,18 @@
1
+ import { DIALECT_ID } from "./src/shared/dialect.js";
2
+
3
+ const CI_DATABASE = Object.freeze({
4
+ host: "127.0.0.1",
5
+ hostPort: "54320",
6
+ containerPort: "5432",
7
+ name: "jskit_ci",
8
+ user: "jskit_ci",
9
+ password: "jskit_ci_only_password"
10
+ });
11
+
1
12
  export default Object.freeze({
2
13
  packageVersion: 1,
3
14
  packageId: "@jskit-ai/database-runtime-postgres",
4
- version: "0.1.114",
15
+ version: "0.1.116",
5
16
  kind: "runtime",
6
17
  options: {
7
18
  "db-host": {
@@ -88,10 +99,39 @@ export default Object.freeze({
88
99
  }
89
100
  }
90
101
  },
102
+ ci: {
103
+ environment: {
104
+ DB_CLIENT: DIALECT_ID,
105
+ DB_HOST: CI_DATABASE.host,
106
+ DB_PORT: CI_DATABASE.hostPort,
107
+ DB_NAME: CI_DATABASE.name,
108
+ DB_USER: CI_DATABASE.user,
109
+ DB_PASSWORD: CI_DATABASE.password
110
+ },
111
+ services: [
112
+ {
113
+ id: "postgres",
114
+ image: "postgres:16",
115
+ environment: {
116
+ POSTGRES_DB: CI_DATABASE.name,
117
+ POSTGRES_USER: CI_DATABASE.user,
118
+ POSTGRES_PASSWORD: CI_DATABASE.password
119
+ },
120
+ ports: [`${CI_DATABASE.hostPort}:${CI_DATABASE.containerPort}`],
121
+ healthCheck: {
122
+ command: `pg_isready --username=${CI_DATABASE.user} --dbname=${CI_DATABASE.name}`,
123
+ interval: "10s",
124
+ timeout: "5s",
125
+ retries: 10
126
+ }
127
+ }
128
+ ],
129
+ steps: []
130
+ },
91
131
  mutations: {
92
132
  dependencies: {
93
133
  runtime: {
94
- "@jskit-ai/database-runtime": "0.1.115",
134
+ "@jskit-ai/database-runtime": "0.1.118",
95
135
  "pg": "^8.13.1"
96
136
  },
97
137
  dev: {}
@@ -106,7 +146,7 @@ export default Object.freeze({
106
146
  file: ".env",
107
147
  op: "upsert-env",
108
148
  key: "DB_CLIENT",
109
- value: "pg",
149
+ value: DIALECT_ID,
110
150
  reason: "Configure database client driver for runtime wiring.",
111
151
  category: "runtime-config",
112
152
  id: "database-client-postgres"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/database-runtime-postgres",
3
- "version": "0.1.114",
3
+ "version": "0.1.116",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
@@ -12,6 +12,6 @@
12
12
  "./shared/dialect": "./src/shared/dialect.js"
13
13
  },
14
14
  "dependencies": {
15
- "@jskit-ai/database-runtime": "0.1.115"
15
+ "@jskit-ai/database-runtime": "0.1.118"
16
16
  }
17
17
  }
@@ -0,0 +1,22 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import descriptor from "../package.descriptor.mjs";
4
+ import { DIALECT_ID } from "../src/shared/dialect.js";
5
+
6
+ test("database-runtime-postgres contributes canonical synthetic Postgres CI requirements", () => {
7
+ assert.equal(descriptor.ci.environment.DB_CLIENT, DIALECT_ID);
8
+ assert.equal(descriptor.ci.environment.DB_HOST, "127.0.0.1");
9
+ assert.equal(descriptor.ci.environment.DB_PORT, "54320");
10
+ assert.match(descriptor.ci.environment.DB_PASSWORD, /ci_only/u);
11
+
12
+ const service = descriptor.ci.services.find((entry) => entry.id === "postgres");
13
+ assert.equal(service.image, "postgres:16");
14
+ assert.equal(service.environment.POSTGRES_DB, descriptor.ci.environment.DB_NAME);
15
+ assert.equal(service.environment.POSTGRES_USER, descriptor.ci.environment.DB_USER);
16
+ assert.equal(service.environment.POSTGRES_PASSWORD, descriptor.ci.environment.DB_PASSWORD);
17
+ assert.deepEqual(service.ports, ["54320:5432"]);
18
+ assert.match(service.healthCheck.command, /pg_isready/u);
19
+
20
+ const clientMutation = descriptor.mutations.text.find((entry) => entry.key === "DB_CLIENT");
21
+ assert.equal(clientMutation.value, DIALECT_ID);
22
+ });