@simonbackx/simple-database 1.23.1 → 1.24.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,5 +1,16 @@
|
|
|
1
1
|
import mysql from "mysql";
|
|
2
|
-
export
|
|
2
|
+
export type SQLResultRow = Record<string, unknown>;
|
|
3
|
+
export type SQLResultNamespacedRow = Record<string, SQLResultRow>;
|
|
4
|
+
type SelectOptions = {
|
|
5
|
+
connection?: mysql.PoolConnection;
|
|
6
|
+
nestTables?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare class DatabaseStatic {
|
|
9
|
+
pool: mysql.Pool;
|
|
10
|
+
debug: boolean;
|
|
11
|
+
constructor(options?: {
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
});
|
|
3
14
|
setDebug(enabled?: boolean): void;
|
|
4
15
|
getConnection(): Promise<mysql.PoolConnection>;
|
|
5
16
|
escapeId(value: string): string;
|
|
@@ -7,7 +18,12 @@ export declare const Database: {
|
|
|
7
18
|
startQuery(): [number, number];
|
|
8
19
|
logQuery(q: any, hrstart: [number, number]): void;
|
|
9
20
|
finishQuery(q: any, hrstart: [number, number]): void;
|
|
10
|
-
select(query: string, values?: any,
|
|
21
|
+
select(query: string, values?: any, options?: SelectOptions & {
|
|
22
|
+
nestTables: true;
|
|
23
|
+
}): Promise<[SQLResultNamespacedRow[], mysql.FieldInfo[] | undefined]>;
|
|
24
|
+
select(query: string, values?: any, options?: SelectOptions & {
|
|
25
|
+
nestTables: false;
|
|
26
|
+
}): Promise<[SQLResultRow[], mysql.FieldInfo[] | undefined]>;
|
|
11
27
|
insert(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[{
|
|
12
28
|
insertId: any;
|
|
13
29
|
affectedRows: number;
|
|
@@ -19,4 +35,6 @@ export declare const Database: {
|
|
|
19
35
|
affectedRows: number;
|
|
20
36
|
}, mysql.FieldInfo[] | undefined]>;
|
|
21
37
|
statement(query: string, values?: any, useConnection?: mysql.PoolConnection): Promise<[any, any]>;
|
|
22
|
-
}
|
|
38
|
+
}
|
|
39
|
+
export declare const Database: DatabaseStatic;
|
|
40
|
+
export {};
|
|
@@ -1,55 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.Database = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
6
8
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
9
|
const mysql_1 = tslib_1.__importDefault(require("mysql"));
|
|
8
|
-
if (!process.env.DB_DATABASE) {
|
|
9
|
-
throw new Error("Environment variable DB_DATABASE is missing");
|
|
10
|
-
}
|
|
11
|
-
// create the connection to database
|
|
12
|
-
// Create the connection pool. The pool-specific settings are the defaults
|
|
13
|
-
const pool = mysql_1.default.createPool({
|
|
14
|
-
host: (_a = process.env.DB_HOST) !== null && _a !== void 0 ? _a : "localhost",
|
|
15
|
-
user: (_b = process.env.DB_USER) !== null && _b !== void 0 ? _b : "root",
|
|
16
|
-
password: (_c = process.env.DB_PASS) !== null && _c !== void 0 ? _c : "root",
|
|
17
|
-
port: parseInt((_d = process.env.DB_PORT) !== null && _d !== void 0 ? _d : "3306"),
|
|
18
|
-
database: process.env.DB_DATABASE,
|
|
19
|
-
waitForConnections: true,
|
|
20
|
-
connectionLimit: parseInt((_e = process.env.DB_CONNECTION_LIMIT) !== null && _e !== void 0 ? _e : "10"),
|
|
21
|
-
queueLimit: 0,
|
|
22
|
-
multipleStatements: ((_f = process.env.DB_MULTIPLE_STATEMENTS) !== null && _f !== void 0 ? _f : "false") === "true",
|
|
23
|
-
charset: "utf8mb4",
|
|
24
|
-
ssl: ((_g = process.env.DB_USE_SSL) !== null && _g !== void 0 ? _g : false) ? {
|
|
25
|
-
ca: process.env.DB_CA ? fs_1.default.readFileSync(process.env.DB_CA) : undefined,
|
|
26
|
-
rejectUnauthorized: process.env.DB_CA ? true : false,
|
|
27
|
-
} : undefined
|
|
28
|
-
});
|
|
29
|
-
let debug = false;
|
|
30
|
-
if (debug) {
|
|
31
|
-
pool.on("acquire", function (connection) {
|
|
32
|
-
console.log("Connection %d acquired", connection.threadId);
|
|
33
|
-
});
|
|
34
|
-
pool.on("connection", function (connection) {
|
|
35
|
-
console.log("Connection %d created", connection.threadId);
|
|
36
|
-
});
|
|
37
|
-
pool.on("enqueue", function () {
|
|
38
|
-
console.log("Waiting for available connection slot");
|
|
39
|
-
});
|
|
40
|
-
pool.on("release", function (connection) {
|
|
41
|
-
console.log("Connection %d released", connection.threadId);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
10
|
/// Database is a wrapper arround mysql, because we want to use promises + types
|
|
45
|
-
|
|
11
|
+
class DatabaseStatic {
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
|
+
this.debug = false;
|
|
15
|
+
if (!process.env.DB_DATABASE) {
|
|
16
|
+
throw new Error("Environment variable DB_DATABASE is missing");
|
|
17
|
+
}
|
|
18
|
+
this.pool = mysql_1.default.createPool({
|
|
19
|
+
host: (_a = process.env.DB_HOST) !== null && _a !== void 0 ? _a : "localhost",
|
|
20
|
+
user: (_b = process.env.DB_USER) !== null && _b !== void 0 ? _b : "root",
|
|
21
|
+
password: (_c = process.env.DB_PASS) !== null && _c !== void 0 ? _c : "root",
|
|
22
|
+
port: parseInt((_d = process.env.DB_PORT) !== null && _d !== void 0 ? _d : "3306"),
|
|
23
|
+
database: process.env.DB_DATABASE,
|
|
24
|
+
waitForConnections: true,
|
|
25
|
+
connectionLimit: parseInt((_e = process.env.DB_CONNECTION_LIMIT) !== null && _e !== void 0 ? _e : "10"),
|
|
26
|
+
queueLimit: 0,
|
|
27
|
+
multipleStatements: ((_f = process.env.DB_MULTIPLE_STATEMENTS) !== null && _f !== void 0 ? _f : "false") === "true",
|
|
28
|
+
charset: "utf8mb4",
|
|
29
|
+
ssl: ((_g = process.env.DB_USE_SSL) !== null && _g !== void 0 ? _g : false) ? {
|
|
30
|
+
ca: process.env.DB_CA ? fs_1.default.readFileSync(process.env.DB_CA) : undefined,
|
|
31
|
+
rejectUnauthorized: process.env.DB_CA ? true : false,
|
|
32
|
+
} : undefined
|
|
33
|
+
});
|
|
34
|
+
this.debug = (_h = options === null || options === void 0 ? void 0 : options.debug) !== null && _h !== void 0 ? _h : false;
|
|
35
|
+
if (this.debug) {
|
|
36
|
+
this.pool.on("acquire", function (connection) {
|
|
37
|
+
console.log("Connection %d acquired", connection.threadId);
|
|
38
|
+
});
|
|
39
|
+
this.pool.on("connection", function (connection) {
|
|
40
|
+
console.log("Connection %d created", connection.threadId);
|
|
41
|
+
});
|
|
42
|
+
this.pool.on("enqueue", function () {
|
|
43
|
+
console.log("Waiting for available connection slot");
|
|
44
|
+
});
|
|
45
|
+
this.pool.on("release", function (connection) {
|
|
46
|
+
console.log("Connection %d released", connection.threadId);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
46
50
|
setDebug(enabled = true) {
|
|
47
|
-
debug = enabled;
|
|
48
|
-
}
|
|
51
|
+
this.debug = enabled;
|
|
52
|
+
}
|
|
49
53
|
async getConnection() {
|
|
50
54
|
// Todo: use the settings here to provide a good connection pool
|
|
51
55
|
return new Promise((resolve, reject) => {
|
|
52
|
-
pool.getConnection((err, connection) => {
|
|
56
|
+
this.pool.getConnection((err, connection) => {
|
|
53
57
|
if (err) {
|
|
54
58
|
console.error("connection failed");
|
|
55
59
|
return reject(err);
|
|
@@ -57,45 +61,47 @@ exports.Database = {
|
|
|
57
61
|
return resolve(connection);
|
|
58
62
|
});
|
|
59
63
|
});
|
|
60
|
-
}
|
|
64
|
+
}
|
|
61
65
|
escapeId(value) {
|
|
62
|
-
return pool.escapeId(value);
|
|
63
|
-
}
|
|
66
|
+
return this.pool.escapeId(value);
|
|
67
|
+
}
|
|
64
68
|
async end() {
|
|
65
69
|
return new Promise((resolve, reject) => {
|
|
66
|
-
pool.end(
|
|
70
|
+
this.pool.end((err) => {
|
|
67
71
|
if (err) {
|
|
68
72
|
console.error(err);
|
|
69
73
|
return reject(err);
|
|
70
74
|
}
|
|
71
|
-
if (debug) {
|
|
75
|
+
if (this.debug) {
|
|
72
76
|
console.log("All connections have ended in the pool");
|
|
73
77
|
}
|
|
74
78
|
return resolve();
|
|
75
79
|
});
|
|
76
80
|
});
|
|
77
|
-
}
|
|
81
|
+
}
|
|
78
82
|
startQuery() {
|
|
79
83
|
return process.hrtime();
|
|
80
|
-
}
|
|
84
|
+
}
|
|
81
85
|
logQuery(q, hrstart) {
|
|
82
|
-
if (debug) {
|
|
86
|
+
if (this.debug) {
|
|
83
87
|
const hrend = process.hrtime(hrstart);
|
|
84
88
|
console.warn(q.sql.replace(/\n+ +/g, "\n"), "started at " + (hrend[0] * 1000 + hrend[1] / 1000000) + "ms");
|
|
85
89
|
}
|
|
86
|
-
}
|
|
90
|
+
}
|
|
87
91
|
finishQuery(q, hrstart) {
|
|
88
|
-
if (debug) {
|
|
92
|
+
if (this.debug) {
|
|
89
93
|
const hrend = process.hrtime(hrstart);
|
|
90
94
|
console.log(q.sql.replace(/\s+/g, " "), "in " + (hrend[0] * 1000 + hrend[1] / 1000000) + "ms");
|
|
91
95
|
}
|
|
92
|
-
}
|
|
93
|
-
async select(query, values,
|
|
94
|
-
|
|
96
|
+
}
|
|
97
|
+
async select(query, values, options = {}) {
|
|
98
|
+
var _a;
|
|
99
|
+
const connection = (_a = options.connection) !== null && _a !== void 0 ? _a : (await this.getConnection());
|
|
95
100
|
return new Promise((resolve, reject) => {
|
|
101
|
+
var _a;
|
|
96
102
|
const hrstart = this.startQuery();
|
|
97
|
-
const q = connection.query({ sql: query, nestTables: true, values: values }, (err, results, fields) => {
|
|
98
|
-
if (!
|
|
103
|
+
const q = connection.query({ sql: query, nestTables: (_a = options.nestTables) !== null && _a !== void 0 ? _a : true, values: values }, (err, results, fields) => {
|
|
104
|
+
if (!options.connection)
|
|
99
105
|
connection.release();
|
|
100
106
|
this.finishQuery(q, hrstart);
|
|
101
107
|
if (err) {
|
|
@@ -105,7 +111,7 @@ exports.Database = {
|
|
|
105
111
|
});
|
|
106
112
|
this.logQuery(q, hrstart);
|
|
107
113
|
});
|
|
108
|
-
}
|
|
114
|
+
}
|
|
109
115
|
async insert(query, values, useConnection) {
|
|
110
116
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
111
117
|
return new Promise((resolve, reject) => {
|
|
@@ -121,7 +127,7 @@ exports.Database = {
|
|
|
121
127
|
});
|
|
122
128
|
this.logQuery(q, hrstart);
|
|
123
129
|
});
|
|
124
|
-
}
|
|
130
|
+
}
|
|
125
131
|
async update(query, values, useConnection) {
|
|
126
132
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
127
133
|
return new Promise((resolve, reject) => {
|
|
@@ -137,7 +143,7 @@ exports.Database = {
|
|
|
137
143
|
});
|
|
138
144
|
this.logQuery(q, hrstart);
|
|
139
145
|
});
|
|
140
|
-
}
|
|
146
|
+
}
|
|
141
147
|
async delete(query, values, useConnection) {
|
|
142
148
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
143
149
|
return new Promise((resolve, reject) => {
|
|
@@ -153,7 +159,7 @@ exports.Database = {
|
|
|
153
159
|
});
|
|
154
160
|
this.logQuery(q, hrstart);
|
|
155
161
|
});
|
|
156
|
-
}
|
|
162
|
+
}
|
|
157
163
|
async statement(query, values, useConnection) {
|
|
158
164
|
const connection = useConnection !== null && useConnection !== void 0 ? useConnection : (await this.getConnection());
|
|
159
165
|
return new Promise((resolve, reject) => {
|
|
@@ -169,6 +175,7 @@ exports.Database = {
|
|
|
169
175
|
});
|
|
170
176
|
this.logQuery(q, hrstart);
|
|
171
177
|
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.Database = new DatabaseStatic();
|
|
174
181
|
//# sourceMappingURL=Database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../../src/classes/Database.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../../src/classes/Database.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,+DAA+D;AAC/D,4DAA4D;AAC5D,oDAAoB;AACpB,0DAA0B;AAO1B,gFAAgF;AAChF,MAAM,cAAc;IAIhB,YAAY,UAA6B,EAAE;;QAF3C,UAAK,GAAG,KAAK,CAAC;QAGV,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;SAClE;QAED,IAAI,CAAC,IAAI,GAAG,eAAK,CAAC,UAAU,CAAC;YACzB,IAAI,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,WAAW;YACxC,IAAI,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,MAAM;YACnC,QAAQ,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,MAAM;YACvC,IAAI,EAAE,QAAQ,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,MAAM,CAAC;YAC7C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;YACjC,kBAAkB,EAAE,IAAI;YACxB,eAAe,EAAE,QAAQ,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,mBAAmB,mCAAI,IAAI,CAAC;YAClE,UAAU,EAAE,CAAC;YACb,kBAAkB,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,sBA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js",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.24.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",
|