@jayfong/x-server 2.119.0 → 3.0.0
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/_virtual/_rolldown/runtime.mjs +4 -0
- package/lib/cli/api_generator.d.mts +74 -0
- package/lib/cli/api_generator.mjs +310 -0
- package/lib/cli/build_util.d.mts +17 -0
- package/lib/cli/build_util.mjs +156 -0
- package/lib/cli/cli.d.mts +1 -0
- package/lib/cli/cli.mjs +355 -0
- package/lib/cli/css_register.d.mts +1 -0
- package/lib/cli/css_register.mjs +7 -0
- package/lib/cli/deploy_util.d.mts +23 -0
- package/lib/cli/deploy_util.mjs +70 -0
- package/lib/cli/dev_util.d.mts +7 -0
- package/lib/cli/dev_util.mjs +25 -0
- package/lib/cli/env_util.d.mts +45 -0
- package/lib/cli/env_util.mjs +207 -0
- package/lib/cli/esbuild_register.d.mts +1 -0
- package/lib/cli/esbuild_register.mjs +7 -0
- package/lib/cli/template_util.d.mts +18 -0
- package/lib/cli/template_util.mjs +85 -0
- package/lib/cli/templates/crons.ts +1 -1
- package/lib/cli/templates/handlers.ts +1 -1
- package/lib/cli/templates/hooks.ts +1 -1
- package/lib/cli/templates/models.ts +7 -7
- package/lib/cli/templates/package.json +11 -1
- package/lib/cli/templates/routes.ts +2 -1
- package/lib/core/ctx_storage.d.mts +3 -0
- package/lib/core/ctx_storage.mjs +4 -0
- package/lib/core/define_bus.d.mts +37 -0
- package/lib/core/define_bus.mjs +12 -0
- package/lib/core/{define_cron.d.ts → define_cron.d.mts} +2 -2
- package/lib/core/define_cron.mjs +11 -0
- package/lib/core/{define_handler.d.ts → define_handler.d.mts} +19 -19
- package/lib/core/define_handler.mjs +44 -0
- package/lib/core/define_hook.d.mts +2 -0
- package/lib/core/define_hook.mjs +6 -0
- package/lib/core/define_server.d.mts +3 -0
- package/lib/core/define_server.mjs +8 -0
- package/lib/core/{define_task.d.ts → define_task.d.mts} +2 -2
- package/lib/core/define_task.mjs +102 -0
- package/lib/core/get_handler_url.d.mts +2 -0
- package/lib/core/get_handler_url.mjs +7 -0
- package/lib/core/handler.d.mts +16 -0
- package/lib/core/handler.mjs +132 -0
- package/lib/core/http_error.d.mts +2 -0
- package/lib/core/http_error.mjs +1 -0
- package/lib/core/http_header.d.mts +856 -0
- package/lib/core/http_header.mjs +860 -0
- package/lib/core/http_method.d.mts +3 -0
- package/lib/core/http_method.mjs +10 -0
- package/lib/core/http_redirect.d.mts +5 -0
- package/lib/core/http_redirect.mjs +10 -0
- package/lib/core/server.d.mts +20 -0
- package/lib/core/server.mjs +186 -0
- package/lib/core/types.d.mts +256 -0
- package/lib/exports.d.mts +46 -0
- package/lib/exports.mjs +46 -0
- package/lib/index.d.mts +48 -0
- package/lib/index.mjs +45 -0
- package/lib/plugins/base.d.mts +4 -0
- package/lib/plugins/compress.d.mts +12 -0
- package/lib/plugins/compress.mjs +15 -0
- package/lib/plugins/cookie.d.mts +12 -0
- package/lib/plugins/cookie.mjs +15 -0
- package/lib/plugins/cors.d.mts +22 -0
- package/lib/plugins/cors.mjs +34 -0
- package/lib/plugins/file_parser.d.mts +15 -0
- package/lib/plugins/file_parser.mjs +24 -0
- package/lib/plugins/form_body_parser.d.mts +12 -0
- package/lib/plugins/form_body_parser.mjs +15 -0
- package/lib/plugins/ws_parser.d.mts +12 -0
- package/lib/plugins/ws_parser.mjs +15 -0
- package/lib/plugins/xml_parser.d.mts +19 -0
- package/lib/plugins/xml_parser.mjs +40 -0
- package/lib/services/ai.d.mts +31 -0
- package/lib/services/ai.mjs +44 -0
- package/lib/services/base.d.mts +4 -0
- package/lib/services/base.mjs +1 -0
- package/lib/services/cache.d.mts +165 -0
- package/lib/services/cache.mjs +323 -0
- package/lib/services/captcha.d.mts +65 -0
- package/lib/services/captcha.mjs +61 -0
- package/lib/services/{crypto.js → crypto.d.mts} +19 -78
- package/lib/services/crypto.mjs +141 -0
- package/lib/services/db_value.d.mts +60 -0
- package/lib/services/db_value.mjs +64 -0
- package/lib/services/dingtalk.d.mts +39 -0
- package/lib/services/dingtalk.mjs +44 -0
- package/lib/services/dispose.d.mts +17 -0
- package/lib/services/dispose.mjs +18 -0
- package/lib/services/emoji.d.mts +10 -0
- package/lib/services/emoji.mjs +2025 -0
- package/lib/services/file_store.d.mts +49 -0
- package/lib/services/file_store.mjs +58 -0
- package/lib/services/html.d.mts +11 -0
- package/lib/services/html.mjs +12 -0
- package/lib/services/jwt.d.mts +33 -0
- package/lib/services/jwt.mjs +42 -0
- package/lib/services/log.d.mts +37 -0
- package/lib/services/log.mjs +99 -0
- package/lib/services/mail.d.mts +22 -0
- package/lib/services/mail.mjs +28 -0
- package/lib/services/pay.d.mts +123 -0
- package/lib/services/pay.mjs +157 -0
- package/lib/services/random.d.mts +27 -0
- package/lib/services/random.mjs +42 -0
- package/lib/services/rate_limit.d.mts +37 -0
- package/lib/services/rate_limit.mjs +40 -0
- package/lib/services/redis.d.mts +11 -0
- package/lib/services/redis.mjs +6 -0
- package/lib/services/sensitive_words.d.mts +29 -0
- package/lib/services/sensitive_words.mjs +37 -0
- package/lib/services/sms.d.mts +40 -0
- package/lib/services/sms.mjs +30238 -0
- package/lib/types/dto.d.mts +30 -0
- package/lib/types/dto.mjs +1 -0
- package/lib/x.d.mts +11 -0
- package/lib/x.mjs +21 -0
- package/lib/x_init.d.mts +1 -0
- package/lib/x_init.mjs +10 -0
- package/package.json +71 -16
- package/lib/_cjs/cli/api_generator.js +0 -458
- package/lib/_cjs/cli/build_util.js +0 -243
- package/lib/_cjs/cli/cli.js +0 -378
- package/lib/_cjs/cli/css_register.js +0 -7
- package/lib/_cjs/cli/deploy_util.js +0 -76
- package/lib/_cjs/cli/dev_util.js +0 -26
- package/lib/_cjs/cli/env_util.js +0 -252
- package/lib/_cjs/cli/esbuild_register.js +0 -7
- package/lib/_cjs/cli/template_util.js +0 -101
- package/lib/_cjs/cli/templates/crons.ts +0 -2
- package/lib/_cjs/cli/templates/handlers.ts +0 -3
- package/lib/_cjs/cli/templates/hooks.ts +0 -2
- package/lib/_cjs/cli/templates/models.ts +0 -123
- package/lib/_cjs/cli/templates/package.json +0 -3
- package/lib/_cjs/cli/templates/routes.ts +0 -68
- package/lib/_cjs/core/ctx_storage.js +0 -6
- package/lib/_cjs/core/define_bus.js +0 -31
- package/lib/_cjs/core/define_cron.js +0 -13
- package/lib/_cjs/core/define_handler.js +0 -56
- package/lib/_cjs/core/define_hook.js +0 -8
- package/lib/_cjs/core/define_server.js +0 -10
- package/lib/_cjs/core/define_task.js +0 -113
- package/lib/_cjs/core/get_handler_url.js +0 -11
- package/lib/_cjs/core/handler.js +0 -216
- package/lib/_cjs/core/http_error.js +0 -6
- package/lib/_cjs/core/http_header.js +0 -142
- package/lib/_cjs/core/http_method.js +0 -12
- package/lib/_cjs/core/http_redirect.js +0 -11
- package/lib/_cjs/core/server.js +0 -219
- package/lib/_cjs/core/types.js +0 -8
- package/lib/_cjs/exports.js +0 -273
- package/lib/_cjs/index.js +0 -15
- package/lib/_cjs/plugins/base.js +0 -3
- package/lib/_cjs/plugins/compress.js +0 -18
- package/lib/_cjs/plugins/cookie.js +0 -18
- package/lib/_cjs/plugins/cors.js +0 -38
- package/lib/_cjs/plugins/file_parser.js +0 -28
- package/lib/_cjs/plugins/form_body_parser.js +0 -18
- package/lib/_cjs/plugins/ws_parser.js +0 -18
- package/lib/_cjs/plugins/xml_parser.js +0 -48
- package/lib/_cjs/services/ai.js +0 -48
- package/lib/_cjs/services/base.js +0 -3
- package/lib/_cjs/services/cache.js +0 -400
- package/lib/_cjs/services/captcha.js +0 -78
- package/lib/_cjs/services/crypto.js +0 -175
- package/lib/_cjs/services/db_value.js +0 -77
- package/lib/_cjs/services/dingtalk.js +0 -51
- package/lib/_cjs/services/dispose.js +0 -23
- package/lib/_cjs/services/emoji.js +0 -2034
- package/lib/_cjs/services/file_store.js +0 -67
- package/lib/_cjs/services/html.js +0 -17
- package/lib/_cjs/services/jwt.js +0 -65
- package/lib/_cjs/services/log.js +0 -108
- package/lib/_cjs/services/mail.js +0 -31
- package/lib/_cjs/services/pay.js +0 -191
- package/lib/_cjs/services/random.js +0 -51
- package/lib/_cjs/services/rate_limit.js +0 -54
- package/lib/_cjs/services/redis.js +0 -12
- package/lib/_cjs/services/sensitive_words.js +0 -61
- package/lib/_cjs/services/sms.js +0 -84
- package/lib/_cjs/types/dto.js +0 -3
- package/lib/_cjs/x.js +0 -35
- package/lib/cli/api_generator.d.ts +0 -74
- package/lib/cli/api_generator.js +0 -452
- package/lib/cli/build_util.d.ts +0 -17
- package/lib/cli/build_util.js +0 -236
- package/lib/cli/cli.d.ts +0 -2
- package/lib/cli/cli.js +0 -374
- package/lib/cli/css_register.js +0 -5
- package/lib/cli/deploy_util.d.ts +0 -23
- package/lib/cli/deploy_util.js +0 -70
- package/lib/cli/dev_util.d.ts +0 -8
- package/lib/cli/dev_util.js +0 -20
- package/lib/cli/env_util.d.ts +0 -45
- package/lib/cli/env_util.js +0 -246
- package/lib/cli/esbuild_register.js +0 -5
- package/lib/cli/template_util.d.ts +0 -18
- package/lib/cli/template_util.js +0 -95
- package/lib/core/ctx_storage.d.ts +0 -3
- package/lib/core/ctx_storage.js +0 -2
- package/lib/core/define_bus.d.ts +0 -37
- package/lib/core/define_bus.js +0 -27
- package/lib/core/define_cron.js +0 -9
- package/lib/core/define_handler.js +0 -48
- package/lib/core/define_hook.d.ts +0 -2
- package/lib/core/define_hook.js +0 -4
- package/lib/core/define_server.d.ts +0 -3
- package/lib/core/define_server.js +0 -6
- package/lib/core/define_task.js +0 -107
- package/lib/core/get_handler_url.d.ts +0 -2
- package/lib/core/get_handler_url.js +0 -7
- package/lib/core/handler.d.ts +0 -16
- package/lib/core/handler.js +0 -209
- package/lib/core/http_error.d.ts +0 -2
- package/lib/core/http_error.js +0 -2
- package/lib/core/http_header.d.ts +0 -856
- package/lib/core/http_header.js +0 -139
- package/lib/core/http_method.d.ts +0 -3
- package/lib/core/http_method.js +0 -8
- package/lib/core/http_redirect.d.ts +0 -5
- package/lib/core/http_redirect.js +0 -6
- package/lib/core/server.d.ts +0 -20
- package/lib/core/server.js +0 -213
- package/lib/core/types.d.ts +0 -265
- package/lib/core/types.js +0 -4
- package/lib/exports.d.ts +0 -45
- package/lib/exports.js +0 -47
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -3
- package/lib/plugins/base.d.ts +0 -4
- package/lib/plugins/base.js +0 -1
- package/lib/plugins/compress.d.ts +0 -13
- package/lib/plugins/compress.js +0 -12
- package/lib/plugins/cookie.d.ts +0 -13
- package/lib/plugins/cookie.js +0 -12
- package/lib/plugins/cors.d.ts +0 -22
- package/lib/plugins/cors.js +0 -32
- package/lib/plugins/file_parser.d.ts +0 -16
- package/lib/plugins/file_parser.js +0 -22
- package/lib/plugins/form_body_parser.d.ts +0 -13
- package/lib/plugins/form_body_parser.js +0 -12
- package/lib/plugins/ws_parser.d.ts +0 -13
- package/lib/plugins/ws_parser.js +0 -12
- package/lib/plugins/xml_parser.d.ts +0 -19
- package/lib/plugins/xml_parser.js +0 -43
- package/lib/services/ai.d.ts +0 -31
- package/lib/services/ai.js +0 -43
- package/lib/services/base.d.ts +0 -4
- package/lib/services/base.js +0 -1
- package/lib/services/cache.d.ts +0 -173
- package/lib/services/cache.js +0 -394
- package/lib/services/captcha.d.ts +0 -65
- package/lib/services/captcha.js +0 -72
- package/lib/services/crypto.d.ts +0 -110
- package/lib/services/db_value.d.ts +0 -60
- package/lib/services/db_value.js +0 -72
- package/lib/services/dingtalk.d.ts +0 -39
- package/lib/services/dingtalk.js +0 -45
- package/lib/services/dispose.d.ts +0 -17
- package/lib/services/dispose.js +0 -17
- package/lib/services/emoji.d.ts +0 -10
- package/lib/services/emoji.js +0 -2029
- package/lib/services/file_store.d.ts +0 -49
- package/lib/services/file_store.js +0 -61
- package/lib/services/html.d.ts +0 -11
- package/lib/services/html.js +0 -12
- package/lib/services/jwt.d.ts +0 -34
- package/lib/services/jwt.js +0 -59
- package/lib/services/log.d.ts +0 -37
- package/lib/services/log.js +0 -102
- package/lib/services/mail.d.ts +0 -23
- package/lib/services/mail.js +0 -25
- package/lib/services/pay.d.ts +0 -123
- package/lib/services/pay.js +0 -185
- package/lib/services/random.d.ts +0 -27
- package/lib/services/random.js +0 -45
- package/lib/services/rate_limit.d.ts +0 -37
- package/lib/services/rate_limit.js +0 -49
- package/lib/services/redis.d.ts +0 -12
- package/lib/services/redis.js +0 -7
- package/lib/services/sensitive_words.d.ts +0 -29
- package/lib/services/sensitive_words.js +0 -56
- package/lib/services/sms.d.ts +0 -40
- package/lib/services/sms.js +0 -78
- package/lib/types/dto.d.ts +0 -86
- package/lib/types/dto.js +0 -1
- package/lib/x.d.ts +0 -17
- package/lib/x.js +0 -30
- /package/lib/{cli/css_register.d.ts → core/types.mjs} +0 -0
- /package/lib/{cli/esbuild_register.d.ts → plugins/base.mjs} +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.defineBus = defineBus;
|
|
5
|
-
var _nodeEvents = require("node:events");
|
|
6
|
-
class EventBus extends _nodeEvents.EventEmitter {
|
|
7
|
-
onReturnOff(event, listener) {
|
|
8
|
-
this.on(event, listener);
|
|
9
|
-
return () => this.off(event, listener);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function defineBus() {
|
|
13
|
-
const eventEmitter = new EventBus();
|
|
14
|
-
return eventEmitter;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// strict-event-emitter-types
|
|
18
|
-
// https://github.com/bterlson/strict-event-emitter-types/blob/9ed45fc68a69f0b7f85ce4e5fe11ff53cc6a009e/src/index.ts
|
|
19
|
-
|
|
20
|
-
// the overridden signatures need to be assignment compatible, but
|
|
21
|
-
// due to how tuple types work[0] it's not possible to be assignment
|
|
22
|
-
// compatible anymore. This hack fixes it with a unique symbol that
|
|
23
|
-
// won't ever show up in parameter help etc.
|
|
24
|
-
//
|
|
25
|
-
// Unfortunately, this has the result of giving a poor error message when
|
|
26
|
-
// you mix up types.
|
|
27
|
-
// 0: https://github.com/Microsoft/TypeScript/issues/26013)
|
|
28
|
-
|
|
29
|
-
// TODO: Stash under a symbol key once TS compiler bug is fixed
|
|
30
|
-
|
|
31
|
-
// EventEmitter method overrides
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.defineCron = defineCron;
|
|
5
|
-
var _cron = require("cron");
|
|
6
|
-
function defineCron(options) {
|
|
7
|
-
return _cron.CronJob.from({
|
|
8
|
-
cronTime: options.expression,
|
|
9
|
-
runOnInit: options.runOnInit,
|
|
10
|
-
start: true,
|
|
11
|
-
onTick: options.handle
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.defineHandler = defineHandler;
|
|
5
|
-
exports.defineHandlerANY = defineHandlerANY;
|
|
6
|
-
exports.defineHandlerFILE = defineHandlerFILE;
|
|
7
|
-
exports.defineHandlerGET = defineHandlerGET;
|
|
8
|
-
exports.defineHandlerXML = defineHandlerXML;
|
|
9
|
-
var _handler = require("./handler");
|
|
10
|
-
function defineHandler(options) {
|
|
11
|
-
const handler = new _handler.Handler({
|
|
12
|
-
...options,
|
|
13
|
-
requestMethod: 'POST'
|
|
14
|
-
});
|
|
15
|
-
return handler;
|
|
16
|
-
}
|
|
17
|
-
defineHandler.POST = defineHandler;
|
|
18
|
-
function defineHandlerGET(options) {
|
|
19
|
-
const handler = new _handler.Handler({
|
|
20
|
-
...options,
|
|
21
|
-
requestMethod: 'GET'
|
|
22
|
-
});
|
|
23
|
-
return handler;
|
|
24
|
-
}
|
|
25
|
-
defineHandler.GET = defineHandlerGET;
|
|
26
|
-
function defineHandlerFILE(options) {
|
|
27
|
-
const handler = new _handler.Handler({
|
|
28
|
-
...options,
|
|
29
|
-
requestMethod: 'FILE'
|
|
30
|
-
});
|
|
31
|
-
return handler;
|
|
32
|
-
}
|
|
33
|
-
defineHandler.FILE = defineHandlerFILE;
|
|
34
|
-
defineHandler.WS = options => {
|
|
35
|
-
const handler = new _handler.Handler({
|
|
36
|
-
...options,
|
|
37
|
-
requestMethod: 'WS'
|
|
38
|
-
});
|
|
39
|
-
return handler;
|
|
40
|
-
};
|
|
41
|
-
function defineHandlerXML(options) {
|
|
42
|
-
const handler = new _handler.Handler({
|
|
43
|
-
...options,
|
|
44
|
-
requestMethod: 'XML'
|
|
45
|
-
});
|
|
46
|
-
return handler;
|
|
47
|
-
}
|
|
48
|
-
defineHandler.XML = defineHandlerXML;
|
|
49
|
-
function defineHandlerANY(options) {
|
|
50
|
-
const handler = new _handler.Handler({
|
|
51
|
-
...options,
|
|
52
|
-
requestMethod: 'ANY'
|
|
53
|
-
});
|
|
54
|
-
return handler;
|
|
55
|
-
}
|
|
56
|
-
defineHandler.ANY = defineHandlerANY;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.defineSliceTask = defineSliceTask;
|
|
6
|
-
exports.defineTask = defineTask;
|
|
7
|
-
var _nodeAssert = _interopRequireDefault(require("node:assert"));
|
|
8
|
-
var _bull = _interopRequireDefault(require("bull"));
|
|
9
|
-
var _vtils = require("vtils");
|
|
10
|
-
var _x = require("../x");
|
|
11
|
-
function defineTask(options) {
|
|
12
|
-
const queue = new _bull.default(options.name, {
|
|
13
|
-
redis: {
|
|
14
|
-
..._x.x.redis.options,
|
|
15
|
-
// https://github.com/OptimalBits/bull/issues/2186
|
|
16
|
-
maxRetriesPerRequest: null,
|
|
17
|
-
enableReadyCheck: false
|
|
18
|
-
},
|
|
19
|
-
prefix: `${_x.x.appId}_task`,
|
|
20
|
-
defaultJobOptions: {
|
|
21
|
-
// 都设为 true 防止占用内存
|
|
22
|
-
removeOnComplete: true,
|
|
23
|
-
removeOnFail: true
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
queue.process(options.concurrency || 1, async job => {
|
|
27
|
-
return options.handle(job.data);
|
|
28
|
-
});
|
|
29
|
-
return queue;
|
|
30
|
-
}
|
|
31
|
-
function defineSliceTask(options) {
|
|
32
|
-
const task = defineTask({
|
|
33
|
-
name: options.name,
|
|
34
|
-
concurrency: 1,
|
|
35
|
-
handle: async data => {
|
|
36
|
-
const res = data.count ? await _x.x.redis.multi([['lrange', data.redisKey, `-${data.count}`, '-1'], ['ltrim', data.redisKey, '0', `-${data.count + 1}`]]).exec() : await _x.x.redis.multi([['lrange', data.redisKey, '0', '-1'], ['del', data.redisKey]]).exec();
|
|
37
|
-
const list = res[0][1].reverse().map(item => JSON.parse(item));
|
|
38
|
-
if (list.length) {
|
|
39
|
-
return options.handle(list, data.key);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const addAction = async (data, addOptions) => {
|
|
44
|
-
const redisKeyPrefix = `${_x.x.appId}_batch_task_${options.name}`;
|
|
45
|
-
const key = addOptions?.key || '';
|
|
46
|
-
const duration = addOptions?.duration != null ? (0, _vtils.ms)(addOptions.duration) : typeof options.duration === 'function' ? (0, _vtils.ms)(options.duration(key)) : options.duration && (0, _vtils.ms)(options.duration);
|
|
47
|
-
const threshold = addOptions?.threshold || typeof options.threshold && (typeof options.threshold === 'function' ? options.threshold(key) : options.threshold);
|
|
48
|
-
const thresholdTimeout = addOptions?.thresholdTimeout != null ? (0, _vtils.ms)(addOptions.thresholdTimeout) : typeof options.thresholdTimeout === 'function' ? (0, _vtils.ms)(options.thresholdTimeout(key)) : options.thresholdTimeout && (0, _vtils.ms)(options.thresholdTimeout);
|
|
49
|
-
(0, _nodeAssert.default)(duration != null || threshold != null, '参数 threshold 和 duration 必须至少设置 1 个');
|
|
50
|
-
const redisKey = !key ? redisKeyPrefix : `${redisKeyPrefix}_${key}`;
|
|
51
|
-
const res = await _x.x.redis.multi([['llen', redisKey], ['lpush', redisKey, JSON.stringify(data)]]).exec();
|
|
52
|
-
const count = parseInt(res[0][1], 10) + 1;
|
|
53
|
-
|
|
54
|
-
// 仅时段
|
|
55
|
-
// 1分钟内的合并推送
|
|
56
|
-
if (duration != null) {
|
|
57
|
-
if (count === 1) {
|
|
58
|
-
await task.add({
|
|
59
|
-
key: key,
|
|
60
|
-
redisKey: redisKey
|
|
61
|
-
}, {
|
|
62
|
-
delay: duration
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// 仅阈值
|
|
67
|
-
// 满10条推送
|
|
68
|
-
else if (threshold != null) {
|
|
69
|
-
const delayTaskId = redisKey;
|
|
70
|
-
const prevJob = await task.getJob(delayTaskId);
|
|
71
|
-
|
|
72
|
-
// 到达阈值,立即发送
|
|
73
|
-
if (count === threshold) {
|
|
74
|
-
await prevJob?.remove();
|
|
75
|
-
await task.add({
|
|
76
|
-
key: key,
|
|
77
|
-
redisKey: redisKey
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
// 存在超时设置
|
|
81
|
-
else if (thresholdTimeout) {
|
|
82
|
-
if (!prevJob) {
|
|
83
|
-
await task.add({
|
|
84
|
-
key: key,
|
|
85
|
-
redisKey: redisKey
|
|
86
|
-
}, {
|
|
87
|
-
jobId: delayTaskId,
|
|
88
|
-
delay: thresholdTimeout
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const addTask = defineTask({
|
|
95
|
-
name: `${options.name}_add`,
|
|
96
|
-
concurrency: 1,
|
|
97
|
-
handle: async payload => {
|
|
98
|
-
await addAction(payload.data, payload.options);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
const res = {
|
|
102
|
-
add: async (data, addOptions) => {
|
|
103
|
-
const delay = addOptions.delay && (0, _vtils.ms)(addOptions.delay) || 0;
|
|
104
|
-
await addTask.add({
|
|
105
|
-
data: data,
|
|
106
|
-
options: addOptions
|
|
107
|
-
}, {
|
|
108
|
-
delay: delay
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
return res;
|
|
113
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.getHandlerUrl = getHandlerUrl;
|
|
5
|
-
var _vtils = require("vtils");
|
|
6
|
-
var _x = require("../x");
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
|
|
9
|
-
function getHandlerUrl(path, query) {
|
|
10
|
-
return `${_x.x.env.APP_URL.replace(/\/+$/, '')}${path}${query ? `?${(0, _vtils.createUrlQueryString)(query)}` : ''}`;
|
|
11
|
-
}
|
package/lib/_cjs/core/handler.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.Handler = void 0;
|
|
7
|
-
var _got = require("got");
|
|
8
|
-
var _lzString = _interopRequireDefault(require("lz-string"));
|
|
9
|
-
var _vtils = require("vtils");
|
|
10
|
-
var vae = _interopRequireWildcard(require("vtils/vae"));
|
|
11
|
-
var _validator = require("vtils/validator");
|
|
12
|
-
var _http_error = require("../core/http_error");
|
|
13
|
-
var _dispose = require("../services/dispose");
|
|
14
|
-
var _ctx_storage = require("./ctx_storage");
|
|
15
|
-
var _http_redirect = require("./http_redirect");
|
|
16
|
-
var _server = require("./server");
|
|
17
|
-
_validator.yup.setLocale((0, _validator.getZhCN)({
|
|
18
|
-
getLabel: params => params.label || params.path
|
|
19
|
-
}));
|
|
20
|
-
class Handler {
|
|
21
|
-
constructor(options) {
|
|
22
|
-
this.options = options;
|
|
23
|
-
this.requestDataSchema = void 0;
|
|
24
|
-
this.requestDataSchemaVae = void 0;
|
|
25
|
-
this.requestHandle = void 0;
|
|
26
|
-
this.handle = async (data, ctx) => {
|
|
27
|
-
// 前置 hook
|
|
28
|
-
if (Handler.hooks.length) {
|
|
29
|
-
await Promise.all(Handler.hooks.map(hook => hook(this.options, data, ctx)));
|
|
30
|
-
}
|
|
31
|
-
let useAsyncContext = !!_server.Server.options.useAsyncContext;
|
|
32
|
-
if (this.options.useAsyncContext != null) {
|
|
33
|
-
useAsyncContext = this.options.useAsyncContext;
|
|
34
|
-
}
|
|
35
|
-
ctx.setHeader('x-trace-id', ctx.traceId);
|
|
36
|
-
if (this.options.requestMethod === 'WS') {
|
|
37
|
-
return useAsyncContext ? _ctx_storage.ctxStorage.run(ctx, () => this.handleWs(data, ctx)) : this.handleWs(data, ctx);
|
|
38
|
-
}
|
|
39
|
-
return useAsyncContext ? _ctx_storage.ctxStorage.run(ctx, () => this.handleHttp(data, ctx)) : this.handleHttp(data, ctx);
|
|
40
|
-
};
|
|
41
|
-
this.handleHttp = async (data, ctx) => {
|
|
42
|
-
// 请求数据解析
|
|
43
|
-
if (this.options.parseRequestData) {
|
|
44
|
-
data = await this.options.parseRequestData(data, ctx);
|
|
45
|
-
}
|
|
46
|
-
// 请求数据验证
|
|
47
|
-
// vae
|
|
48
|
-
if (this.requestDataSchemaVae) {
|
|
49
|
-
const res = this.requestDataSchemaVae.parse(
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
data, {
|
|
52
|
-
abortEarly: true,
|
|
53
|
-
preserveUnknownKeys: false
|
|
54
|
-
});
|
|
55
|
-
if (res.success) {
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
data = res.data;
|
|
58
|
-
} else {
|
|
59
|
-
throw new _http_error.HttpError.BadRequest(
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
res.issues[0].message);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// yup
|
|
65
|
-
else if (this.requestDataSchema) {
|
|
66
|
-
try {
|
|
67
|
-
data = await this.requestDataSchema.validate(data, {
|
|
68
|
-
abortEarly: true,
|
|
69
|
-
stripUnknown: true
|
|
70
|
-
});
|
|
71
|
-
} catch (err) {
|
|
72
|
-
throw new _http_error.HttpError.BadRequest(err.message);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
let res = await this.requestHandle(data, ctx);
|
|
77
|
-
if (res instanceof _http_redirect.HttpRedirect) {
|
|
78
|
-
ctx.redirect(res.url, res.permanently);
|
|
79
|
-
return {};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// 设置响应的 Content-Type 头
|
|
83
|
-
if (this.options.responseContentType) {
|
|
84
|
-
ctx.setHeader('Content-Type', this.options.responseContentType);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 打包返回数据
|
|
88
|
-
if (this.options.responseDataPack) {
|
|
89
|
-
res = _vtils.DataPacker.packAsRawType(res);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 混淆返回数据
|
|
93
|
-
if (this.options.responseDataObfuscate) {
|
|
94
|
-
res = {
|
|
95
|
-
'_#': _lzString.default.compress(JSON.stringify(res))
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// 加密返回数据
|
|
100
|
-
if (this.options.responseDataEncrypt && _server.Server.options.responseEncryptAlgorithm) {
|
|
101
|
-
if (_server.Server.options.responseEncryptAlgorithm === 'simple') {
|
|
102
|
-
res = {
|
|
103
|
-
_$: (0, _vtils.rot13)((0, _vtils.base64UrlEncode)(`${Date.now()}${JSON.stringify(res)}`))
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return res == null ? {} : res;
|
|
108
|
-
} catch (err) {
|
|
109
|
-
// 业务错误
|
|
110
|
-
if (_http_error.HttpError.isHttpError(err)) {
|
|
111
|
-
throw err;
|
|
112
|
-
}
|
|
113
|
-
// 网络错误
|
|
114
|
-
if (err instanceof _got.HTTPError || err instanceof _got.RequestError || err instanceof _got.TimeoutError || err instanceof _got.ParseError) {
|
|
115
|
-
console.error('网络请求错误', {
|
|
116
|
-
error: `${err.code || ''}__${err.name || ''}__${err.message || ''}`,
|
|
117
|
-
response: err.response?.body && err.options.responseType !== 'buffer' ? (0, _vtils.toSingleLineString)(String(err.response.body), 100) : '',
|
|
118
|
-
method: err.options.method,
|
|
119
|
-
url: err.options.url.toString(),
|
|
120
|
-
headers: JSON.stringify(err.options.headers || {}),
|
|
121
|
-
query: (err.options.search ?? err.options.searchParams?.toString()) || '',
|
|
122
|
-
body: (err.options.json ? JSON.stringify(err.options.json) : err.options.form ? new URLSearchParams(err.options.form).toString() : err.options.body?.toString()) || ''
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
// 服务器错误
|
|
126
|
-
else {
|
|
127
|
-
console.error('服务器错误', err);
|
|
128
|
-
}
|
|
129
|
-
throw new _http_error.HttpError.InternalServerError('服务异常,请稍后再试');
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
this.handleWs = async (_data, ctx) => {
|
|
133
|
-
const dispose = new _dispose.DisposeService();
|
|
134
|
-
ctx.ws.on('message', async payload => {
|
|
135
|
-
try {
|
|
136
|
-
const _ = JSON.parse(payload.toString('utf8'));
|
|
137
|
-
const send = data => {
|
|
138
|
-
ctx.ws.send(JSON.stringify({
|
|
139
|
-
id: _.id,
|
|
140
|
-
data: data
|
|
141
|
-
}));
|
|
142
|
-
};
|
|
143
|
-
const process = async (type, fn) => {
|
|
144
|
-
if (_.type === type) {
|
|
145
|
-
let sent = false;
|
|
146
|
-
try {
|
|
147
|
-
await fn({
|
|
148
|
-
data: _.data,
|
|
149
|
-
send: data => {
|
|
150
|
-
sent = true;
|
|
151
|
-
return send(data);
|
|
152
|
-
},
|
|
153
|
-
dispose: dispose
|
|
154
|
-
});
|
|
155
|
-
if (!sent) {
|
|
156
|
-
send();
|
|
157
|
-
}
|
|
158
|
-
} catch (err) {
|
|
159
|
-
const _err = _http_error.HttpError.isHttpError(err) ? err : new _http_error.HttpError.InternalServerError();
|
|
160
|
-
send({
|
|
161
|
-
statusCode: _err.statusCode,
|
|
162
|
-
error: _err.name,
|
|
163
|
-
message: _err.message
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
if (_.type === 'ping') {
|
|
169
|
-
send();
|
|
170
|
-
} else {
|
|
171
|
-
await this.options.handle(process, ctx);
|
|
172
|
-
}
|
|
173
|
-
} catch (err) {
|
|
174
|
-
const _err = _http_error.HttpError.isHttpError(err) ? err : new _http_error.HttpError.InternalServerError();
|
|
175
|
-
ctx.ws.send(JSON.stringify({
|
|
176
|
-
statusCode: _err.statusCode,
|
|
177
|
-
error: _err.name,
|
|
178
|
-
message: _err.message
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
ctx.ws.on('close', () => {
|
|
183
|
-
dispose.dispose();
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
if (options.requestDataSchemaVae) {
|
|
187
|
-
const res = typeof options.requestDataSchemaVae === 'function' ? options.requestDataSchemaVae(new vae.VaeSchemaBuilder()) : options.requestDataSchemaVae;
|
|
188
|
-
this.requestDataSchemaVae = res instanceof vae.VaeSchema ? res : new vae.VaeObjectSchema(res);
|
|
189
|
-
} else if (options.requestDataSchema) {
|
|
190
|
-
this.requestDataSchema = options.requestDataSchema(_validator.yup);
|
|
191
|
-
}
|
|
192
|
-
if (options.concurrency != null) {
|
|
193
|
-
if (typeof options.concurrency === 'number') {
|
|
194
|
-
this.requestHandle = (0, _vtils.asyncLimit)(async (data, ctx) => options.handle(data, ctx), {
|
|
195
|
-
concurrency: options.concurrency
|
|
196
|
-
});
|
|
197
|
-
} else {
|
|
198
|
-
const {
|
|
199
|
-
count,
|
|
200
|
-
groupBy
|
|
201
|
-
} = options.concurrency;
|
|
202
|
-
this.requestHandle = (0, _vtils.asyncLimit)(async (data, ctx) => options.handle(data, ctx), {
|
|
203
|
-
concurrency: count,
|
|
204
|
-
groupBy: groupBy
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
} else {
|
|
208
|
-
this.requestHandle = options.handle;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
static addHook(hook) {
|
|
212
|
-
this.hooks.push(hook);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
exports.Handler = Handler;
|
|
216
|
-
Handler.hooks = [];
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.HttpResponseHeader = exports.HttpRequestHeader = void 0;
|
|
5
|
-
// https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
|
|
6
|
-
/**
|
|
7
|
-
[...$0.querySelectorAll('tr')].map(v => v.querySelector('td:nth-child(1)').innerText.trim().split(',').map(name => name.replace(/\[.*?\]/g, '').trim()).map((name) => ({
|
|
8
|
-
name: name,
|
|
9
|
-
description: v.querySelector('td:nth-child(2)').innerText.replace(/\[.*?\]/g, '').trim(),
|
|
10
|
-
example: v.querySelector('td:nth-child(3)').innerText.trim(),
|
|
11
|
-
pascalName: name.replace(/\-/g, '_').toUpperCase()
|
|
12
|
-
}))).flat().map(item => `
|
|
13
|
-
${'/'}**
|
|
14
|
-
* ${item.description}
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ${item.example}
|
|
18
|
-
*${'/'}
|
|
19
|
-
${item.pascalName} = '${item.name}',
|
|
20
|
-
`).join('\n\n')
|
|
21
|
-
*/
|
|
22
|
-
let HttpRequestHeader = exports.HttpRequestHeader = /*#__PURE__*/function (HttpRequestHeader) {
|
|
23
|
-
HttpRequestHeader["A_IM"] = "A-IM";
|
|
24
|
-
HttpRequestHeader["ACCEPT"] = "Accept";
|
|
25
|
-
HttpRequestHeader["ACCEPT_CHARSET"] = "Accept-Charset";
|
|
26
|
-
HttpRequestHeader["ACCEPT_DATETIME"] = "Accept-Datetime";
|
|
27
|
-
HttpRequestHeader["ACCEPT_ENCODING"] = "Accept-Encoding";
|
|
28
|
-
HttpRequestHeader["ACCEPT_LANGUAGE"] = "Accept-Language";
|
|
29
|
-
HttpRequestHeader["ACCESS_CONTROL_REQUEST_METHOD"] = "Access-Control-Request-Method";
|
|
30
|
-
HttpRequestHeader["ACCESS_CONTROL_REQUEST_HEADERS"] = "Access-Control-Request-Headers";
|
|
31
|
-
HttpRequestHeader["AUTHORIZATION"] = "Authorization";
|
|
32
|
-
HttpRequestHeader["CACHE_CONTROL"] = "Cache-Control";
|
|
33
|
-
HttpRequestHeader["CONNECTION"] = "Connection";
|
|
34
|
-
HttpRequestHeader["CONTENT_ENCODING"] = "Content-Encoding";
|
|
35
|
-
HttpRequestHeader["CONTENT_LENGTH"] = "Content-Length";
|
|
36
|
-
HttpRequestHeader["CONTENT_MD5"] = "Content-MD5";
|
|
37
|
-
HttpRequestHeader["CONTENT_TYPE"] = "Content-Type";
|
|
38
|
-
HttpRequestHeader["COOKIE"] = "Cookie";
|
|
39
|
-
HttpRequestHeader["DATE"] = "Date";
|
|
40
|
-
HttpRequestHeader["EXPECT"] = "Expect";
|
|
41
|
-
HttpRequestHeader["FORWARDED"] = "Forwarded";
|
|
42
|
-
HttpRequestHeader["FROM"] = "From";
|
|
43
|
-
HttpRequestHeader["HOST"] = "Host";
|
|
44
|
-
HttpRequestHeader["HTTP2_SETTINGS"] = "HTTP2-Settings";
|
|
45
|
-
HttpRequestHeader["IF_MATCH"] = "If-Match";
|
|
46
|
-
HttpRequestHeader["IF_MODIFIED_SINCE"] = "If-Modified-Since";
|
|
47
|
-
HttpRequestHeader["IF_NONE_MATCH"] = "If-None-Match";
|
|
48
|
-
HttpRequestHeader["IF_RANGE"] = "If-Range";
|
|
49
|
-
HttpRequestHeader["IF_UNMODIFIED_SINCE"] = "If-Unmodified-Since";
|
|
50
|
-
HttpRequestHeader["MAX_FORWARDS"] = "Max-Forwards";
|
|
51
|
-
HttpRequestHeader["ORIGIN"] = "Origin";
|
|
52
|
-
HttpRequestHeader["PRAGMA"] = "Pragma";
|
|
53
|
-
HttpRequestHeader["PROXY_AUTHORIZATION"] = "Proxy-Authorization";
|
|
54
|
-
HttpRequestHeader["RANGE"] = "Range";
|
|
55
|
-
HttpRequestHeader["REFERER"] = "Referer";
|
|
56
|
-
HttpRequestHeader["TE"] = "TE";
|
|
57
|
-
HttpRequestHeader["TRAILER"] = "Trailer";
|
|
58
|
-
HttpRequestHeader["TRANSFER_ENCODING"] = "Transfer-Encoding";
|
|
59
|
-
HttpRequestHeader["USER_AGENT"] = "User-Agent";
|
|
60
|
-
HttpRequestHeader["UPGRADE"] = "Upgrade";
|
|
61
|
-
HttpRequestHeader["VIA"] = "Via";
|
|
62
|
-
HttpRequestHeader["WARNING"] = "Warning";
|
|
63
|
-
HttpRequestHeader["UPGRADE_INSECURE_REQUESTS"] = "Upgrade-Insecure-Requests";
|
|
64
|
-
HttpRequestHeader["X_REQUESTED_WITH"] = "X-Requested-With";
|
|
65
|
-
HttpRequestHeader["DNT"] = "DNT";
|
|
66
|
-
HttpRequestHeader["X_FORWARDED_FOR"] = "X-Forwarded-For";
|
|
67
|
-
HttpRequestHeader["X_FORWARDED_HOST"] = "X-Forwarded-Host";
|
|
68
|
-
HttpRequestHeader["X_FORWARDED_PROTO"] = "X-Forwarded-Proto";
|
|
69
|
-
HttpRequestHeader["FRONT_END_HTTPS"] = "Front-End-Https";
|
|
70
|
-
HttpRequestHeader["X_HTTP_METHOD_OVERRIDE"] = "X-Http-Method-Override";
|
|
71
|
-
HttpRequestHeader["X_ATT_DEVICEID"] = "X-ATT-DeviceId";
|
|
72
|
-
HttpRequestHeader["X_WAP_PROFILE"] = "X-Wap-Profile";
|
|
73
|
-
HttpRequestHeader["PROXY_CONNECTION"] = "Proxy-Connection";
|
|
74
|
-
HttpRequestHeader["X_UIDH"] = "X-UIDH";
|
|
75
|
-
HttpRequestHeader["X_CSRF_TOKEN"] = "X-Csrf-Token";
|
|
76
|
-
HttpRequestHeader["X_REQUEST_ID"] = "X-Request-ID";
|
|
77
|
-
HttpRequestHeader["X_CORRELATION_ID"] = "X-Correlation-ID";
|
|
78
|
-
HttpRequestHeader["SAVE_DATA"] = "Save-Data";
|
|
79
|
-
return HttpRequestHeader;
|
|
80
|
-
}({});
|
|
81
|
-
let HttpResponseHeader = exports.HttpResponseHeader = /*#__PURE__*/function (HttpResponseHeader) {
|
|
82
|
-
HttpResponseHeader["ACCESS_CONTROL_ALLOW_ORIGIN"] = "Access-Control-Allow-Origin";
|
|
83
|
-
HttpResponseHeader["ACCESS_CONTROL_ALLOW_CREDENTIALS"] = "Access-Control-Allow-Credentials";
|
|
84
|
-
HttpResponseHeader["ACCESS_CONTROL_EXPOSE_HEADERS"] = "Access-Control-Expose-Headers";
|
|
85
|
-
HttpResponseHeader["ACCESS_CONTROL_MAX_AGE"] = "Access-Control-Max-Age";
|
|
86
|
-
HttpResponseHeader["ACCESS_CONTROL_ALLOW_METHODS"] = "Access-Control-Allow-Methods";
|
|
87
|
-
HttpResponseHeader["ACCESS_CONTROL_ALLOW_HEADERS"] = "Access-Control-Allow-Headers";
|
|
88
|
-
HttpResponseHeader["ACCEPT_PATCH"] = "Accept-Patch";
|
|
89
|
-
HttpResponseHeader["ACCEPT_RANGES"] = "Accept-Ranges";
|
|
90
|
-
HttpResponseHeader["AGE"] = "Age";
|
|
91
|
-
HttpResponseHeader["ALLOW"] = "Allow";
|
|
92
|
-
HttpResponseHeader["ALT_SVC"] = "Alt-Svc";
|
|
93
|
-
HttpResponseHeader["CACHE_CONTROL"] = "Cache-Control";
|
|
94
|
-
HttpResponseHeader["CONNECTION"] = "Connection";
|
|
95
|
-
HttpResponseHeader["CONTENT_DISPOSITION"] = "Content-Disposition";
|
|
96
|
-
HttpResponseHeader["CONTENT_ENCODING"] = "Content-Encoding";
|
|
97
|
-
HttpResponseHeader["CONTENT_LANGUAGE"] = "Content-Language";
|
|
98
|
-
HttpResponseHeader["CONTENT_LENGTH"] = "Content-Length";
|
|
99
|
-
HttpResponseHeader["CONTENT_LOCATION"] = "Content-Location";
|
|
100
|
-
HttpResponseHeader["CONTENT_MD5"] = "Content-MD5";
|
|
101
|
-
HttpResponseHeader["CONTENT_RANGE"] = "Content-Range";
|
|
102
|
-
HttpResponseHeader["CONTENT_TYPE"] = "Content-Type";
|
|
103
|
-
HttpResponseHeader["DATE"] = "Date";
|
|
104
|
-
HttpResponseHeader["DELTA_BASE"] = "Delta-Base";
|
|
105
|
-
HttpResponseHeader["ETAG"] = "ETag";
|
|
106
|
-
HttpResponseHeader["EXPIRES"] = "Expires";
|
|
107
|
-
HttpResponseHeader["IM"] = "IM";
|
|
108
|
-
HttpResponseHeader["LAST_MODIFIED"] = "Last-Modified";
|
|
109
|
-
HttpResponseHeader["LINK"] = "Link";
|
|
110
|
-
HttpResponseHeader["LOCATION"] = "Location";
|
|
111
|
-
HttpResponseHeader["P3P"] = "P3P";
|
|
112
|
-
HttpResponseHeader["PRAGMA"] = "Pragma";
|
|
113
|
-
HttpResponseHeader["PROXY_AUTHENTICATE"] = "Proxy-Authenticate";
|
|
114
|
-
HttpResponseHeader["PUBLIC_KEY_PINS"] = "Public-Key-Pins";
|
|
115
|
-
HttpResponseHeader["RETRY_AFTER"] = "Retry-After";
|
|
116
|
-
HttpResponseHeader["SERVER"] = "Server";
|
|
117
|
-
HttpResponseHeader["SET_COOKIE"] = "Set-Cookie";
|
|
118
|
-
HttpResponseHeader["STRICT_TRANSPORT_SECURITY"] = "Strict-Transport-Security";
|
|
119
|
-
HttpResponseHeader["TRAILER"] = "Trailer";
|
|
120
|
-
HttpResponseHeader["TRANSFER_ENCODING"] = "Transfer-Encoding";
|
|
121
|
-
HttpResponseHeader["TK"] = "Tk";
|
|
122
|
-
HttpResponseHeader["UPGRADE"] = "Upgrade";
|
|
123
|
-
HttpResponseHeader["VARY"] = "Vary";
|
|
124
|
-
HttpResponseHeader["VIA"] = "Via";
|
|
125
|
-
HttpResponseHeader["WARNING"] = "Warning";
|
|
126
|
-
HttpResponseHeader["WWW_AUTHENTICATE"] = "WWW-Authenticate";
|
|
127
|
-
HttpResponseHeader["X_FRAME_OPTIONS"] = "X-Frame-Options";
|
|
128
|
-
HttpResponseHeader["CONTENT_SECURITY_POLICY"] = "Content-Security-Policy";
|
|
129
|
-
HttpResponseHeader["X_CONTENT_SECURITY_POLICY"] = "X-Content-Security-Policy";
|
|
130
|
-
HttpResponseHeader["X_WEBKIT_CSP"] = "X-WebKit-CSP";
|
|
131
|
-
HttpResponseHeader["REFRESH"] = "Refresh";
|
|
132
|
-
HttpResponseHeader["STATUS"] = "Status";
|
|
133
|
-
HttpResponseHeader["TIMING_ALLOW_ORIGIN"] = "Timing-Allow-Origin";
|
|
134
|
-
HttpResponseHeader["X_CONTENT_DURATION"] = "X-Content-Duration";
|
|
135
|
-
HttpResponseHeader["X_CONTENT_TYPE_OPTIONS"] = "X-Content-Type-Options";
|
|
136
|
-
HttpResponseHeader["X_POWERED_BY"] = "X-Powered-By";
|
|
137
|
-
HttpResponseHeader["X_REQUEST_ID"] = "X-Request-ID";
|
|
138
|
-
HttpResponseHeader["X_CORRELATION_ID"] = "X-Correlation-ID";
|
|
139
|
-
HttpResponseHeader["X_UA_COMPATIBLE"] = "X-UA-Compatible";
|
|
140
|
-
HttpResponseHeader["X_XSS_PROTECTION"] = "X-XSS-Protection";
|
|
141
|
-
return HttpResponseHeader;
|
|
142
|
-
}({});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.HandlerMethodToHttpMethod = void 0;
|
|
5
|
-
const HandlerMethodToHttpMethod = exports.HandlerMethodToHttpMethod = {
|
|
6
|
-
GET: 'GET',
|
|
7
|
-
POST: 'POST',
|
|
8
|
-
FILE: 'POST',
|
|
9
|
-
WS: 'GET',
|
|
10
|
-
XML: 'POST',
|
|
11
|
-
ANY: 'POST'
|
|
12
|
-
};
|