@simonbackx/simple-database 1.31.0 → 1.33.0
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,4 +1,4 @@
|
|
|
1
|
-
import mysql from '
|
|
1
|
+
import mysql from 'mysql2/promise';
|
|
2
2
|
import { DatabaseStoredValue } from './Column';
|
|
3
3
|
export type SQLResultRow = Record<string, DatabaseStoredValue>;
|
|
4
4
|
export type SQLResultNamespacedRow = Record<string, SQLResultRow>;
|
|
@@ -6,11 +6,21 @@ type SelectOptions = {
|
|
|
6
6
|
connection?: mysql.PoolConnection;
|
|
7
7
|
nestTables?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare class
|
|
9
|
+
export declare class DatabaseInstance {
|
|
10
10
|
pool: mysql.Pool;
|
|
11
11
|
debug: boolean;
|
|
12
12
|
constructor(options?: {
|
|
13
13
|
debug?: boolean;
|
|
14
|
+
host?: string;
|
|
15
|
+
user?: string;
|
|
16
|
+
password?: string;
|
|
17
|
+
port?: number;
|
|
18
|
+
database?: string | null;
|
|
19
|
+
connectionLimit?: number;
|
|
20
|
+
multipleStatements?: boolean;
|
|
21
|
+
charset?: string;
|
|
22
|
+
useSSL?: boolean;
|
|
23
|
+
ca?: string;
|
|
14
24
|
});
|
|
15
25
|
setDebug(enabled?: boolean): void;
|
|
16
26
|
getConnection(): Promise<mysql.PoolConnection>;
|
|
@@ -21,21 +31,25 @@ declare class DatabaseStatic {
|
|
|
21
31
|
finishQuery(q: any, hrstart: [number, number]): void;
|
|
22
32
|
select(query: string, values?: any, options?: SelectOptions & {
|
|
23
33
|
nestTables: true;
|
|
24
|
-
}): Promise<[SQLResultNamespacedRow[], mysql.
|
|
34
|
+
}): Promise<[SQLResultNamespacedRow[], mysql.FieldPacket[] | undefined]>;
|
|
25
35
|
select(query: string, values?: any, options?: SelectOptions & {
|
|
26
36
|
nestTables: false;
|
|
27
|
-
}): Promise<[SQLResultRow[], mysql.
|
|
37
|
+
}): Promise<[SQLResultRow[], mysql.FieldPacket[] | undefined]>;
|
|
28
38
|
insert(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[{
|
|
29
39
|
insertId: any;
|
|
30
40
|
affectedRows: number;
|
|
31
|
-
}, mysql.
|
|
32
|
-
update(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
}, mysql.FieldPacket[] | undefined]>;
|
|
42
|
+
update(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[
|
|
43
|
+
{
|
|
44
|
+
changedRows: number;
|
|
45
|
+
affectedRows: number;
|
|
46
|
+
},
|
|
47
|
+
mysql.FieldPacket[] | undefined
|
|
48
|
+
]>;
|
|
35
49
|
delete(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[{
|
|
36
50
|
affectedRows: number;
|
|
37
|
-
}, mysql.
|
|
51
|
+
}, mysql.FieldPacket[] | undefined]>;
|
|
38
52
|
statement(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[any, any]>;
|
|
39
53
|
}
|
|
40
|
-
export declare const Database:
|
|
54
|
+
export declare const Database: DatabaseInstance;
|
|
41
55
|
export {};
|
|
@@ -1,36 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Database = void 0;
|
|
3
|
+
exports.Database = exports.DatabaseInstance = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const
|
|
6
|
+
const promise_1 = tslib_1.__importDefault(require("mysql2/promise"));
|
|
7
7
|
/// Database is a wrapper arround mysql, because we want to use promises + types
|
|
8
|
-
class
|
|
8
|
+
class DatabaseInstance {
|
|
9
9
|
constructor(options = {}) {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
11
11
|
this.debug = false;
|
|
12
|
-
|
|
12
|
+
const settings = {
|
|
13
|
+
host: (_b = (_a = options.host) !== null && _a !== void 0 ? _a : process.env.DB_HOST) !== null && _b !== void 0 ? _b : 'localhost',
|
|
14
|
+
user: (_d = (_c = options.user) !== null && _c !== void 0 ? _c : process.env.DB_USER) !== null && _d !== void 0 ? _d : 'root',
|
|
15
|
+
password: (_f = (_e = options.password) !== null && _e !== void 0 ? _e : process.env.DB_PASS) !== null && _f !== void 0 ? _f : 'root',
|
|
16
|
+
port: options.port ? options.port : parseInt((_g = process.env.DB_PORT) !== null && _g !== void 0 ? _g : '3306'),
|
|
17
|
+
database: options.database === undefined ? process.env.DB_DATABASE : options.database,
|
|
18
|
+
connectionLimit: options.connectionLimit ? options.connectionLimit : parseInt((_h = process.env.DB_CONNECTION_LIMIT) !== null && _h !== void 0 ? _h : '10'),
|
|
19
|
+
multipleStatements: (_j = options.multipleStatements) !== null && _j !== void 0 ? _j : (((_k = process.env.DB_MULTIPLE_STATEMENTS) !== null && _k !== void 0 ? _k : 'false') === 'true'),
|
|
20
|
+
charset: (_m = (_l = options.charset) !== null && _l !== void 0 ? _l : process.env.DB_CHARSET) !== null && _m !== void 0 ? _m : 'utf8mb4_0900_ai_ci',
|
|
21
|
+
useSSL: (_o = options.useSSL) !== null && _o !== void 0 ? _o : !!process.env.DB_USE_SSL,
|
|
22
|
+
ca: (_p = options.ca) !== null && _p !== void 0 ? _p : process.env.DB_CA,
|
|
23
|
+
};
|
|
24
|
+
if (settings.database === undefined) {
|
|
13
25
|
throw new Error('Environment variable DB_DATABASE is missing');
|
|
14
26
|
}
|
|
15
|
-
this.pool =
|
|
16
|
-
host:
|
|
17
|
-
user:
|
|
18
|
-
password:
|
|
19
|
-
port:
|
|
20
|
-
database:
|
|
27
|
+
this.pool = promise_1.default.createPool({
|
|
28
|
+
host: settings.host,
|
|
29
|
+
user: settings.user,
|
|
30
|
+
password: settings.password,
|
|
31
|
+
port: settings.port,
|
|
32
|
+
database: (_q = settings.database) !== null && _q !== void 0 ? _q : undefined,
|
|
21
33
|
waitForConnections: true,
|
|
22
|
-
connectionLimit:
|
|
34
|
+
connectionLimit: settings.connectionLimit,
|
|
23
35
|
queueLimit: 0,
|
|
24
|
-
multipleStatements:
|
|
25
|
-
charset:
|
|
26
|
-
|
|
36
|
+
multipleStatements: settings.multipleStatements,
|
|
37
|
+
charset: settings.charset,
|
|
38
|
+
decimalNumbers: true,
|
|
39
|
+
jsonStrings: true,
|
|
40
|
+
ssl: settings.useSSL
|
|
27
41
|
? {
|
|
28
|
-
ca:
|
|
29
|
-
rejectUnauthorized:
|
|
42
|
+
ca: settings.ca ? fs_1.default.readFileSync(settings.ca) : undefined,
|
|
43
|
+
rejectUnauthorized: settings.ca ? true : false,
|
|
30
44
|
}
|
|
31
45
|
: undefined,
|
|
32
46
|
});
|
|
33
|
-
this.debug = (
|
|
47
|
+
this.debug = (_r = options === null || options === void 0 ? void 0 : options.debug) !== null && _r !== void 0 ? _r : false;
|
|
34
48
|
if (this.debug) {
|
|
35
49
|
this.pool.on('acquire', function (connection) {
|
|
36
50
|
console.log('Connection %d acquired', connection.threadId);
|
|
@@ -51,32 +65,13 @@ class DatabaseStatic {
|
|
|
51
65
|
}
|
|
52
66
|
async getConnection() {
|
|
53
67
|
// Todo: use the settings here to provide a good connection pool
|
|
54
|
-
return
|
|
55
|
-
this.pool.getConnection((err, connection) => {
|
|
56
|
-
if (err) {
|
|
57
|
-
console.error('connection failed');
|
|
58
|
-
return reject(err);
|
|
59
|
-
}
|
|
60
|
-
return resolve(connection);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
68
|
+
return await this.pool.getConnection();
|
|
63
69
|
}
|
|
64
70
|
escapeId(value) {
|
|
65
71
|
return this.pool.escapeId(value);
|
|
66
72
|
}
|
|
67
73
|
async end() {
|
|
68
|
-
return
|
|
69
|
-
this.pool.end((err) => {
|
|
70
|
-
if (err) {
|
|
71
|
-
console.error(err);
|
|
72
|
-
return reject(err);
|
|
73
|
-
}
|
|
74
|
-
if (this.debug) {
|
|
75
|
-
console.log('All connections have ended in the pool');
|
|
76
|
-
}
|
|
77
|
-
return resolve();
|
|
78
|
-
});
|
|
79
|
-
});
|
|
74
|
+
return await this.pool.end();
|
|
80
75
|
}
|
|
81
76
|
startQuery() {
|
|
82
77
|
return process.hrtime();
|
|
@@ -94,87 +89,82 @@ class DatabaseStatic {
|
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
91
|
async select(query, values, options = {}) {
|
|
97
|
-
var _a;
|
|
92
|
+
var _a, _b;
|
|
98
93
|
const connection = (_a = options.connection) !== null && _a !== void 0 ? _a : (await this.getConnection());
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.logQuery(q, hrstart);
|
|
112
|
-
});
|
|
94
|
+
try {
|
|
95
|
+
const q = await connection.query({ sql: query, nestTables: (_b = options.nestTables) !== null && _b !== void 0 ? _b : true, values: values });
|
|
96
|
+
return [
|
|
97
|
+
q[0],
|
|
98
|
+
q[1],
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
if (!options.connection) {
|
|
103
|
+
connection.release();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
113
106
|
}
|
|
114
107
|
async insert(query, values, useConnection) {
|
|
115
108
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
});
|
|
109
|
+
try {
|
|
110
|
+
const q = await connection.query({ sql: query, values: values });
|
|
111
|
+
return [
|
|
112
|
+
q[0],
|
|
113
|
+
q[1],
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
if (!useConnection) {
|
|
118
|
+
connection.release();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
129
121
|
}
|
|
130
122
|
async update(query, values, useConnection) {
|
|
131
123
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
});
|
|
124
|
+
try {
|
|
125
|
+
const q = await connection.query({ sql: query, values: values });
|
|
126
|
+
return [
|
|
127
|
+
q[0],
|
|
128
|
+
q[1],
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
if (!useConnection) {
|
|
133
|
+
connection.release();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
145
136
|
}
|
|
146
137
|
async delete(query, values, useConnection) {
|
|
147
138
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
});
|
|
139
|
+
try {
|
|
140
|
+
const q = await connection.query({ sql: query, values: values });
|
|
141
|
+
return [
|
|
142
|
+
q[0],
|
|
143
|
+
q[1],
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
if (!useConnection) {
|
|
148
|
+
connection.release();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
161
151
|
}
|
|
162
152
|
async statement(query, values, useConnection) {
|
|
163
153
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
});
|
|
154
|
+
try {
|
|
155
|
+
const q = await connection.query({ sql: query, values: values });
|
|
156
|
+
return [
|
|
157
|
+
q[0],
|
|
158
|
+
q[1],
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
if (!useConnection) {
|
|
163
|
+
connection.release();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
177
166
|
}
|
|
178
167
|
}
|
|
179
|
-
exports.
|
|
168
|
+
exports.DatabaseInstance = DatabaseInstance;
|
|
169
|
+
exports.Database = new DatabaseInstance();
|
|
180
170
|
//# sourceMappingURL=Database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../../src/classes/Database.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,
|
|
1
|
+
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../../src/classes/Database.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,qEAAmC;AAOnC,gFAAgF;AAChF,MAAa,gBAAgB;IAIzB,YAAY,UAYR,EAAE;;QAdN,UAAK,GAAG,KAAK,CAAC;QAeV,MAAM,QAAQ,GAAG;YACb,IAAI,EAAE,MAAA,MAAA,OAAO,CAAC,IAAI,mCAAI,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,WAAW;YACxD,IAAI,EAAE,MAAA,MAAA,OAAO,CAAC,IAAI,mCAAI,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,MAAM;YACnD,QAAQ,EAAE,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,MAAM;YAC3D,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAA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,CAAQ;aACd,CAAC;SACL;gBACO;YACJ,IAAI,CAAC,aAAa,EAAE;gBAChB,UAAU,CAAC,OAAO,EAAE,CAAC;aACxB;SACJ;IACL,CAAC;CACJ;AAtMD,4CAsMC;AAEY,QAAA,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@simonbackx/simple-database",
|
|
3
3
|
"main": "./dist/index.js",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.33.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "yarn build && jest",
|
|
8
8
|
"build": "rm -rf ./dist && tsc -p . --declaration && mkdir -p ./dist/src/migrations && cp -a ./src/migrations/*.sql ./dist/src/migrations",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@simonbackx/simple-logging": "^1.0.0",
|
|
17
17
|
"colors": "^1.4.0",
|
|
18
|
-
"
|
|
18
|
+
"mysql2": "3.14.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@simonbackx/simple-encoding": "^2.18.0",
|
|
22
|
-
"
|
|
22
|
+
"mysql2": "^3.14.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@simonbackx/simple-encoding": "^2.20.0",
|