@jskit-ai/database-runtime 0.1.144 → 0.1.146

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.144",
4
+ version: "0.1.146",
5
5
  kind: "runtime",
6
6
  dependsOn: [
7
7
  "@jskit-ai/kernel"
@@ -70,7 +70,7 @@ export default Object.freeze({
70
70
  mutations: {
71
71
  dependencies: {
72
72
  runtime: {
73
- "@jskit-ai/kernel": "0.1.145",
73
+ "@jskit-ai/kernel": "0.1.146",
74
74
  "dotenv": "^16.4.5",
75
75
  "knex": "^3.1.0"
76
76
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/database-runtime",
3
- "version": "0.1.144",
3
+ "version": "0.1.146",
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.145"
28
+ "@jskit-ai/kernel": "0.1.146"
29
29
  }
30
30
  }
@@ -131,7 +131,8 @@ function resolveKnexConnectionFromEnvironment(
131
131
  return {
132
132
  ...connection,
133
133
  supportBigNumbers: true,
134
- bigNumberStrings: true
134
+ bigNumberStrings: true,
135
+ dateStrings: ["DATE"]
135
136
  };
136
137
  }
137
138
 
@@ -3,7 +3,8 @@ import test from "node:test";
3
3
  import {
4
4
  parseDatabaseUrl,
5
5
  resolveDatabaseClientFromEnvironment,
6
- resolveDatabaseConnectionFromEnvironment
6
+ resolveDatabaseConnectionFromEnvironment,
7
+ resolveKnexConnectionFromEnvironment
7
8
  } from "../src/shared/databaseConnection.js";
8
9
 
9
10
  test("parseDatabaseUrl parses mysql url fields", () => {
@@ -71,3 +72,32 @@ test("resolveDatabaseConnectionFromEnvironment returns mutable connection fields
71
72
  assert.equal(descriptor?.configurable, true);
72
73
  assert.equal(descriptor?.writable, true);
73
74
  });
75
+
76
+ test("resolveKnexConnectionFromEnvironment keeps only MySQL DATE columns as strings", () => {
77
+ const mysqlConnection = resolveKnexConnectionFromEnvironment({
78
+ DB_CLIENT: "mysql2",
79
+ DB_HOST: "db.local",
80
+ DB_NAME: "appdb",
81
+ DB_USER: "appuser",
82
+ DB_PASSWORD: "apppass"
83
+ }, {
84
+ client: "mysql2"
85
+ });
86
+
87
+ assert.deepEqual(mysqlConnection.dateStrings, ["DATE"]);
88
+ assert.equal(mysqlConnection.supportBigNumbers, true);
89
+ assert.equal(mysqlConnection.bigNumberStrings, true);
90
+
91
+ const postgresConnection = resolveKnexConnectionFromEnvironment({
92
+ DB_CLIENT: "pg",
93
+ DB_HOST: "db.local",
94
+ DB_NAME: "appdb",
95
+ DB_USER: "appuser",
96
+ DB_PASSWORD: "apppass"
97
+ }, {
98
+ client: "pg",
99
+ defaultPort: 5432
100
+ });
101
+
102
+ assert.equal(postgresConnection.dateStrings, undefined);
103
+ });
@@ -178,6 +178,7 @@ test("DatabaseRuntimeServiceProvider resolves knex from app root package context
178
178
  assert.equal(knex.__config.connection.database, "appdb");
179
179
  assert.equal(knex.__config.connection.user, "appuser");
180
180
  assert.equal(knex.__config.connection.password, "apppass");
181
+ assert.deepEqual(knex.__config.connection.dateStrings, ["DATE"]);
181
182
  });
182
183
  });
183
184