@eliware/elera-lib 0.1.1 → 0.1.2
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/README.md +1 -1
- package/RELEASE_NOTES.md +20 -1
- package/package.json +1 -1
- package/src/client/environment.mjs +1 -1
- package/src/pools/node-pool.mjs +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The alternative SQL client for Eliware applications. It provides generic
|
|
4
4
|
primary/balanced MySQL or MariaDB routing without embedding Elera, HAProxy,
|
|
5
|
-
backup, or GitOps policy. It is a v0.1.
|
|
5
|
+
backup, or GitOps policy. It is a v0.1.2 alternative to `@eliware/mysql`; the
|
|
6
6
|
existing package is intentionally unchanged.
|
|
7
7
|
|
|
8
8
|
`primary` is the preferred connection path. `balanced` is an optional alternate
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
# Release notes
|
|
2
2
|
|
|
3
|
+
## 0.1.2 — Unix-socket connection correction
|
|
4
|
+
|
|
5
|
+
This patch corrects the mysql2 option used for local MariaDB Unix-domain
|
|
6
|
+
socket connections.
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- Maps `MYSQL_SOCKET` to mysql2's `socketPath` option so local socket
|
|
11
|
+
connections reach the configured MariaDB socket instead of falling back to
|
|
12
|
+
TCP.
|
|
13
|
+
- Removes the obsolete `socket` option from node-pool driver options.
|
|
14
|
+
|
|
15
|
+
### Validation
|
|
16
|
+
|
|
17
|
+
- Adds regression coverage for socket-path mapping and option cleanup.
|
|
18
|
+
- Maintains 100% statements, branches, functions, and lines coverage with
|
|
19
|
+
zero lint warnings.
|
|
20
|
+
- Contract and syntax checks pass.
|
|
21
|
+
|
|
3
22
|
## 0.1.1 — Runtime integration readiness
|
|
4
23
|
|
|
5
|
-
This
|
|
24
|
+
This patch prepares the generic client for supervisor control-plane
|
|
6
25
|
connections and application-side routing changes. It does not add supervisor,
|
|
7
26
|
CLI, Galera, backup, or GitOps policy to the library.
|
|
8
27
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createDb } from './create-db.mjs';
|
|
2
2
|
|
|
3
3
|
export async function createDbFromEnvironment({ env = process.env, ...options } = {}) {
|
|
4
|
-
const primary = { host: env.MYSQL_PRIMARY_HOST ?? env.MYSQL_HOST ?? 'localhost', port: env.MYSQL_PRIMARY_PORT ?? env.MYSQL_PORT, user: env.MYSQL_USER, password: env.MYSQL_PASSWORD, database: env.MYSQL_DATABASE, options: {
|
|
4
|
+
const primary = { host: env.MYSQL_PRIMARY_HOST ?? env.MYSQL_HOST ?? 'localhost', port: env.MYSQL_PRIMARY_PORT ?? env.MYSQL_PORT, user: env.MYSQL_USER, password: env.MYSQL_PASSWORD, database: env.MYSQL_DATABASE, options: { socketPath: env.MYSQL_SOCKET, connectTimeout: env.MYSQL_CONNECT_TIMEOUT, acquireTimeout: env.MYSQL_ACQUIRE_TIMEOUT, connectionLimit: env.MYSQL_CONNECTION_LIMIT, queueLimit: env.MYSQL_QUEUE_LIMIT, ssl: env.MYSQL_SSL } };
|
|
5
5
|
const balanced = env.MYSQL_BALANCED_PORT ? { host: env.MYSQL_BALANCED_HOST ?? primary.host, port: env.MYSQL_BALANCED_PORT } : undefined;
|
|
6
6
|
return createDb({ ...options, primary, balanced });
|
|
7
7
|
}
|
package/src/pools/node-pool.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { asSqlError } from '../errors.mjs';
|
|
|
2
2
|
const connectionFailure = (error) => asSqlError(error).retryable;
|
|
3
3
|
export function createNodePool({ profile, mysqlLib, log, now = () => Date.now(), quarantineMs = 5000 }) {
|
|
4
4
|
const { acquireTimeout: _acquireTimeout, ...driverOptions } = profile.options ?? {};
|
|
5
|
-
if (driverOptions.
|
|
5
|
+
if (driverOptions.socketPath === undefined) delete driverOptions.socketPath;
|
|
6
6
|
const pool = mysqlLib.createPool({ host: profile.host, port: profile.port, user: profile.user, password: profile.password, database: profile.database, waitForConnections: true, ...driverOptions });
|
|
7
7
|
const sessionStatements = profile.options?.sessionStatements ?? [];
|
|
8
8
|
const withConnection = async (operation, sql, values) => { const connection = await pool.getConnection(); try { for (const statement of sessionStatements) await connection.query(statement); return operation(connection, sql, values); } finally { connection.release(); } };
|