@jayfong/x-server 1.27.1 → 1.27.4
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/CHANGELOG.md +21 -0
- package/lib/_cjs/cli/api_generator.js +19 -1
- package/lib/_cjs/services/cache.js +1 -4
- package/lib/cli/api_generator.js +19 -1
- package/lib/services/cache.d.ts +1 -1
- package/lib/services/cache.js +1 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.27.4](https://github.com/jfWorks/x-server/compare/v1.27.3...v1.27.4) (2022-05-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* cache remove use batch ([1075902](https://github.com/jfWorks/x-server/commit/1075902984e09e766ec72b0289c4e4a5d16d5d16))
|
|
11
|
+
|
|
12
|
+
### [1.27.3](https://github.com/jfWorks/x-server/compare/v1.27.2...v1.27.3) (2022-05-11)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* api gen ([5e0086f](https://github.com/jfWorks/x-server/commit/5e0086f166bf629f0a68ddea367816abf40197f0))
|
|
18
|
+
|
|
19
|
+
### [1.27.2](https://github.com/jfWorks/x-server/compare/v1.27.1...v1.27.2) (2022-05-11)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* api gen GET ([601d94a](https://github.com/jfWorks/x-server/commit/601d94a9abd4a33a91f805dae74a0a471ba2cd59))
|
|
25
|
+
|
|
5
26
|
### [1.27.1](https://github.com/jfWorks/x-server/compare/v1.27.0...v1.27.1) (2022-05-08)
|
|
6
27
|
|
|
7
28
|
|
|
@@ -186,7 +186,24 @@ class ApiGenerator {
|
|
|
186
186
|
|
|
187
187
|
for (const handle of handles) {
|
|
188
188
|
data[handle.category] = data[handle.category] || [];
|
|
189
|
-
data[handle.category].push(handle.handlerMethod === '
|
|
189
|
+
data[handle.category].push(handle.handlerMethod === 'GET' ? {
|
|
190
|
+
method: handle.method.toUpperCase(),
|
|
191
|
+
title: handle.name,
|
|
192
|
+
path: handle.path,
|
|
193
|
+
res_body_type: 'json',
|
|
194
|
+
req_body_is_json_schema: false,
|
|
195
|
+
res_body_is_json_schema: true,
|
|
196
|
+
req_params: [],
|
|
197
|
+
req_query: handle.requestData.children.map(item => ({
|
|
198
|
+
required: item.required ? 1 : 0,
|
|
199
|
+
name: item.name,
|
|
200
|
+
desc: item.desc,
|
|
201
|
+
type: 'string'
|
|
202
|
+
})),
|
|
203
|
+
req_headers: [],
|
|
204
|
+
req_body_form: [],
|
|
205
|
+
res_body: JSON.stringify(handle.responseDataJsonSchema)
|
|
206
|
+
} : handle.handlerMethod === 'FILE' ? {
|
|
190
207
|
method: handle.method.toUpperCase(),
|
|
191
208
|
title: handle.name,
|
|
192
209
|
path: handle.path,
|
|
@@ -200,6 +217,7 @@ class ApiGenerator {
|
|
|
200
217
|
req_body_form: handle.requestData.children.map(item => ({
|
|
201
218
|
required: item.required ? 1 : 0,
|
|
202
219
|
name: item.name,
|
|
220
|
+
desc: item.desc,
|
|
203
221
|
type: item.type === 'file' ? 'file' : 'text'
|
|
204
222
|
})),
|
|
205
223
|
res_body: JSON.stringify(handle.responseDataJsonSchema)
|
|
@@ -182,10 +182,7 @@ class CacheService {
|
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
async remove(...keys) {
|
|
185
|
-
return
|
|
186
|
-
const redisKey = this.toRedisKey(key);
|
|
187
|
-
return _x.x.redis.del(redisKey);
|
|
188
|
-
}));
|
|
185
|
+
return _x.x.redis.del(...keys.map(key => this.toRedisKey(key)));
|
|
189
186
|
}
|
|
190
187
|
/**
|
|
191
188
|
* 清空全部缓存。
|
package/lib/cli/api_generator.js
CHANGED
|
@@ -170,7 +170,24 @@ export class ApiGenerator {
|
|
|
170
170
|
|
|
171
171
|
for (const handle of handles) {
|
|
172
172
|
data[handle.category] = data[handle.category] || [];
|
|
173
|
-
data[handle.category].push(handle.handlerMethod === '
|
|
173
|
+
data[handle.category].push(handle.handlerMethod === 'GET' ? {
|
|
174
|
+
method: handle.method.toUpperCase(),
|
|
175
|
+
title: handle.name,
|
|
176
|
+
path: handle.path,
|
|
177
|
+
res_body_type: 'json',
|
|
178
|
+
req_body_is_json_schema: false,
|
|
179
|
+
res_body_is_json_schema: true,
|
|
180
|
+
req_params: [],
|
|
181
|
+
req_query: handle.requestData.children.map(item => ({
|
|
182
|
+
required: item.required ? 1 : 0,
|
|
183
|
+
name: item.name,
|
|
184
|
+
desc: item.desc,
|
|
185
|
+
type: 'string'
|
|
186
|
+
})),
|
|
187
|
+
req_headers: [],
|
|
188
|
+
req_body_form: [],
|
|
189
|
+
res_body: JSON.stringify(handle.responseDataJsonSchema)
|
|
190
|
+
} : handle.handlerMethod === 'FILE' ? {
|
|
174
191
|
method: handle.method.toUpperCase(),
|
|
175
192
|
title: handle.name,
|
|
176
193
|
path: handle.path,
|
|
@@ -184,6 +201,7 @@ export class ApiGenerator {
|
|
|
184
201
|
req_body_form: handle.requestData.children.map(item => ({
|
|
185
202
|
required: item.required ? 1 : 0,
|
|
186
203
|
name: item.name,
|
|
204
|
+
desc: item.desc,
|
|
187
205
|
type: item.type === 'file' ? 'file' : 'text'
|
|
188
206
|
})),
|
|
189
207
|
res_body: JSON.stringify(handle.responseDataJsonSchema)
|
package/lib/services/cache.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export declare class CacheService<TData extends Data = Data, TKey extends Key<TD
|
|
|
94
94
|
*
|
|
95
95
|
* @param keys 键列表
|
|
96
96
|
*/
|
|
97
|
-
remove<K extends TKeyPath>(...keys: K[]): Promise<
|
|
97
|
+
remove<K extends TKeyPath>(...keys: K[]): Promise<number>;
|
|
98
98
|
/**
|
|
99
99
|
* 清空全部缓存。
|
|
100
100
|
*/
|
package/lib/services/cache.js
CHANGED
|
@@ -172,10 +172,7 @@ export class CacheService {
|
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
async remove(...keys) {
|
|
175
|
-
return
|
|
176
|
-
const redisKey = this.toRedisKey(key);
|
|
177
|
-
return x.redis.del(redisKey);
|
|
178
|
-
}));
|
|
175
|
+
return x.redis.del(...keys.map(key => this.toRedisKey(key)));
|
|
179
176
|
}
|
|
180
177
|
/**
|
|
181
178
|
* 清空全部缓存。
|