@pi-r/mariadb 0.2.8 → 0.3.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/LICENSE +1 -1
- package/README.md +1 -1
- package/client/index.d.ts +11 -0
- package/client/index.js +3 -4
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2023
|
|
1
|
+
Copyright 2023 Studio Trigger
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IDb } from '@e-mc/types/lib';
|
|
2
|
+
|
|
3
|
+
import type { IDbSourceClient } from '@e-mc/db/types';
|
|
4
|
+
|
|
5
|
+
import type { MariaDBCredential, MariaDBDataSource } from '../types';
|
|
6
|
+
|
|
7
|
+
declare const MariaDB: IDbSourceClient<MariaDBDataSource> & {
|
|
8
|
+
setAuthentication(this: IDb, credential: MariaDBCredential): void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export = MariaDB;
|
package/client/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DB_SOURCE_TYPE = exports.DB_SOURCE_CLIENT = exports.checkTimeout = exports.executeBatchQuery = exports.executeQuery = exports.setCredential = exports.setAuthentication = void 0;
|
|
4
|
+
const mariadb = require("mariadb");
|
|
4
5
|
const util_1 = require("@e-mc/db/util");
|
|
5
6
|
const types_1 = require("@e-mc/types");
|
|
6
7
|
const Db = require("@e-mc/db");
|
|
@@ -109,7 +110,6 @@ function setCredential(item) {
|
|
|
109
110
|
}
|
|
110
111
|
const poolKey = getPoolKey(credential);
|
|
111
112
|
if (!(pool = POOL_STATE[poolKey]) || pool.closed) {
|
|
112
|
-
const { createPool } = require("mariadb");
|
|
113
113
|
const config = this.getPoolConfig("mariadb", password);
|
|
114
114
|
if (config) {
|
|
115
115
|
const { max, idle } = config;
|
|
@@ -120,7 +120,7 @@ function setCredential(item) {
|
|
|
120
120
|
credential.idleTimeout ?? (credential.idleTimeout = idle);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
new MariaDBPool(createPool(removeUUIDKey(credential)), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
|
|
123
|
+
new MariaDBPool(mariadb.createPool(removeUUIDKey(credential)), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
126
|
pool.add(item);
|
|
@@ -137,7 +137,6 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
137
137
|
if (length === 0) {
|
|
138
138
|
return [];
|
|
139
139
|
}
|
|
140
|
-
const db = require("mariadb");
|
|
141
140
|
let parallel, connectOnce, errorQuery, sessionKey, outCacheMiss;
|
|
142
141
|
if ((0, types_1.isPlainObject)(options)) {
|
|
143
142
|
({ parallel, connectOnce, errorQuery, sessionKey, outCacheMiss } = options);
|
|
@@ -203,7 +202,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
if (!client) {
|
|
206
|
-
clients.push(client = await
|
|
205
|
+
clients.push(client = await mariadb.createConnection(removeUUIDKey(mariaDBCredential || credential)));
|
|
207
206
|
}
|
|
208
207
|
if (connectOnce) {
|
|
209
208
|
if (!parallel) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/mariadb",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "MariaDB client driver for E-mc.",
|
|
5
5
|
"main": "client/index.js",
|
|
6
6
|
"types": "client/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@e-mc/db": "^0.
|
|
25
|
-
"@e-mc/types": "^0.
|
|
24
|
+
"@e-mc/db": "^0.6.1",
|
|
25
|
+
"@e-mc/types": "^0.6.1",
|
|
26
26
|
"mariadb": "^3.2.3"
|
|
27
27
|
}
|
|
28
28
|
}
|