@jayfong/x-server 2.12.7 → 2.12.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/_cjs/cli/api_generator.js +20 -54
- package/lib/_cjs/cli/build_util.js +16 -45
- package/lib/_cjs/cli/cli.js +6 -27
- package/lib/_cjs/cli/deploy_util.js +0 -12
- package/lib/_cjs/cli/env_util.js +16 -49
- package/lib/_cjs/cli/template_util.js +26 -29
- package/lib/_cjs/core/define_bus.js +9 -6
- package/lib/_cjs/core/define_cron.js +0 -2
- package/lib/_cjs/core/define_handler.js +10 -12
- package/lib/_cjs/core/define_hook.js +0 -2
- package/lib/_cjs/core/define_server.js +0 -2
- package/lib/_cjs/core/define_task.js +7 -13
- package/lib/_cjs/core/get_handler_url.js +1 -2
- package/lib/_cjs/core/handler.js +8 -29
- package/lib/_cjs/core/http_error.js +0 -3
- package/lib/_cjs/core/http_header.js +8 -12
- package/lib/_cjs/core/server.js +8 -41
- package/lib/_cjs/core/types.js +0 -7
- package/lib/_cjs/index.js +0 -72
- package/lib/_cjs/plugins/cors.js +0 -7
- package/lib/_cjs/plugins/file_parser.js +2 -9
- package/lib/_cjs/plugins/form_body_parser.js +0 -6
- package/lib/_cjs/plugins/ws_parser.js +0 -6
- package/lib/_cjs/plugins/xml_parser.js +0 -12
- package/lib/_cjs/services/cache.js +18 -58
- package/lib/_cjs/services/captcha.js +0 -14
- package/lib/_cjs/services/dingtalk.js +0 -14
- package/lib/_cjs/services/dispose.js +0 -9
- package/lib/_cjs/services/emoji.js +2 -5
- package/lib/_cjs/services/jwt.js +0 -21
- package/lib/_cjs/services/log.js +0 -17
- package/lib/_cjs/services/mail.js +0 -9
- package/lib/_cjs/services/pay.js +9 -40
- package/lib/_cjs/services/rate_limit.js +0 -12
- package/lib/_cjs/services/redis.js +0 -4
- package/lib/_cjs/services/request.js +14 -299
- package/lib/_cjs/services/sensitive_words.js +13 -19
- package/lib/_cjs/x.js +0 -11
- package/lib/cli/api_generator.js +20 -42
- package/lib/cli/build_util.js +16 -19
- package/lib/cli/cli.js +6 -12
- package/lib/cli/deploy_util.js +0 -4
- package/lib/cli/env_util.js +16 -37
- package/lib/cli/template_util.d.ts +1 -0
- package/lib/cli/template_util.js +26 -14
- package/lib/core/define_bus.js +7 -5
- package/lib/core/define_handler.js +10 -9
- package/lib/core/define_task.js +7 -6
- package/lib/core/get_handler_url.js +2 -1
- package/lib/core/handler.js +9 -22
- package/lib/core/http_header.js +6 -9
- package/lib/core/server.js +8 -31
- package/lib/core/types.js +0 -7
- package/lib/index.js +4 -3
- package/lib/plugins/cors.js +0 -3
- package/lib/plugins/file_parser.js +2 -5
- package/lib/plugins/form_body_parser.js +0 -3
- package/lib/plugins/ws_parser.js +0 -3
- package/lib/plugins/xml_parser.js +0 -10
- package/lib/services/cache.js +18 -52
- package/lib/services/captcha.js +0 -7
- package/lib/services/dingtalk.js +0 -7
- package/lib/services/dispose.js +0 -5
- package/lib/services/emoji.js +2 -3
- package/lib/services/jwt.js +0 -13
- package/lib/services/log.js +0 -8
- package/lib/services/mail.js +0 -3
- package/lib/services/pay.js +9 -30
- package/lib/services/rate_limit.js +0 -8
- package/lib/services/redis.js +0 -1
- package/lib/services/request.d.ts +3 -130
- package/lib/services/request.js +5 -274
- package/lib/services/sensitive_words.js +13 -15
- package/package.json +4 -28
- package/README.md +0 -51
- package/lib/_cjs/cli/register.js +0 -8
- package/lib/_cjs/client_helper.js +0 -26
- package/lib/_cjs/types/_formstream.js +0 -1
- package/lib/cli/register.d.ts +0 -1
- package/lib/cli/register.js +0 -5
- package/lib/client_helper.d.ts +0 -1
- package/lib/client_helper.js +0 -16
- package/lib/types/_formstream.d.ts +0 -49
- package/lib/types/_formstream.js +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.processXServerResponse = processXServerResponse;
|
|
7
|
-
|
|
8
|
-
var _lzString = _interopRequireDefault(require("lz-string"));
|
|
9
|
-
|
|
10
|
-
var _vtils = require("vtils");
|
|
11
|
-
|
|
12
|
-
// _#
|
|
13
|
-
const obfuscateKey = [90, 30].map(v => String.fromCharCode(v + 5)).join('');
|
|
14
|
-
|
|
15
|
-
function processXServerResponse(data) {
|
|
16
|
-
// 处理混淆
|
|
17
|
-
if (data && typeof data === 'object' && data[obfuscateKey] != null) {
|
|
18
|
-
try {
|
|
19
|
-
data = JSON.parse(_lzString.default.decompress(data[obfuscateKey]));
|
|
20
|
-
} catch {}
|
|
21
|
-
} // 处理数组打包
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
data = _vtils.DataPacker.unpackIfNeeded(data);
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/lib/cli/register.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/cli/register.js
DELETED
package/lib/client_helper.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function processXServerResponse<T>(data: any): T;
|
package/lib/client_helper.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import LZString from 'lz-string';
|
|
2
|
-
import { DataPacker } from 'vtils'; // _#
|
|
3
|
-
|
|
4
|
-
const obfuscateKey = [90, 30].map(v => String.fromCharCode(v + 5)).join('');
|
|
5
|
-
export function processXServerResponse(data) {
|
|
6
|
-
// 处理混淆
|
|
7
|
-
if (data && typeof data === 'object' && data[obfuscateKey] != null) {
|
|
8
|
-
try {
|
|
9
|
-
data = JSON.parse(LZString.decompress(data[obfuscateKey]));
|
|
10
|
-
} catch {}
|
|
11
|
-
} // 处理数组打包
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
data = DataPacker.unpackIfNeeded(data);
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
declare module 'formstream' {
|
|
4
|
-
import { Stream, Readable } from 'stream';
|
|
5
|
-
class FormStream extends Stream {
|
|
6
|
-
/**
|
|
7
|
-
* Add a normal field to the form.
|
|
8
|
-
*
|
|
9
|
-
* @param name Name of field
|
|
10
|
-
* @param value Value of field
|
|
11
|
-
*/
|
|
12
|
-
field(name: string, value: string): this;
|
|
13
|
-
/**
|
|
14
|
-
* Add a local file to be uploaded to the form.
|
|
15
|
-
*
|
|
16
|
-
* @param name Name of file field
|
|
17
|
-
* @param filepath Local path of the file to be uploaded
|
|
18
|
-
* @param filename Name of the file (will be the base name of filepath if empty)
|
|
19
|
-
* @param filesize Size of the file (will not generate Content-Length header if not specified)
|
|
20
|
-
*/
|
|
21
|
-
file(name: string, filepath: string, filename?: string, filesize?: number): this;
|
|
22
|
-
/**
|
|
23
|
-
* Add a buffer as a file to upload.
|
|
24
|
-
*
|
|
25
|
-
* @param name Name of field
|
|
26
|
-
* @param buffer The buffer to be uploaded
|
|
27
|
-
* @param filename The file name that tells the remote server
|
|
28
|
-
* @param contentType Content-Type (aka. MIME Type) of content (will be infered with filename if empty)
|
|
29
|
-
*/
|
|
30
|
-
buffer(name: string, buffer: Buffer, filename: string, contentType?: string): this;
|
|
31
|
-
/**
|
|
32
|
-
* Add a readable stream as a file to upload. Event 'error' will be emitted if an error occured.
|
|
33
|
-
*
|
|
34
|
-
* @param name Name of field
|
|
35
|
-
* @param stream A readable stream to be piped
|
|
36
|
-
* @param filename The file name that tells the remote server
|
|
37
|
-
* @param contentType Content-Type (aka. MIME Type) of content (will be infered with filename if empty)
|
|
38
|
-
* @param size Size of the stream (will not generate Content-Length header if not specified)
|
|
39
|
-
*/
|
|
40
|
-
stream(name: string, stream: Readable, filename: string, contentType?: string, size?: number): this;
|
|
41
|
-
/**
|
|
42
|
-
* Get headers for the request.
|
|
43
|
-
*
|
|
44
|
-
* @param additionalHeaders Additional headers
|
|
45
|
-
*/
|
|
46
|
-
headers(additionalHeaders?: Record<string, any>): Record<string, any>;
|
|
47
|
-
}
|
|
48
|
-
export = FormStream;
|
|
49
|
-
}
|
package/lib/types/_formstream.js
DELETED
|
File without changes
|