pangea-server 1.0.75 → 1.0.76
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.
|
@@ -63,6 +63,10 @@ export declare class Db {
|
|
|
63
63
|
restoreOne<BM extends BaseModel>(model: BaseModelCtor<BM>, target: Target<BM>): Promise<BM>;
|
|
64
64
|
restoreMany<BM extends BaseModel>(model: BaseModelCtor<BM>, where: Where<BM>): Promise<void>;
|
|
65
65
|
private __getInstance;
|
|
66
|
+
query(sql: string | {
|
|
67
|
+
query: string;
|
|
68
|
+
values: unknown[];
|
|
69
|
+
}): Promise<[unknown[], unknown]>;
|
|
66
70
|
enableForeignKeyChecks(): Promise<[unknown[], unknown]>;
|
|
67
71
|
disableForeignKeyChecks(): Promise<[unknown[], unknown]>;
|
|
68
72
|
}
|
|
@@ -200,14 +200,16 @@ class Db {
|
|
|
200
200
|
return target;
|
|
201
201
|
return this.findOne(model, target, { paranoid });
|
|
202
202
|
}
|
|
203
|
+
query(sql) {
|
|
204
|
+
const dbClient = (0, db_client_1.getDbClient)();
|
|
205
|
+
return dbClient.query(sql, { transaction: this.__tx });
|
|
206
|
+
}
|
|
203
207
|
// foreign key methods
|
|
204
208
|
enableForeignKeyChecks() {
|
|
205
|
-
|
|
206
|
-
return dbClient.query('SET FOREIGN_KEY_CHECKS = 1', { transaction: this.__tx });
|
|
209
|
+
return this.query('SET FOREIGN_KEY_CHECKS = 1');
|
|
207
210
|
}
|
|
208
211
|
disableForeignKeyChecks() {
|
|
209
|
-
|
|
210
|
-
return dbClient.query('SET FOREIGN_KEY_CHECKS = 0', { transaction: this.__tx });
|
|
212
|
+
return this.query('SET FOREIGN_KEY_CHECKS = 0');
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
exports.Db = Db;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { StatusCodes } from 'http-status-codes';
|
|
2
|
+
type StatusCodeName = keyof typeof StatusCodes;
|
|
3
|
+
type StatusCode = (typeof StatusCodes)[StatusCodeName];
|
|
4
|
+
type ErrorCode = string;
|
|
2
5
|
type AppErrorCtor = {
|
|
3
6
|
statusCodeName: StatusCodeName;
|
|
4
7
|
errorCode: ErrorCode;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED