phecda-server 5.0.2 → 5.1.1
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 +4 -102
- package/bin/cli.mjs +17 -14
- package/dist/{chunk-RCTOVYZY.mjs → chunk-2HKQPZDT.mjs} +1 -1
- package/dist/{chunk-BXLBWRHS.js → chunk-3BV2GRS7.js} +38 -38
- package/dist/{chunk-AB4OX3WV.mjs → chunk-665MB62T.mjs} +127 -99
- package/dist/{chunk-YERBWZCS.js → chunk-FSBD5R22.js} +180 -152
- package/dist/{chunk-F5YWXY5W.js → chunk-HMPTPTFL.js} +17 -17
- package/dist/{chunk-W5EOVGQD.mjs → chunk-UU6RHGRF.mjs} +2 -2
- package/dist/{chunk-ITTD2GBR.mjs → chunk-VLV3AO3H.mjs} +7 -19
- package/dist/{chunk-YR5Q5F2K.js → chunk-ZP7HNASU.js} +7 -19
- package/dist/{core-fd134ffa.d.ts → core-39f27fe8.d.ts} +4 -3
- package/dist/{helper-73e8d2f0.d.ts → helper-6133f78f.d.ts} +1 -1
- package/dist/{helper-f29f082f.d.ts → helper-fcbf6aa8.d.ts} +4 -3
- package/dist/index.d.ts +27 -32
- package/dist/index.js +44 -40
- package/dist/index.mjs +14 -10
- package/dist/rpc/bullmq/index.d.ts +10 -6
- package/dist/rpc/bullmq/index.js +32 -53
- package/dist/rpc/bullmq/index.mjs +26 -47
- package/dist/rpc/kafka/index.d.ts +10 -4
- package/dist/rpc/kafka/index.js +20 -37
- package/dist/rpc/kafka/index.mjs +15 -32
- package/dist/rpc/nats/index.d.ts +2 -2
- package/dist/rpc/nats/index.js +20 -34
- package/dist/rpc/nats/index.mjs +13 -27
- package/dist/rpc/rabbitmq/index.d.ts +2 -2
- package/dist/rpc/rabbitmq/index.js +23 -37
- package/dist/rpc/rabbitmq/index.mjs +14 -28
- package/dist/rpc/redis/index.d.ts +10 -4
- package/dist/rpc/redis/index.js +23 -37
- package/dist/rpc/redis/index.mjs +16 -30
- package/dist/server/elysia/index.d.ts +4 -3
- package/dist/server/elysia/index.js +77 -94
- package/dist/server/elysia/index.mjs +74 -91
- package/dist/server/express/index.d.ts +5 -4
- package/dist/server/express/index.js +79 -93
- package/dist/server/express/index.mjs +77 -91
- package/dist/server/fastify/index.d.ts +8 -5
- package/dist/server/fastify/index.js +83 -102
- package/dist/server/fastify/index.mjs +79 -98
- package/dist/server/h3/index.d.ts +5 -4
- package/dist/server/h3/index.js +81 -97
- package/dist/server/h3/index.mjs +80 -96
- package/dist/server/hono/index.d.ts +5 -4
- package/dist/server/hono/index.js +73 -90
- package/dist/server/hono/index.mjs +72 -89
- package/dist/server/hyper-express/index.d.ts +6 -5
- package/dist/server/hyper-express/index.js +78 -96
- package/dist/server/hyper-express/index.mjs +77 -95
- package/dist/server/koa/index.d.ts +5 -4
- package/dist/server/koa/index.js +79 -92
- package/dist/server/koa/index.mjs +76 -89
- package/dist/test.d.ts +1 -1
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +9 -8
- package/register/loader.mjs +19 -5
|
@@ -1,131 +1,112 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk3BV2GRS7js = require('../../chunk-3BV2GRS7.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkFSBD5R22js = require('../../chunk-FSBD5R22.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
|
|
14
14
|
|
|
15
15
|
// src/server/fastify/bind.ts
|
|
16
16
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
17
17
|
var debug = _debug2.default.call(void 0, "phecda-server/fastify");
|
|
18
|
-
function bind(data, opts = {}) {
|
|
19
|
-
const { globalGuards, globalInterceptors,
|
|
20
|
-
route: "/__PHECDA_SERVER__",
|
|
21
|
-
plugins: [],
|
|
22
|
-
...opts
|
|
23
|
-
};
|
|
18
|
+
function bind(fastify, data, opts = {}) {
|
|
19
|
+
const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe, fastifyOpts } = opts;
|
|
24
20
|
const { moduleMap, meta } = data;
|
|
25
|
-
const metaMap =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for (const item of meta) {
|
|
29
|
-
const { tag, func, controller, http } = item.data;
|
|
30
|
-
if (controller !== "http" || !_optionalChain([http, 'optionalAccess', _2 => _2.type]))
|
|
31
|
-
continue;
|
|
21
|
+
const metaMap = _chunkFSBD5R22js.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
22
|
+
const { controller, http, func, tag } = meta2.data;
|
|
23
|
+
if (controller === "http" && _optionalChain([http, 'optionalAccess', _2 => _2.type])) {
|
|
32
24
|
debug(`register method "${func}" in module "${tag}"`);
|
|
33
|
-
|
|
34
|
-
metaMap.get(tag)[func] = item;
|
|
35
|
-
else
|
|
36
|
-
metaMap.set(tag, {
|
|
37
|
-
[func]: item
|
|
38
|
-
});
|
|
25
|
+
return true;
|
|
39
26
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
});
|
|
28
|
+
_chunkFSBD5R22js.detectAopDep.call(void 0, meta, {
|
|
29
|
+
plugins: [
|
|
30
|
+
...globalPlugins,
|
|
31
|
+
...parallelPlugins
|
|
32
|
+
],
|
|
44
33
|
guards: globalGuards,
|
|
45
34
|
interceptors: globalInterceptors
|
|
46
35
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
guards: globalGuards,
|
|
52
|
-
interceptors: globalInterceptors
|
|
36
|
+
fastify.register((fastify2, _, done) => {
|
|
37
|
+
_chunkFSBD5R22js.Context.usePlugin(globalPlugins, "fastify").forEach((p) => {
|
|
38
|
+
p[Symbol.for("skip-override")] = true;
|
|
39
|
+
fastify2.register(p);
|
|
53
40
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
plugins.forEach((p) => {
|
|
59
|
-
const plugin = _chunkYERBWZCSjs.Context.usePlugin([
|
|
60
|
-
p
|
|
61
|
-
])[0];
|
|
62
|
-
if (plugin) {
|
|
63
|
-
plugin[Symbol.for("skip-override")] = true;
|
|
64
|
-
fastify2.register(plugin);
|
|
65
|
-
}
|
|
41
|
+
fastify2.register((fastify3, _opts, done2) => {
|
|
42
|
+
_chunkFSBD5R22js.Context.usePlugin(parallelPlugins, "fastify").forEach((p) => {
|
|
43
|
+
p[Symbol.for("skip-override")] = true;
|
|
44
|
+
fastify3.register(p);
|
|
66
45
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
46
|
+
if (parallelRoute) {
|
|
47
|
+
fastify3.post(parallelRoute, async (req, res) => {
|
|
48
|
+
const { body } = req;
|
|
49
|
+
async function errorHandler(e) {
|
|
50
|
+
const error = await _chunkFSBD5R22js.Context.filterRecord.default(e);
|
|
51
|
+
return res.status(error.status).send(error);
|
|
52
|
+
}
|
|
53
|
+
_chunkZP7HNASUjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
54
|
+
if (!Array.isArray(body))
|
|
55
|
+
return errorHandler(new (0, _chunkFSBD5R22js.BadRequestException)("data format should be an array"));
|
|
56
|
+
try {
|
|
57
|
+
return Promise.all(body.map((item, i) => {
|
|
58
|
+
return new Promise(async (resolve) => {
|
|
59
|
+
const { tag, func } = item;
|
|
60
|
+
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
61
|
+
if (!metaMap.has(tag))
|
|
62
|
+
return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
63
|
+
const meta2 = metaMap.get(tag)[func];
|
|
64
|
+
if (!meta2)
|
|
65
|
+
return resolve(await _chunkFSBD5R22js.Context.filterRecord.default(new (0, _chunkFSBD5R22js.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
66
|
+
const { data: { params } } = meta2;
|
|
67
|
+
const contextData = {
|
|
68
|
+
type: "fastify",
|
|
69
|
+
parallel: true,
|
|
70
|
+
request: req,
|
|
71
|
+
index: i,
|
|
72
|
+
meta: meta2,
|
|
73
|
+
response: res,
|
|
74
|
+
moduleMap,
|
|
75
|
+
tag,
|
|
76
|
+
func,
|
|
77
|
+
app: fastify3,
|
|
78
|
+
..._chunkFSBD5R22js.argToReq.call(void 0, params, item.args, req.headers)
|
|
79
|
+
};
|
|
80
|
+
const context = new (0, _chunkFSBD5R22js.Context)(contextData);
|
|
81
|
+
context.run({
|
|
82
|
+
globalGuards,
|
|
83
|
+
globalInterceptors,
|
|
84
|
+
globalFilter,
|
|
85
|
+
globalPipe
|
|
86
|
+
}, resolve, resolve);
|
|
87
|
+
});
|
|
88
|
+
})).then((ret) => {
|
|
89
|
+
res.send(ret);
|
|
107
90
|
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
});
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return errorHandler(e);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
115
96
|
done2();
|
|
116
97
|
});
|
|
117
98
|
for (const [tag, record] of metaMap) {
|
|
118
99
|
for (const func in record) {
|
|
119
100
|
const meta2 = metaMap.get(tag)[func];
|
|
120
|
-
const { data: { plugins
|
|
101
|
+
const { data: { plugins, define, http } } = meta2;
|
|
121
102
|
if (!_optionalChain([http, 'optionalAccess', _3 => _3.type]))
|
|
122
103
|
continue;
|
|
123
|
-
|
|
124
|
-
|
|
104
|
+
fastify2.register((fastify3, _opts, done2) => {
|
|
105
|
+
_chunkFSBD5R22js.Context.usePlugin(plugins, "fastify").forEach((p) => {
|
|
125
106
|
p[Symbol.for("skip-override")] = true;
|
|
126
|
-
|
|
107
|
+
fastify3.register(p);
|
|
127
108
|
});
|
|
128
|
-
|
|
109
|
+
fastify3[http.type](http.prefix + http.route, _optionalChain([define, 'optionalAccess', _4 => _4.fastify]) || {}, async (req, res) => {
|
|
129
110
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
130
111
|
const contextData = {
|
|
131
112
|
type: "fastify",
|
|
@@ -139,9 +120,9 @@ function bind(data, opts = {}) {
|
|
|
139
120
|
body: req.body,
|
|
140
121
|
params: req.params,
|
|
141
122
|
headers: req.headers,
|
|
142
|
-
app:
|
|
123
|
+
app: fastify3
|
|
143
124
|
};
|
|
144
|
-
const context = new (0,
|
|
125
|
+
const context = new (0, _chunkFSBD5R22js.Context)(contextData);
|
|
145
126
|
if (http.headers) {
|
|
146
127
|
for (const name in http.headers)
|
|
147
128
|
res.header(name, http.headers[name]);
|
|
@@ -166,13 +147,13 @@ function bind(data, opts = {}) {
|
|
|
166
147
|
}
|
|
167
148
|
}
|
|
168
149
|
done();
|
|
169
|
-
};
|
|
150
|
+
}, fastifyOpts);
|
|
170
151
|
}
|
|
171
|
-
|
|
152
|
+
_chunkZP7HNASUjs.__name.call(void 0, bind, "bind");
|
|
172
153
|
function Fastify(opts) {
|
|
173
|
-
return
|
|
154
|
+
return _chunk3BV2GRS7js.Define.call(void 0, "fastify", opts);
|
|
174
155
|
}
|
|
175
|
-
|
|
156
|
+
_chunkZP7HNASUjs.__name.call(void 0, Fastify, "Fastify");
|
|
176
157
|
|
|
177
158
|
|
|
178
159
|
|
|
@@ -1,131 +1,112 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Define
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-UU6RHGRF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BadRequestException,
|
|
6
6
|
Context,
|
|
7
|
-
HMR,
|
|
8
7
|
argToReq,
|
|
8
|
+
createControllerMetaMap,
|
|
9
9
|
detectAopDep
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-665MB62T.mjs";
|
|
11
11
|
import {
|
|
12
12
|
__name
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-VLV3AO3H.mjs";
|
|
14
14
|
|
|
15
15
|
// src/server/fastify/bind.ts
|
|
16
16
|
import Debug from "debug";
|
|
17
17
|
var debug = Debug("phecda-server/fastify");
|
|
18
|
-
function bind(data, opts = {}) {
|
|
19
|
-
const { globalGuards, globalInterceptors,
|
|
20
|
-
route: "/__PHECDA_SERVER__",
|
|
21
|
-
plugins: [],
|
|
22
|
-
...opts
|
|
23
|
-
};
|
|
18
|
+
function bind(fastify, data, opts = {}) {
|
|
19
|
+
const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe, fastifyOpts } = opts;
|
|
24
20
|
const { moduleMap, meta } = data;
|
|
25
|
-
const metaMap =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for (const item of meta) {
|
|
29
|
-
const { tag, func, controller, http } = item.data;
|
|
30
|
-
if (controller !== "http" || !http?.type)
|
|
31
|
-
continue;
|
|
21
|
+
const metaMap = createControllerMetaMap(meta, (meta2) => {
|
|
22
|
+
const { controller, http, func, tag } = meta2.data;
|
|
23
|
+
if (controller === "http" && http?.type) {
|
|
32
24
|
debug(`register method "${func}" in module "${tag}"`);
|
|
33
|
-
|
|
34
|
-
metaMap.get(tag)[func] = item;
|
|
35
|
-
else
|
|
36
|
-
metaMap.set(tag, {
|
|
37
|
-
[func]: item
|
|
38
|
-
});
|
|
25
|
+
return true;
|
|
39
26
|
}
|
|
40
|
-
}
|
|
41
|
-
__name(handleMeta, "handleMeta");
|
|
27
|
+
});
|
|
42
28
|
detectAopDep(meta, {
|
|
43
|
-
plugins
|
|
29
|
+
plugins: [
|
|
30
|
+
...globalPlugins,
|
|
31
|
+
...parallelPlugins
|
|
32
|
+
],
|
|
44
33
|
guards: globalGuards,
|
|
45
34
|
interceptors: globalInterceptors
|
|
46
35
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
guards: globalGuards,
|
|
52
|
-
interceptors: globalInterceptors
|
|
36
|
+
fastify.register((fastify2, _, done) => {
|
|
37
|
+
Context.usePlugin(globalPlugins, "fastify").forEach((p) => {
|
|
38
|
+
p[Symbol.for("skip-override")] = true;
|
|
39
|
+
fastify2.register(p);
|
|
53
40
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
plugins.forEach((p) => {
|
|
59
|
-
const plugin = Context.usePlugin([
|
|
60
|
-
p
|
|
61
|
-
])[0];
|
|
62
|
-
if (plugin) {
|
|
63
|
-
plugin[Symbol.for("skip-override")] = true;
|
|
64
|
-
fastify2.register(plugin);
|
|
65
|
-
}
|
|
41
|
+
fastify2.register((fastify3, _opts, done2) => {
|
|
42
|
+
Context.usePlugin(parallelPlugins, "fastify").forEach((p) => {
|
|
43
|
+
p[Symbol.for("skip-override")] = true;
|
|
44
|
+
fastify3.register(p);
|
|
66
45
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
46
|
+
if (parallelRoute) {
|
|
47
|
+
fastify3.post(parallelRoute, async (req, res) => {
|
|
48
|
+
const { body } = req;
|
|
49
|
+
async function errorHandler(e) {
|
|
50
|
+
const error = await Context.filterRecord.default(e);
|
|
51
|
+
return res.status(error.status).send(error);
|
|
52
|
+
}
|
|
53
|
+
__name(errorHandler, "errorHandler");
|
|
54
|
+
if (!Array.isArray(body))
|
|
55
|
+
return errorHandler(new BadRequestException("data format should be an array"));
|
|
56
|
+
try {
|
|
57
|
+
return Promise.all(body.map((item, i) => {
|
|
58
|
+
return new Promise(async (resolve) => {
|
|
59
|
+
const { tag, func } = item;
|
|
60
|
+
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
61
|
+
if (!metaMap.has(tag))
|
|
62
|
+
return resolve(await Context.filterRecord.default(new BadRequestException(`module "${tag}" doesn't exist`)));
|
|
63
|
+
const meta2 = metaMap.get(tag)[func];
|
|
64
|
+
if (!meta2)
|
|
65
|
+
return resolve(await Context.filterRecord.default(new BadRequestException(`"${func}" in "${tag}" doesn't exist`)));
|
|
66
|
+
const { data: { params } } = meta2;
|
|
67
|
+
const contextData = {
|
|
68
|
+
type: "fastify",
|
|
69
|
+
parallel: true,
|
|
70
|
+
request: req,
|
|
71
|
+
index: i,
|
|
72
|
+
meta: meta2,
|
|
73
|
+
response: res,
|
|
74
|
+
moduleMap,
|
|
75
|
+
tag,
|
|
76
|
+
func,
|
|
77
|
+
app: fastify3,
|
|
78
|
+
...argToReq(params, item.args, req.headers)
|
|
79
|
+
};
|
|
80
|
+
const context = new Context(contextData);
|
|
81
|
+
context.run({
|
|
82
|
+
globalGuards,
|
|
83
|
+
globalInterceptors,
|
|
84
|
+
globalFilter,
|
|
85
|
+
globalPipe
|
|
86
|
+
}, resolve, resolve);
|
|
87
|
+
});
|
|
88
|
+
})).then((ret) => {
|
|
89
|
+
res.send(ret);
|
|
107
90
|
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
});
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return errorHandler(e);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
115
96
|
done2();
|
|
116
97
|
});
|
|
117
98
|
for (const [tag, record] of metaMap) {
|
|
118
99
|
for (const func in record) {
|
|
119
100
|
const meta2 = metaMap.get(tag)[func];
|
|
120
|
-
const { data: { plugins
|
|
101
|
+
const { data: { plugins, define, http } } = meta2;
|
|
121
102
|
if (!http?.type)
|
|
122
103
|
continue;
|
|
123
|
-
|
|
124
|
-
Context.usePlugin(
|
|
104
|
+
fastify2.register((fastify3, _opts, done2) => {
|
|
105
|
+
Context.usePlugin(plugins, "fastify").forEach((p) => {
|
|
125
106
|
p[Symbol.for("skip-override")] = true;
|
|
126
|
-
|
|
107
|
+
fastify3.register(p);
|
|
127
108
|
});
|
|
128
|
-
|
|
109
|
+
fastify3[http.type](http.prefix + http.route, define?.fastify || {}, async (req, res) => {
|
|
129
110
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
130
111
|
const contextData = {
|
|
131
112
|
type: "fastify",
|
|
@@ -139,7 +120,7 @@ function bind(data, opts = {}) {
|
|
|
139
120
|
body: req.body,
|
|
140
121
|
params: req.params,
|
|
141
122
|
headers: req.headers,
|
|
142
|
-
app:
|
|
123
|
+
app: fastify3
|
|
143
124
|
};
|
|
144
125
|
const context = new Context(contextData);
|
|
145
126
|
if (http.headers) {
|
|
@@ -166,7 +147,7 @@ function bind(data, opts = {}) {
|
|
|
166
147
|
}
|
|
167
148
|
}
|
|
168
149
|
done();
|
|
169
|
-
};
|
|
150
|
+
}, fastifyOpts);
|
|
170
151
|
}
|
|
171
152
|
__name(bind, "bind");
|
|
172
153
|
function Fastify(opts) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H3Event, Router } from 'h3';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { a as HttpContext, H as HttpOptions } from '../../helper-
|
|
1
|
+
import { H3Event, Router, _RequestMiddleware } from 'h3';
|
|
2
|
+
import { F as Factory } from '../../core-39f27fe8.js';
|
|
3
|
+
import { a as HttpContext, H as HttpOptions } from '../../helper-fcbf6aa8.js';
|
|
4
4
|
import 'phecda-core';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ interface H3Ctx extends HttpContext {
|
|
|
9
9
|
event: H3Event;
|
|
10
10
|
app: Router;
|
|
11
11
|
}
|
|
12
|
+
type Plugin = _RequestMiddleware;
|
|
12
13
|
declare function bind(router: Router, data: Awaited<ReturnType<typeof Factory>>, opts?: HttpOptions): void;
|
|
13
14
|
|
|
14
|
-
export { H3Ctx, bind };
|
|
15
|
+
export { H3Ctx, Plugin, bind };
|