@jskit-ai/database-runtime 0.1.14 → 0.1.16
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.descriptor.mjs
CHANGED
|
@@ -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.
|
|
4
|
+
version: "0.1.16",
|
|
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.
|
|
58
|
+
"@jskit-ai/kernel": "0.1.15",
|
|
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.
|
|
3
|
+
"version": "0.1.16",
|
|
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.
|
|
28
|
+
"@jskit-ai/kernel": "0.1.15"
|
|
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
|
-
|
|
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
|
+
});
|