@jskit-ai/database-runtime 0.1.13 → 0.1.15

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,7 @@
1
1
  export default Object.freeze({
2
2
  packageVersion: 1,
3
3
  packageId: "@jskit-ai/database-runtime",
4
- version: "0.1.13",
4
+ version: "0.1.15",
5
5
  dependsOn: [
6
6
  "@jskit-ai/kernel"
7
7
  ],
@@ -55,7 +55,7 @@ export default Object.freeze({
55
55
  mutations: {
56
56
  dependencies: {
57
57
  runtime: {
58
- "@jskit-ai/kernel": "0.1.12",
58
+ "@jskit-ai/kernel": "0.1.14",
59
59
  "dotenv": "^16.4.5",
60
60
  "knex": "^3.1.0"
61
61
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/database-runtime",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
@@ -25,6 +25,6 @@
25
25
  "./shared/transactions": "./src/shared/transactions.js"
26
26
  },
27
27
  "dependencies": {
28
- "@jskit-ai/kernel": "0.1.12"
28
+ "@jskit-ai/kernel": "0.1.14"
29
29
  }
30
30
  }
@@ -100,13 +100,14 @@ function resolveDatabaseConnectionFromEnvironment(
100
100
  const hasDbPassword = Object.prototype.hasOwnProperty.call(source, "DB_PASSWORD");
101
101
  const password = hasDbPassword ? String(source.DB_PASSWORD ?? "") : String(parsedUrl?.password || "");
102
102
 
103
- return Object.freeze({
103
+ // Knex may redefine connection.password as a hidden property; keep this mutable.
104
+ return {
104
105
  host,
105
106
  port,
106
107
  database,
107
108
  user,
108
109
  password
109
- });
110
+ };
110
111
  }
111
112
 
112
113
  export {
@@ -58,3 +58,16 @@ test("resolveDatabaseConnectionFromEnvironment keeps explicit DB_* values over D
58
58
  assert.equal(connection.password, "explicit_pass");
59
59
  });
60
60
 
61
+ test("resolveDatabaseConnectionFromEnvironment returns mutable connection fields for knex", () => {
62
+ const connection = resolveDatabaseConnectionFromEnvironment({
63
+ DATABASE_URL: "mysql://urluser:urlpass@db.url.local:3308/url_db_name"
64
+ }, {
65
+ defaultPort: 3306,
66
+ context: "database runtime"
67
+ });
68
+
69
+ assert.equal(Object.isFrozen(connection), false);
70
+ const descriptor = Object.getOwnPropertyDescriptor(connection, "password");
71
+ assert.equal(descriptor?.configurable, true);
72
+ assert.equal(descriptor?.writable, true);
73
+ });