befly 3.8.29 → 3.8.31
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/README.md +91 -6
- package/checks/checkApi.ts +2 -1
- package/checks/checkApp.ts +31 -1
- package/checks/checkTable.ts +3 -2
- package/hooks/cors.ts +3 -3
- package/hooks/parser.ts +8 -6
- package/hooks/permission.ts +12 -5
- package/hooks/validator.ts +1 -1
- package/lib/cacheHelper.ts +73 -65
- package/lib/cipher.ts +2 -1
- package/lib/connect.ts +23 -52
- package/lib/dbHelper.ts +14 -11
- package/lib/jwt.ts +58 -437
- package/lib/logger.ts +76 -197
- package/lib/redisHelper.ts +163 -1
- package/lib/sqlBuilder.ts +2 -1
- package/lib/validator.ts +150 -384
- package/loader/loadApis.ts +4 -7
- package/loader/loadHooks.ts +6 -5
- package/loader/loadPlugins.ts +11 -13
- package/main.ts +26 -53
- package/package.json +10 -8
- package/paths.ts +0 -6
- package/plugins/cipher.ts +1 -1
- package/plugins/config.ts +3 -4
- package/plugins/db.ts +6 -7
- package/plugins/jwt.ts +7 -6
- package/plugins/logger.ts +6 -6
- package/plugins/redis.ts +9 -13
- package/router/api.ts +2 -2
- package/router/static.ts +4 -8
- package/sync/syncAll.ts +8 -13
- package/sync/syncApi.ts +14 -10
- package/sync/syncDb/apply.ts +1 -2
- package/sync/syncDb.ts +12 -15
- package/sync/syncDev.ts +19 -56
- package/sync/syncMenu.ts +182 -137
- package/tests/cacheHelper.test.ts +327 -0
- package/tests/dbHelper-columns.test.ts +5 -20
- package/tests/dbHelper-execute.test.ts +14 -68
- package/tests/fields-redis-cache.test.ts +5 -3
- package/tests/integration.test.ts +17 -32
- package/tests/jwt.test.ts +36 -94
- package/tests/logger.test.ts +32 -34
- package/tests/redisHelper.test.ts +271 -2
- package/tests/redisKeys.test.ts +76 -0
- package/tests/sync-connection.test.ts +0 -6
- package/tests/syncDb-constants.test.ts +12 -12
- package/tests/util.test.ts +5 -1
- package/tests/validator.test.ts +611 -85
- package/types/befly.d.ts +9 -15
- package/types/cache.d.ts +73 -0
- package/types/common.d.ts +10 -128
- package/types/database.d.ts +221 -5
- package/types/index.ts +6 -5
- package/types/plugin.d.ts +1 -4
- package/types/redis.d.ts +37 -2
- package/types/table.d.ts +175 -0
- package/config.ts +0 -70
- package/hooks/_rateLimit.ts +0 -64
- package/lib/regexAliases.ts +0 -59
- package/lib/xml.ts +0 -383
- package/tests/validator-advanced.test.ts +0 -653
- package/tests/xml.test.ts +0 -101
- package/types/addon.d.ts +0 -50
- package/types/crypto.d.ts +0 -23
- package/types/jwt.d.ts +0 -99
- package/types/logger.d.ts +0 -43
- package/types/tool.d.ts +0 -67
- package/types/validator.d.ts +0 -43
|
@@ -108,25 +108,25 @@ describe('MYSQL_TABLE_CONFIG', () => {
|
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
describe('
|
|
111
|
+
describe('getTypeMapping (MySQL)', () => {
|
|
112
112
|
test('number 映射为 BIGINT', () => {
|
|
113
|
-
expect(constants.
|
|
113
|
+
expect(constants.getTypeMapping().number).toBe('BIGINT');
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
test('string 映射为 VARCHAR', () => {
|
|
117
|
-
expect(constants.
|
|
117
|
+
expect(constants.getTypeMapping().string).toBe('VARCHAR');
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
test('text 映射为 MEDIUMTEXT', () => {
|
|
121
|
-
expect(constants.
|
|
121
|
+
expect(constants.getTypeMapping().text).toBe('MEDIUMTEXT');
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
test('array_string 映射为 VARCHAR', () => {
|
|
125
|
-
expect(constants.
|
|
125
|
+
expect(constants.getTypeMapping().array_string).toBe('VARCHAR');
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
test('array_text 映射为 MEDIUMTEXT', () => {
|
|
129
|
-
expect(constants.
|
|
129
|
+
expect(constants.getTypeMapping().array_text).toBe('MEDIUMTEXT');
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
132
|
|
|
@@ -137,15 +137,15 @@ describe('IS_PLAN', () => {
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
describe('数据库类型判断 (MySQL)', () => {
|
|
140
|
-
test('
|
|
141
|
-
expect(constants.
|
|
140
|
+
test('isMySQL 为 true', () => {
|
|
141
|
+
expect(constants.isMySQL()).toBe(true);
|
|
142
142
|
});
|
|
143
143
|
|
|
144
|
-
test('
|
|
145
|
-
expect(constants.
|
|
144
|
+
test('isPG 为 false', () => {
|
|
145
|
+
expect(constants.isPG()).toBe(false);
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
test('
|
|
149
|
-
expect(constants.
|
|
148
|
+
test('isSQLite 为 false', () => {
|
|
149
|
+
expect(constants.isSQLite()).toBe(false);
|
|
150
150
|
});
|
|
151
151
|
});
|
package/tests/util.test.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { describe, test, expect } from 'bun:test';
|
|
2
|
-
import { keysToCamel
|
|
2
|
+
import { keysToCamel } from 'befly-shared/keysToCamel';
|
|
3
|
+
import { keysToSnake } from 'befly-shared/keysToSnake';
|
|
4
|
+
import { arrayKeysToCamel } from 'befly-shared/arrayKeysToCamel';
|
|
5
|
+
import { calcPerfTime } from 'befly-shared/calcPerfTime';
|
|
6
|
+
import { fieldClear } from 'befly-shared/fieldClear';
|
|
3
7
|
|
|
4
8
|
describe('Util - keysToCamel', () => {
|
|
5
9
|
test('转换对象键名为驼峰', () => {
|