phecda-server 5.3.3 → 6.0.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/dist/chunk-F3W3NN7F.mjs +238 -0
- package/dist/{chunk-ECSI4QBK.mjs → chunk-HDQAT2IM.mjs} +55 -65
- package/dist/{chunk-3D7AROG2.js → chunk-LYEZ6RGX.js} +54 -64
- package/dist/{chunk-RZ7IXJYQ.js → chunk-TZYATAJX.js} +12 -30
- package/dist/chunk-XCND2QW3.js +238 -0
- package/dist/{chunk-3IPYLGY2.mjs → chunk-YUXERDQ6.mjs} +13 -31
- package/dist/{core-dx9E5x2N.d.ts → core-Blq8frmr.d.ts} +4 -3
- package/dist/{core-Bc2ENEHX.d.mts → core-D2oL8Ge0.d.mts} +4 -3
- package/dist/helper.js +2 -2
- package/dist/helper.mjs +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +29 -27
- package/dist/index.mjs +9 -7
- package/dist/rpc/bullmq/index.d.mts +1 -1
- package/dist/rpc/bullmq/index.d.ts +1 -1
- package/dist/rpc/bullmq/index.js +6 -6
- package/dist/rpc/bullmq/index.mjs +1 -1
- package/dist/rpc/kafka/index.d.mts +1 -1
- package/dist/rpc/kafka/index.d.ts +1 -1
- package/dist/rpc/kafka/index.js +5 -5
- package/dist/rpc/kafka/index.mjs +1 -1
- package/dist/rpc/nats/index.d.mts +1 -1
- package/dist/rpc/nats/index.d.ts +1 -1
- package/dist/rpc/nats/index.js +5 -5
- package/dist/rpc/nats/index.mjs +1 -1
- package/dist/rpc/rabbitmq/index.d.mts +1 -1
- package/dist/rpc/rabbitmq/index.d.ts +1 -1
- package/dist/rpc/rabbitmq/index.js +6 -6
- package/dist/rpc/rabbitmq/index.mjs +1 -1
- package/dist/rpc/redis/index.d.mts +1 -1
- package/dist/rpc/redis/index.d.ts +1 -1
- package/dist/rpc/redis/index.js +6 -6
- package/dist/rpc/redis/index.mjs +1 -1
- package/dist/server/elysia/index.d.mts +1 -1
- package/dist/server/elysia/index.d.ts +1 -1
- package/dist/server/elysia/index.js +15 -15
- package/dist/server/elysia/index.mjs +2 -2
- package/dist/server/express/index.d.mts +1 -1
- package/dist/server/express/index.d.ts +1 -1
- package/dist/server/express/index.js +14 -14
- package/dist/server/express/index.mjs +1 -1
- package/dist/server/fastify/index.d.mts +1 -1
- package/dist/server/fastify/index.d.ts +1 -1
- package/dist/server/fastify/index.js +15 -15
- package/dist/server/fastify/index.mjs +2 -2
- package/dist/server/h3/index.d.mts +1 -1
- package/dist/server/h3/index.d.ts +1 -1
- package/dist/server/h3/index.js +12 -12
- package/dist/server/h3/index.mjs +1 -1
- package/dist/server/hono/index.d.mts +1 -1
- package/dist/server/hono/index.d.ts +1 -1
- package/dist/server/hono/index.js +13 -13
- package/dist/server/hono/index.mjs +1 -1
- package/dist/server/hyper-express/index.d.mts +1 -1
- package/dist/server/hyper-express/index.d.ts +1 -1
- package/dist/server/hyper-express/index.js +13 -13
- package/dist/server/hyper-express/index.mjs +1 -1
- package/dist/server/koa/index.d.mts +1 -1
- package/dist/server/koa/index.d.ts +1 -1
- package/dist/server/koa/index.js +14 -14
- package/dist/server/koa/index.mjs +1 -1
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-2HVTWYS2.js +0 -279
- package/dist/chunk-SXOZVIKW.mjs +0 -279
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
3
|
import { H as HttpContext, a as HttpOptions } from '../../types-Dgxirc9f.mjs';
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
4
|
+
import { F as Factory } from '../../core-D2oL8Ge0.mjs';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '../../types-BlIBlnVT.mjs';
|
|
7
7
|
import 'phecda-core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Router, { RouterParamContext } from '@koa/router';
|
|
2
2
|
import { DefaultContext, DefaultState } from 'koa';
|
|
3
3
|
import { H as HttpContext, a as HttpOptions } from '../../types-BCJhmpQh.js';
|
|
4
|
-
import { F as Factory } from '../../core-
|
|
4
|
+
import { F as Factory } from '../../core-Blq8frmr.js';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '../../types-BlIBlnVT.js';
|
|
7
7
|
import 'phecda-core';
|
package/dist/server/koa/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkTZYATAJXjs = require('../../chunk-TZYATAJX.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkGHFSIZUOjs = require('../../chunk-GHFSIZUO.js');
|
|
@@ -17,14 +17,14 @@ function bind(router, data, opts = {}) {
|
|
|
17
17
|
const { globalGuards, globalInterceptors, parallelRoute = "/__PHECDA_SERVER__", globalPlugins = [], parallelPlugins = [], globalFilter, globalPipe } = opts;
|
|
18
18
|
const { moduleMap, meta } = data;
|
|
19
19
|
const originStack = router.stack.slice(0, router.stack.length);
|
|
20
|
-
const metaMap =
|
|
20
|
+
const metaMap = _chunkTZYATAJXjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
21
21
|
const { controller, http, func, tag } = meta2.data;
|
|
22
22
|
if (controller === "http" && _optionalChain([http, 'optionalAccess', _ => _.type])) {
|
|
23
23
|
debug(`register method "${func}" in module "${tag}"`);
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
_chunkTZYATAJXjs.detectAopDep.call(void 0, meta, {
|
|
28
28
|
plugins: [
|
|
29
29
|
...globalPlugins,
|
|
30
30
|
...parallelPlugins
|
|
@@ -34,25 +34,25 @@ function bind(router, data, opts = {}) {
|
|
|
34
34
|
});
|
|
35
35
|
registerRoute();
|
|
36
36
|
async function registerRoute() {
|
|
37
|
-
|
|
37
|
+
_chunkTZYATAJXjs.Context.usePlugin(globalPlugins, "koa").forEach((p) => router.use(p));
|
|
38
38
|
if (parallelRoute) {
|
|
39
|
-
router.post(parallelRoute, ...
|
|
39
|
+
router.post(parallelRoute, ..._chunkTZYATAJXjs.Context.usePlugin(parallelPlugins, "koa"), async (ctx, next) => {
|
|
40
40
|
const { body } = ctx.request;
|
|
41
41
|
async function errorHandler(e) {
|
|
42
|
-
const error = await
|
|
42
|
+
const error = await _chunkTZYATAJXjs.Context.filterRecord.default(e);
|
|
43
43
|
ctx.status = error.status;
|
|
44
44
|
ctx.body = error;
|
|
45
45
|
}
|
|
46
46
|
_chunkGHFSIZUOjs.__name.call(void 0, errorHandler, "errorHandler");
|
|
47
|
-
if (!Array.isArray(body)) return errorHandler(new (0,
|
|
47
|
+
if (!Array.isArray(body)) return errorHandler(new (0, _chunkTZYATAJXjs.BadRequestException)("data format should be an array"));
|
|
48
48
|
try {
|
|
49
49
|
return Promise.all(body.map((item, i) => {
|
|
50
50
|
return new Promise(async (resolve) => {
|
|
51
51
|
const { tag, func } = item;
|
|
52
52
|
debug(`(parallel)invoke method "${func}" in module "${tag}"`);
|
|
53
|
-
if (!metaMap.has(tag)) return resolve(await
|
|
53
|
+
if (!metaMap.has(tag)) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`module "${tag}" doesn't exist`)));
|
|
54
54
|
const meta2 = metaMap.get(tag)[func];
|
|
55
|
-
if (!meta2) return resolve(await
|
|
55
|
+
if (!meta2) return resolve(await _chunkTZYATAJXjs.Context.filterRecord.default(new (0, _chunkTZYATAJXjs.BadRequestException)(`"${func}" in "${tag}" doesn't exist`)));
|
|
56
56
|
const { data: { params } } = meta2;
|
|
57
57
|
const contextData = {
|
|
58
58
|
type: "koa",
|
|
@@ -63,7 +63,7 @@ function bind(router, data, opts = {}) {
|
|
|
63
63
|
parallel: true,
|
|
64
64
|
next,
|
|
65
65
|
app: router,
|
|
66
|
-
...
|
|
66
|
+
..._chunkTZYATAJXjs.argToReq.call(void 0, params, item.args, ctx.headers),
|
|
67
67
|
tag,
|
|
68
68
|
func,
|
|
69
69
|
getCookie: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (key) => ctx.cookies.get(key), "getCookie"),
|
|
@@ -75,7 +75,7 @@ function bind(router, data, opts = {}) {
|
|
|
75
75
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
76
76
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
|
|
77
77
|
};
|
|
78
|
-
const context = new (0,
|
|
78
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
79
79
|
context.run({
|
|
80
80
|
globalGuards,
|
|
81
81
|
globalInterceptors,
|
|
@@ -96,7 +96,7 @@ function bind(router, data, opts = {}) {
|
|
|
96
96
|
const meta2 = metaMap.get(tag)[func];
|
|
97
97
|
const { data: { plugins, http } } = meta2;
|
|
98
98
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) continue;
|
|
99
|
-
router[http.type](http.prefix + http.route, ...
|
|
99
|
+
router[http.type](http.prefix + http.route, ..._chunkTZYATAJXjs.Context.usePlugin(plugins, "koa"), async (ctx, next) => {
|
|
100
100
|
debug(`invoke method "${func}" in module "${tag}"`);
|
|
101
101
|
const contextData = {
|
|
102
102
|
type: "koa",
|
|
@@ -120,7 +120,7 @@ function bind(router, data, opts = {}) {
|
|
|
120
120
|
setResHeaders: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (headers) => ctx.set(headers), "setResHeaders"),
|
|
121
121
|
setResStatus: /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (status) => ctx.status = status, "setResStatus")
|
|
122
122
|
};
|
|
123
|
-
const context = new (0,
|
|
123
|
+
const context = new (0, _chunkTZYATAJXjs.Context)(contextData);
|
|
124
124
|
if (http.headers) ctx.set(http.headers);
|
|
125
125
|
await context.run({
|
|
126
126
|
globalGuards,
|
|
@@ -140,7 +140,7 @@ function bind(router, data, opts = {}) {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
_chunkGHFSIZUOjs.__name.call(void 0, registerRoute, "registerRoute");
|
|
143
|
-
|
|
143
|
+
_chunkTZYATAJXjs.HMR.call(void 0, async () => {
|
|
144
144
|
router.stack = originStack;
|
|
145
145
|
registerRoute();
|
|
146
146
|
});
|
package/dist/test.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as supertest from 'supertest';
|
|
|
2
2
|
import { Test } from 'supertest';
|
|
3
3
|
import { Server } from 'node:http';
|
|
4
4
|
import { Construct } from 'phecda-core';
|
|
5
|
-
import { F as Factory } from './core-
|
|
5
|
+
import { F as Factory } from './core-D2oL8Ge0.mjs';
|
|
6
6
|
import { P as PickFunc } from './types-BlIBlnVT.mjs';
|
|
7
7
|
|
|
8
8
|
declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
|
package/dist/test.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as supertest from 'supertest';
|
|
|
2
2
|
import { Test } from 'supertest';
|
|
3
3
|
import { Server } from 'node:http';
|
|
4
4
|
import { Construct } from 'phecda-core';
|
|
5
|
-
import { F as Factory } from './core-
|
|
5
|
+
import { F as Factory } from './core-Blq8frmr.js';
|
|
6
6
|
import { P as PickFunc } from './types-BlIBlnVT.js';
|
|
7
7
|
|
|
8
8
|
declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
|
package/dist/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
@@ -8,7 +8,7 @@ var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
|
8
8
|
// src/test.ts
|
|
9
9
|
var _phecdacore = require('phecda-core');
|
|
10
10
|
async function TestFactory(...Modules) {
|
|
11
|
-
const { moduleMap, modelMap } = await
|
|
11
|
+
const { moduleMap, modelMap } = await _chunkLYEZ6RGXjs.Factory.call(void 0, Modules);
|
|
12
12
|
return {
|
|
13
13
|
get(Model) {
|
|
14
14
|
const tag = _phecdacore.getTag.call(void 0, Model);
|
package/dist/test.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
|
|
5
5
|
"author": "fgsreally",
|
|
6
6
|
"license": "MIT",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"picocolors": "^1.0.0",
|
|
147
147
|
"reflect-metadata": "^0.1.13",
|
|
148
148
|
"ts-mixer": "^6.0.4",
|
|
149
|
-
"phecda-core": "
|
|
149
|
+
"phecda-core": "4.0.0"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
152
|
"@koa/router": "^12.0.1",
|
package/dist/chunk-2HVTWYS2.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkRZ7IXJYQjs = require('./chunk-RZ7IXJYQ.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkGHFSIZUOjs = require('./chunk-GHFSIZUO.js');
|
|
8
|
-
|
|
9
|
-
// src/decorators/param.ts
|
|
10
|
-
var _phecdacore = require('phecda-core');
|
|
11
|
-
function BaseParam(data) {
|
|
12
|
-
return (target, k, index) => {
|
|
13
|
-
if (!k) return;
|
|
14
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
15
|
-
if (!state.params) state.params = [
|
|
16
|
-
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _ => _.params]) || []
|
|
17
|
-
].map(_chunkRZ7IXJYQjs.shallowClone);
|
|
18
|
-
const existItem = state.params.find((item) => item.index === index);
|
|
19
|
-
if (existItem) Object.assign(existItem, data);
|
|
20
|
-
else state.params.push({
|
|
21
|
-
...data,
|
|
22
|
-
index
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
_chunkGHFSIZUOjs.__name.call(void 0, BaseParam, "BaseParam");
|
|
28
|
-
function Body(key = "") {
|
|
29
|
-
return BaseParam({
|
|
30
|
-
type: "body",
|
|
31
|
-
key
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Body, "Body");
|
|
35
|
-
function Head(key) {
|
|
36
|
-
return BaseParam({
|
|
37
|
-
type: "headers",
|
|
38
|
-
key: key.toLowerCase()
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Head, "Head");
|
|
42
|
-
function Query(key = "") {
|
|
43
|
-
return BaseParam({
|
|
44
|
-
type: "query",
|
|
45
|
-
key
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Query, "Query");
|
|
49
|
-
function Param(key) {
|
|
50
|
-
return BaseParam({
|
|
51
|
-
type: "params",
|
|
52
|
-
key
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Param, "Param");
|
|
56
|
-
function Arg(target, k, index) {
|
|
57
|
-
BaseParam({
|
|
58
|
-
type: "args",
|
|
59
|
-
key: `${index}`
|
|
60
|
-
})(target, k, index);
|
|
61
|
-
}
|
|
62
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Arg, "Arg");
|
|
63
|
-
|
|
64
|
-
// src/decorators/aop.ts
|
|
65
|
-
|
|
66
|
-
function Guard(...guards) {
|
|
67
|
-
return (target, k) => {
|
|
68
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
69
|
-
if (!state.guards) state.guards = /* @__PURE__ */ new Set([
|
|
70
|
-
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _2 => _2.guards]) || []
|
|
71
|
-
]);
|
|
72
|
-
guards.forEach((guard) => {
|
|
73
|
-
if (state.guards.has(guard)) state.guards.delete(guard);
|
|
74
|
-
state.guards.add(guard);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Guard, "Guard");
|
|
80
|
-
function Plugin(...plugins) {
|
|
81
|
-
return (target, k) => {
|
|
82
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
83
|
-
if (!state.plugins) state.plugins = /* @__PURE__ */ new Set([
|
|
84
|
-
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _3 => _3.plugins]) || []
|
|
85
|
-
]);
|
|
86
|
-
plugins.forEach((plugin) => {
|
|
87
|
-
if (state.plugins.has(plugin)) state.plugins.delete(plugin);
|
|
88
|
-
state.plugins.add(plugin);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Plugin, "Plugin");
|
|
94
|
-
function Interceptor(...interceptors) {
|
|
95
|
-
return (target, k) => {
|
|
96
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
97
|
-
if (!state.interceptors) state.interceptors = /* @__PURE__ */ new Set([
|
|
98
|
-
..._optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _4 => _4.interceptors]) || []
|
|
99
|
-
]);
|
|
100
|
-
interceptors.forEach((interceptor) => {
|
|
101
|
-
if (state.interceptors.has(interceptor)) state.interceptors.delete(interceptor);
|
|
102
|
-
state.interceptors.add(interceptor);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Interceptor, "Interceptor");
|
|
108
|
-
function Filter(filter) {
|
|
109
|
-
return (target, k) => {
|
|
110
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.filter = filter);
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Filter, "Filter");
|
|
114
|
-
function Pipe(pipe) {
|
|
115
|
-
return (target, k, index) => {
|
|
116
|
-
if (typeof index === "number") {
|
|
117
|
-
BaseParam({
|
|
118
|
-
pipe
|
|
119
|
-
})(target, k, index);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => state.pipe = pipe);
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Pipe, "Pipe");
|
|
126
|
-
|
|
127
|
-
// src/decorators/http.ts
|
|
128
|
-
|
|
129
|
-
function Route(route, type) {
|
|
130
|
-
return (target, k) => {
|
|
131
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
132
|
-
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _5 => _5.http]), {
|
|
133
|
-
route,
|
|
134
|
-
type
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Route, "Route");
|
|
140
|
-
function Header(headers) {
|
|
141
|
-
return (target, k) => {
|
|
142
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
143
|
-
if (!state.http) state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _6 => _6.http]));
|
|
144
|
-
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http, {
|
|
145
|
-
headers: _chunkRZ7IXJYQjs.mergeObject.call(void 0, _optionalChain([state, 'access', _7 => _7.http, 'optionalAccess', _8 => _8.headers]), headers)
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Header, "Header");
|
|
151
|
-
function Get(route = "") {
|
|
152
|
-
return Route(route, "get");
|
|
153
|
-
}
|
|
154
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Get, "Get");
|
|
155
|
-
function Post(route = "") {
|
|
156
|
-
return Route(route, "post");
|
|
157
|
-
}
|
|
158
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Post, "Post");
|
|
159
|
-
function Put(route = "") {
|
|
160
|
-
return Route(route, "put");
|
|
161
|
-
}
|
|
162
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Put, "Put");
|
|
163
|
-
function Patch(route = "") {
|
|
164
|
-
return Route(route, "patch");
|
|
165
|
-
}
|
|
166
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Patch, "Patch");
|
|
167
|
-
function Delete(route = "") {
|
|
168
|
-
return Route(route, "delete");
|
|
169
|
-
}
|
|
170
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Delete, "Delete");
|
|
171
|
-
function Controller(prefix = "") {
|
|
172
|
-
return (target) => {
|
|
173
|
-
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
174
|
-
state.controller = "http";
|
|
175
|
-
state.http = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.http || _optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _9 => _9.http]), {
|
|
176
|
-
prefix
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Controller, "Controller");
|
|
182
|
-
|
|
183
|
-
// src/decorators/rpc.ts
|
|
184
|
-
|
|
185
|
-
function Event(isEvent = true) {
|
|
186
|
-
return (target, k) => {
|
|
187
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
188
|
-
state.rpc = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _10 => _10.rpc]), {
|
|
189
|
-
isEvent
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Event, "Event");
|
|
195
|
-
function Queue(queue = "") {
|
|
196
|
-
return (target, k) => {
|
|
197
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
198
|
-
state.rpc = _chunkRZ7IXJYQjs.mergeObject.call(void 0, state.rpc || _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _11 => _11.rpc]), {
|
|
199
|
-
queue
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Queue, "Queue");
|
|
205
|
-
function Rpc() {
|
|
206
|
-
return (target) => {
|
|
207
|
-
_phecdacore.setPropertyState.call(void 0, target, void 0, (state) => {
|
|
208
|
-
state.controller = "rpc";
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Rpc, "Rpc");
|
|
213
|
-
|
|
214
|
-
// src/decorators/ctx.ts
|
|
215
|
-
|
|
216
|
-
var Ctx = /* @__PURE__ */ _chunkGHFSIZUOjs.__name.call(void 0, (target, key) => {
|
|
217
|
-
_phecdacore.setPropertyState.call(void 0, target, _phecdacore.SHARE_KEY, (state) => {
|
|
218
|
-
if (!state.ctxs) state.ctxs = /* @__PURE__ */ new Set([
|
|
219
|
-
..._optionalChain([_phecdacore.getState.call(void 0, target), 'optionalAccess', _12 => _12.ctxs]) || []
|
|
220
|
-
]);
|
|
221
|
-
state.ctxs.add(key);
|
|
222
|
-
});
|
|
223
|
-
}, "Ctx");
|
|
224
|
-
function Define(key, value) {
|
|
225
|
-
return (target, k, index) => {
|
|
226
|
-
if (typeof index === "number") {
|
|
227
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
228
|
-
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _13 => _13.params]) || [];
|
|
229
|
-
if (!state.params) state.params = [
|
|
230
|
-
...parentState
|
|
231
|
-
].map(_chunkRZ7IXJYQjs.shallowClone);
|
|
232
|
-
const existItem = state.params.find((item) => item.index === index);
|
|
233
|
-
if (existItem) existItem.define = _chunkRZ7IXJYQjs.mergeObject.call(void 0, existItem.define, {
|
|
234
|
-
[key]: value
|
|
235
|
-
});
|
|
236
|
-
else state.params.push({
|
|
237
|
-
define: {
|
|
238
|
-
[key]: value
|
|
239
|
-
},
|
|
240
|
-
index
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
_phecdacore.setPropertyState.call(void 0, target, k, (state) => {
|
|
246
|
-
const parentState = _optionalChain([_phecdacore.getState.call(void 0, target, k), 'optionalAccess', _14 => _14.define]);
|
|
247
|
-
if (!state.define) state.define = _chunkRZ7IXJYQjs.mergeObject.call(void 0, parentState);
|
|
248
|
-
state.define[key] = value;
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
_chunkGHFSIZUOjs.__name.call(void 0, Define, "Define");
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
exports.BaseParam = BaseParam; exports.Body = Body; exports.Head = Head; exports.Query = Query; exports.Param = Param; exports.Arg = Arg; exports.Guard = Guard; exports.Plugin = Plugin; exports.Interceptor = Interceptor; exports.Filter = Filter; exports.Pipe = Pipe; exports.Route = Route; exports.Header = Header; exports.Get = Get; exports.Post = Post; exports.Put = Put; exports.Patch = Patch; exports.Delete = Delete; exports.Controller = Controller; exports.Event = Event; exports.Queue = Queue; exports.Rpc = Rpc; exports.Ctx = Ctx; exports.Define = Define;
|