befly 3.18.13 → 3.18.15
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/lib/connect.js +4 -4
- package/lib/dbHelper/dataOps.js +2 -2
- package/lib/dbHelper/validate.js +3 -3
- package/package.json +2 -2
package/lib/connect.js
CHANGED
|
@@ -52,8 +52,8 @@ export class Connect {
|
|
|
52
52
|
} catch (error) {
|
|
53
53
|
await this.mysqlClient?.close();
|
|
54
54
|
this.mysqlClient = null;
|
|
55
|
-
Logger.error(
|
|
56
|
-
throw new Error(
|
|
55
|
+
Logger.error(`Mysql 连接失败 (${config.hostname})`, error);
|
|
56
|
+
throw new Error(`Mysql 连接失败 (${config.hostname})`, {
|
|
57
57
|
cause: error,
|
|
58
58
|
code: "runtime",
|
|
59
59
|
subsystem: "mysql",
|
|
@@ -93,8 +93,8 @@ export class Connect {
|
|
|
93
93
|
} catch (error) {
|
|
94
94
|
await this.redisClient?.close();
|
|
95
95
|
this.redisClient = null;
|
|
96
|
-
Logger.error(
|
|
97
|
-
throw new Error(
|
|
96
|
+
Logger.error(`Redis 连接失败 (${config.hostname})`, error);
|
|
97
|
+
throw new Error(`Redis 连接失败 (${config.hostname})`, {
|
|
98
98
|
cause: error,
|
|
99
99
|
code: "runtime",
|
|
100
100
|
subsystem: "redis",
|
package/lib/dbHelper/dataOps.js
CHANGED
|
@@ -96,8 +96,8 @@ export const dataOpsMethods = {
|
|
|
96
96
|
},
|
|
97
97
|
|
|
98
98
|
async getAll(options) {
|
|
99
|
-
const MAX_LIMIT =
|
|
100
|
-
const WARNING_LIMIT =
|
|
99
|
+
const MAX_LIMIT = 100000;
|
|
100
|
+
const WARNING_LIMIT = 10000;
|
|
101
101
|
const prepareOptions = this.buildQueryOptions(options, { page: 1, limit: 10 });
|
|
102
102
|
const prepared = await this.prepareQueryOptions(prepareOptions, "getAll.options");
|
|
103
103
|
|
package/lib/dbHelper/validate.js
CHANGED
|
@@ -241,14 +241,14 @@ export function validateSafeFieldName(field) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
export function validatePageLimitRange(prepared, rawTable) {
|
|
244
|
-
if (prepared.page < 1 || prepared.page >
|
|
244
|
+
if (prepared.page < 1 || prepared.page > 100000) {
|
|
245
245
|
throw new Error(`页码必须在 1 到 10000 之间 (table: ${rawTable}, page: ${prepared.page}, limit: ${prepared.limit})`, {
|
|
246
246
|
cause: null,
|
|
247
247
|
code: "validation"
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
-
if (prepared.limit < 1 || prepared.limit >
|
|
251
|
-
throw new Error(`每页数量必须在 1 到
|
|
250
|
+
if (prepared.limit < 1 || prepared.limit > 100000) {
|
|
251
|
+
throw new Error(`每页数量必须在 1 到 100000 之间 (table: ${rawTable}, page: ${prepared.page}, limit: ${prepared.limit})`, {
|
|
252
252
|
cause: null,
|
|
253
253
|
code: "validation"
|
|
254
254
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "3.18.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "3.18.15",
|
|
4
|
+
"gitHead": "52de35bf463398d4be0988fc5aaa2e0dda9fe185",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly - 为 Bun 专属打造的 JavaScript API 接口框架核心引擎",
|
|
7
7
|
"keywords": [
|