phecda-server 5.0.0-alpha.12 → 5.0.0-alpha.14
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-6FRXLKGA.mjs +32 -0
- package/dist/{chunk-SSZS3GSQ.js → chunk-CRAV4WSB.js} +21 -4
- package/dist/{chunk-L5SFPHG6.mjs → chunk-MGHJFKVZ.mjs} +20 -17
- package/dist/{chunk-UXPHQ7OT.mjs → chunk-O3NJOWWO.mjs} +15 -19
- package/dist/{chunk-DJO45NRZ.mjs → chunk-ONUMVNO7.mjs} +2 -2
- package/dist/{chunk-GWLM5DEJ.js → chunk-T4C6CCWM.js} +2 -2
- package/dist/{chunk-KOWUK5OV.js → chunk-VUOACQPJ.js} +62 -59
- package/dist/{chunk-27WMBKFH.js → chunk-WOJAARJJ.js} +33 -37
- package/dist/{core-295348b7.d.ts → core-b8dcc009.d.ts} +14 -4
- package/dist/index.d.ts +27 -23
- package/dist/index.js +75 -59
- package/dist/index.mjs +32 -16
- package/dist/rpc/kafka/index.d.ts +2 -1
- package/dist/rpc/kafka/index.js +9 -9
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.d.ts +2 -1
- package/dist/rpc/rabbitmq/index.js +9 -9
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.d.ts +2 -1
- package/dist/rpc/redis/index.js +9 -9
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/server/express/index.d.ts +3 -3
- package/dist/server/express/index.js +37 -31
- package/dist/server/express/index.mjs +17 -11
- package/dist/server/fastify/index.d.ts +3 -3
- package/dist/server/fastify/index.js +35 -30
- package/dist/server/fastify/index.mjs +17 -12
- package/dist/server/h3/index.d.ts +3 -3
- package/dist/server/h3/index.js +37 -46
- package/dist/server/h3/index.mjs +20 -29
- package/dist/server/koa/index.d.ts +3 -3
- package/dist/server/koa/index.js +36 -29
- package/dist/server/koa/index.mjs +16 -9
- package/dist/test.d.ts +5 -4
- package/dist/test.js +45 -43
- package/dist/test.mjs +42 -40
- package/package.json +2 -2
- package/dist/chunk-HQ5RLYMA.mjs +0 -15
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var _chunkGWLM5DEJjs = require('./chunk-GWLM5DEJ.js');
|
|
5
|
+
var _chunkT4C6CCWMjs = require('./chunk-T4C6CCWM.js');
|
|
7
6
|
|
|
8
7
|
// src/meta.ts
|
|
9
8
|
var Meta = class {
|
|
@@ -16,10 +15,10 @@ var Meta = class {
|
|
|
16
15
|
this.paramsType = paramsType;
|
|
17
16
|
}
|
|
18
17
|
};
|
|
19
|
-
|
|
18
|
+
_chunkT4C6CCWMjs.__name.call(void 0, Meta, "Meta");
|
|
20
19
|
|
|
21
20
|
// src/compiler/rpc.ts
|
|
22
|
-
var Compiler = /* @__PURE__ */
|
|
21
|
+
var Compiler = /* @__PURE__ */ _chunkT4C6CCWMjs.__name.call(void 0, (_class =class Compiler2 {
|
|
23
22
|
__init() {this.classMap = {}}
|
|
24
23
|
constructor() {;_class.prototype.__init.call(this);
|
|
25
24
|
}
|
|
@@ -55,10 +54,10 @@ function generateRPCCode(meta) {
|
|
|
55
54
|
compiler.addMethod(i);
|
|
56
55
|
return compiler.getContent();
|
|
57
56
|
}
|
|
58
|
-
|
|
57
|
+
_chunkT4C6CCWMjs.__name.call(void 0, generateRPCCode, "generateRPCCode");
|
|
59
58
|
|
|
60
59
|
// src/compiler/http.ts
|
|
61
|
-
var Compiler3 = /* @__PURE__ */
|
|
60
|
+
var Compiler3 = /* @__PURE__ */ _chunkT4C6CCWMjs.__name.call(void 0, (_class2 =class Compiler4 {
|
|
62
61
|
__init2() {this.classMap = {}}
|
|
63
62
|
constructor() {;_class2.prototype.__init2.call(this);
|
|
64
63
|
}
|
|
@@ -97,7 +96,7 @@ function generateHTTPCode(meta) {
|
|
|
97
96
|
compiler.addMethod(i);
|
|
98
97
|
return compiler.getContent();
|
|
99
98
|
}
|
|
100
|
-
|
|
99
|
+
_chunkT4C6CCWMjs.__name.call(void 0, generateHTTPCode, "generateHTTPCode");
|
|
101
100
|
|
|
102
101
|
// src/core.ts
|
|
103
102
|
require('reflect-metadata');
|
|
@@ -108,7 +107,7 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
|
108
107
|
function Injectable() {
|
|
109
108
|
return (target) => _phecdacore.Empty.call(void 0, target);
|
|
110
109
|
}
|
|
111
|
-
|
|
110
|
+
_chunkT4C6CCWMjs.__name.call(void 0, Injectable, "Injectable");
|
|
112
111
|
var debug = _debug2.default.call(void 0, "phecda-server");
|
|
113
112
|
var emitter = new (0, _events2.default)();
|
|
114
113
|
async function Factory(Modules, opts = {}) {
|
|
@@ -121,27 +120,22 @@ async function Factory(Modules, opts = {}) {
|
|
|
121
120
|
if (!_phecdacore.getProperty.call(void 0, "watcher")) {
|
|
122
121
|
_phecdacore.injectProperty.call(void 0, "watcher", ({ eventName, instance, key, options }) => {
|
|
123
122
|
const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
|
|
124
|
-
if (!instance[_chunkGWLM5DEJjs.UNMOUNT_SYMBOL])
|
|
125
|
-
instance[_chunkGWLM5DEJjs.UNMOUNT_SYMBOL] = [];
|
|
126
|
-
instance[_chunkGWLM5DEJjs.UNMOUNT_SYMBOL].push(() => {
|
|
127
|
-
emitter.off(eventName, fn);
|
|
128
|
-
});
|
|
129
123
|
if (_optionalChain([options, 'optionalAccess', _2 => _2.once]))
|
|
130
124
|
emitter.once(eventName, fn);
|
|
131
125
|
else
|
|
132
126
|
emitter.on(eventName, fn);
|
|
127
|
+
return () => {
|
|
128
|
+
emitter.off(eventName, fn);
|
|
129
|
+
};
|
|
133
130
|
});
|
|
134
131
|
}
|
|
135
132
|
async function del(tag) {
|
|
136
133
|
if (!moduleMap.has(tag))
|
|
137
134
|
return;
|
|
138
135
|
const instance = moduleMap.get(tag);
|
|
139
|
-
debug(`unmount module "${tag}"`);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
await cb();
|
|
143
|
-
}
|
|
144
|
-
debug(`del module "${tag}"`);
|
|
136
|
+
debug(`unmount module "${String(tag)}"`);
|
|
137
|
+
_phecdacore.unmountParallel.call(void 0, instance);
|
|
138
|
+
debug(`del module "${String(tag)}"`);
|
|
145
139
|
moduleMap.delete(tag);
|
|
146
140
|
constructorMap.delete(tag);
|
|
147
141
|
for (let i = meta.length - 1; i >= 0; i--) {
|
|
@@ -150,15 +144,15 @@ async function Factory(Modules, opts = {}) {
|
|
|
150
144
|
}
|
|
151
145
|
return instance;
|
|
152
146
|
}
|
|
153
|
-
|
|
147
|
+
_chunkT4C6CCWMjs.__name.call(void 0, del, "del");
|
|
154
148
|
async function destroy() {
|
|
155
149
|
debug("destroy all");
|
|
156
150
|
for (const [tag] of moduleMap)
|
|
157
151
|
await del(tag);
|
|
158
152
|
}
|
|
159
|
-
|
|
153
|
+
_chunkT4C6CCWMjs.__name.call(void 0, destroy, "destroy");
|
|
160
154
|
async function add(Module) {
|
|
161
|
-
const tag = _optionalChain([Module, 'access',
|
|
155
|
+
const tag = _optionalChain([Module, 'access', _3 => _3.prototype, 'optionalAccess', _4 => _4.__TAG__]) || Module.name;
|
|
162
156
|
const oldInstance = await del(tag);
|
|
163
157
|
const { instance: newModule } = await buildNestModule(Module);
|
|
164
158
|
if (oldInstance && moduleGraph.has(tag)) {
|
|
@@ -174,7 +168,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
174
168
|
});
|
|
175
169
|
}
|
|
176
170
|
}
|
|
177
|
-
|
|
171
|
+
_chunkT4C6CCWMjs.__name.call(void 0, add, "add");
|
|
178
172
|
async function buildNestModule(Module) {
|
|
179
173
|
const paramtypes = getParamTypes(Module);
|
|
180
174
|
let instance;
|
|
@@ -182,10 +176,10 @@ async function Factory(Modules, opts = {}) {
|
|
|
182
176
|
if (moduleMap.has(tag)) {
|
|
183
177
|
instance = moduleMap.get(tag);
|
|
184
178
|
if (!instance)
|
|
185
|
-
throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${tag}--[module] ${Module}`);
|
|
179
|
+
throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Module}`);
|
|
186
180
|
if (constructorMap.get(tag) !== Module && !constructorSet.has(Module)) {
|
|
187
181
|
constructorSet.add(Module);
|
|
188
|
-
|
|
182
|
+
_chunkT4C6CCWMjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Module.name}"`, "warn");
|
|
189
183
|
}
|
|
190
184
|
return {
|
|
191
185
|
instance,
|
|
@@ -193,7 +187,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
193
187
|
};
|
|
194
188
|
}
|
|
195
189
|
moduleMap.set(tag, void 0);
|
|
196
|
-
debug(`instantiate module "${tag}"`);
|
|
190
|
+
debug(`instantiate module "${String(tag)}"`);
|
|
197
191
|
if (paramtypes) {
|
|
198
192
|
const paramtypesInstances = [];
|
|
199
193
|
for (const i in paramtypes) {
|
|
@@ -208,9 +202,9 @@ async function Factory(Modules, opts = {}) {
|
|
|
208
202
|
instance = new Module();
|
|
209
203
|
}
|
|
210
204
|
meta.push(...getMetaFromInstance(instance, tag, Module.name));
|
|
211
|
-
debug(`init module "${tag}"`);
|
|
205
|
+
debug(`init module "${String(tag)}"`);
|
|
212
206
|
await _phecdacore.registerSerial.call(void 0, instance);
|
|
213
|
-
debug(`add module "${tag}"`);
|
|
207
|
+
debug(`add module "${String(tag)}"`);
|
|
214
208
|
moduleMap.set(tag, instance);
|
|
215
209
|
constructorMap.set(tag, Module);
|
|
216
210
|
return {
|
|
@@ -218,7 +212,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
218
212
|
tag
|
|
219
213
|
};
|
|
220
214
|
}
|
|
221
|
-
|
|
215
|
+
_chunkT4C6CCWMjs.__name.call(void 0, buildNestModule, "buildNestModule");
|
|
222
216
|
for (const Module of Modules)
|
|
223
217
|
await buildNestModule(Module);
|
|
224
218
|
function writeCode() {
|
|
@@ -231,12 +225,12 @@ async function Factory(Modules, opts = {}) {
|
|
|
231
225
|
_fs2.default.promises.writeFile(rpc, generateRPCCode(meta.map((item) => item.data)));
|
|
232
226
|
}
|
|
233
227
|
}
|
|
234
|
-
|
|
228
|
+
_chunkT4C6CCWMjs.__name.call(void 0, writeCode, "writeCode");
|
|
235
229
|
writeCode();
|
|
236
|
-
if (
|
|
230
|
+
if (_chunkT4C6CCWMjs.IS_DEV) {
|
|
237
231
|
if (!globalThis.__PS_HMR__)
|
|
238
232
|
globalThis.__PS_HMR__ = [];
|
|
239
|
-
_optionalChain([globalThis, 'access',
|
|
233
|
+
_optionalChain([globalThis, 'access', _5 => _5.__PS_HMR__, 'optionalAccess', _6 => _6.push, 'call', _7 => _7(async (files) => {
|
|
240
234
|
debug("reload files ");
|
|
241
235
|
for (const file of files) {
|
|
242
236
|
const module = await Promise.resolve().then(() => require(file));
|
|
@@ -257,7 +251,7 @@ async function Factory(Modules, opts = {}) {
|
|
|
257
251
|
destroy
|
|
258
252
|
};
|
|
259
253
|
}
|
|
260
|
-
|
|
254
|
+
_chunkT4C6CCWMjs.__name.call(void 0, Factory, "Factory");
|
|
261
255
|
function getMetaFromInstance(instance, tag, name) {
|
|
262
256
|
const vars = _phecdacore.getExposeKey.call(void 0, instance).filter((item) => item !== _phecdacore.SHARE_KEY);
|
|
263
257
|
const baseState = _phecdacore.getState.call(void 0, instance, _phecdacore.SHARE_KEY) || {};
|
|
@@ -268,7 +262,7 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
268
262
|
initState(state);
|
|
269
263
|
if (state.http) {
|
|
270
264
|
meta.http = {
|
|
271
|
-
route: (_optionalChain([baseState, 'access',
|
|
265
|
+
route: (_optionalChain([baseState, 'access', _8 => _8.http, 'optionalAccess', _9 => _9.route]) || "") + state.http.route,
|
|
272
266
|
type: state.http.type
|
|
273
267
|
};
|
|
274
268
|
}
|
|
@@ -280,6 +274,8 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
280
274
|
...state.rpc
|
|
281
275
|
};
|
|
282
276
|
}
|
|
277
|
+
if (typeof tag !== "string" && (meta.rpc || meta.http))
|
|
278
|
+
_chunkT4C6CCWMjs.log.call(void 0, `can't use Tag with ${typeof tag} on http/rpc controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
|
|
283
279
|
meta.name = name;
|
|
284
280
|
meta.tag = tag;
|
|
285
281
|
meta.method = i;
|
|
@@ -320,11 +316,11 @@ function getMetaFromInstance(instance, tag, name) {
|
|
|
320
316
|
return new Meta(meta, _phecdacore.getHandler.call(void 0, instance, i), getParamTypes(instance, i) || []);
|
|
321
317
|
});
|
|
322
318
|
}
|
|
323
|
-
|
|
319
|
+
_chunkT4C6CCWMjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
|
|
324
320
|
function getParamTypes(Module, key) {
|
|
325
321
|
return Reflect.getMetadata("design:paramtypes", Module, key);
|
|
326
322
|
}
|
|
327
|
-
|
|
323
|
+
_chunkT4C6CCWMjs.__name.call(void 0, getParamTypes, "getParamTypes");
|
|
328
324
|
function initState(state) {
|
|
329
325
|
if (!state.define)
|
|
330
326
|
state.define = {};
|
|
@@ -337,7 +333,7 @@ function initState(state) {
|
|
|
337
333
|
if (!state.interceptors)
|
|
338
334
|
state.interceptors = [];
|
|
339
335
|
}
|
|
340
|
-
|
|
336
|
+
_chunkT4C6CCWMjs.__name.call(void 0, initState, "initState");
|
|
341
337
|
|
|
342
338
|
|
|
343
339
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Events, Construct } from 'phecda-core';
|
|
2
|
+
import { IncomingHttpHeaders } from 'node:http';
|
|
2
3
|
|
|
3
4
|
declare class Exception extends Error {
|
|
4
5
|
message: string;
|
|
@@ -56,6 +57,13 @@ declare namespace P {
|
|
|
56
57
|
tag: string;
|
|
57
58
|
[key: string]: any;
|
|
58
59
|
}
|
|
60
|
+
interface HttpContext extends BaseContext {
|
|
61
|
+
query: Record<string, any>;
|
|
62
|
+
params: Record<string, string>;
|
|
63
|
+
body: Record<string, any>;
|
|
64
|
+
headers: IncomingHttpHeaders;
|
|
65
|
+
index?: number;
|
|
66
|
+
}
|
|
59
67
|
interface Error {
|
|
60
68
|
[ERROR_SYMBOL]: true;
|
|
61
69
|
status: number;
|
|
@@ -65,7 +73,9 @@ declare namespace P {
|
|
|
65
73
|
type ResOrErr<R> = {
|
|
66
74
|
[K in keyof R]: Awaited<R[K]> | Error;
|
|
67
75
|
};
|
|
68
|
-
type Res<T> = T
|
|
76
|
+
type Res<T> = T extends {
|
|
77
|
+
toJSON(): infer R;
|
|
78
|
+
} ? R : T;
|
|
69
79
|
type Guard<C extends BaseContext = any> = ((ctx: C) => Promise<boolean> | boolean);
|
|
70
80
|
type Interceptor<C extends BaseContext = any> = (ctx: C) => (any | ((ret: any) => any));
|
|
71
81
|
type Pipe<C extends BaseContext = any> = (arg: {
|
|
@@ -104,7 +114,7 @@ declare namespace P {
|
|
|
104
114
|
plugins: string[];
|
|
105
115
|
method: string;
|
|
106
116
|
name: string;
|
|
107
|
-
tag:
|
|
117
|
+
tag: PropertyKey;
|
|
108
118
|
}
|
|
109
119
|
}
|
|
110
120
|
|
|
@@ -114,11 +124,11 @@ declare function Factory(Modules: (new (...args: any) => any)[], opts?: {
|
|
|
114
124
|
http?: string;
|
|
115
125
|
rpc?: string;
|
|
116
126
|
}): Promise<{
|
|
117
|
-
moduleMap: Map<
|
|
127
|
+
moduleMap: Map<PropertyKey, any>;
|
|
118
128
|
meta: Meta[];
|
|
119
129
|
constructorMap: Map<any, any>;
|
|
120
130
|
add: (Module: Construct) => Promise<void>;
|
|
121
|
-
del: (tag:
|
|
131
|
+
del: (tag: PropertyKey) => Promise<any>;
|
|
122
132
|
destroy: () => Promise<void>;
|
|
123
133
|
}>;
|
|
124
134
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { E as Exception, P, M as Meta, U as UNMOUNT_SYMBOL } from './core-
|
|
2
|
-
export { A as APP_SYMBOL, k as ERROR_SYMBOL, a as Emitter, F as Factory, h as IS_DEV, j as IS_LOG_BAN, i as IS_STRICT, I as Injectable, d as MERGE_SYMBOL, g as META_SYMBOL, f as MODULE_SYMBOL, l as PS_FILE_RE, m as PS_IMPORT_RE, c as PickFunc, b as PickKeysByValue, R as RequestType, T as ToControllerMap, e as emitter } from './core-
|
|
3
|
-
import { Construct } from 'phecda-core';
|
|
1
|
+
import { E as Exception, P, M as Meta, U as UNMOUNT_SYMBOL } from './core-b8dcc009.js';
|
|
2
|
+
export { A as APP_SYMBOL, k as ERROR_SYMBOL, a as Emitter, F as Factory, h as IS_DEV, j as IS_LOG_BAN, i as IS_STRICT, I as Injectable, d as MERGE_SYMBOL, g as META_SYMBOL, f as MODULE_SYMBOL, l as PS_FILE_RE, m as PS_IMPORT_RE, c as PickFunc, b as PickKeysByValue, R as RequestType, T as ToControllerMap, e as emitter } from './core-b8dcc009.js';
|
|
3
|
+
import { Construct, AbConstruct } from 'phecda-core';
|
|
4
4
|
export * from 'phecda-core';
|
|
5
|
+
import 'node:http';
|
|
5
6
|
|
|
6
7
|
declare class Histroy {
|
|
7
8
|
guard: string[];
|
|
@@ -71,11 +72,11 @@ declare class Context<Data extends P.BaseContext> {
|
|
|
71
72
|
method: string;
|
|
72
73
|
params: string[];
|
|
73
74
|
history: Histroy;
|
|
74
|
-
static filterRecord: Record<
|
|
75
|
-
static pipeRecord: Record<
|
|
76
|
-
static guardRecord: Record<
|
|
77
|
-
static interceptorRecord: Record<
|
|
78
|
-
static
|
|
75
|
+
static filterRecord: Record<PropertyKey, P.Filter>;
|
|
76
|
+
static pipeRecord: Record<PropertyKey, P.Pipe>;
|
|
77
|
+
static guardRecord: Record<PropertyKey, P.Guard>;
|
|
78
|
+
static interceptorRecord: Record<PropertyKey, P.Interceptor>;
|
|
79
|
+
static pluginRecord: Record<PropertyKey, any>;
|
|
79
80
|
postInterceptors: Function[];
|
|
80
81
|
constructor(data: Data);
|
|
81
82
|
usePipe(args: {
|
|
@@ -93,11 +94,11 @@ declare class Context<Data extends P.BaseContext> {
|
|
|
93
94
|
useInterceptor(interceptors: string[]): Promise<any>;
|
|
94
95
|
static usePlugin(plugins: string[]): any[];
|
|
95
96
|
}
|
|
96
|
-
declare function
|
|
97
|
-
declare function addPipe<C extends P.BaseContext>(key:
|
|
98
|
-
declare function addFilter<C extends P.BaseContext>(key:
|
|
99
|
-
declare function addGuard<C extends P.BaseContext>(key:
|
|
100
|
-
declare function addInterceptor<C extends P.BaseContext>(key:
|
|
97
|
+
declare function addPlugin<T>(key: PropertyKey, handler: T): void;
|
|
98
|
+
declare function addPipe<C extends P.BaseContext>(key: PropertyKey, handler: P.Pipe<C>): void;
|
|
99
|
+
declare function addFilter<C extends P.BaseContext>(key: PropertyKey, handler: P.Filter<C>): void;
|
|
100
|
+
declare function addGuard<C extends P.BaseContext>(key: PropertyKey, handler: P.Guard<C>): void;
|
|
101
|
+
declare function addInterceptor<C extends P.BaseContext>(key: PropertyKey, handler: P.Interceptor<C>): void;
|
|
101
102
|
declare function isAopDepInject(meta: Meta[], { guards, interceptors, plugins }?: {
|
|
102
103
|
guards?: string[];
|
|
103
104
|
interceptors?: string[];
|
|
@@ -133,32 +134,35 @@ declare function Define(key: string, value: any): (target: any, k?: PropertyKey)
|
|
|
133
134
|
declare const defaultPipe: P.Pipe;
|
|
134
135
|
|
|
135
136
|
declare function resolveDep(ret: any, key: string): any;
|
|
137
|
+
declare function argToReq(params: Meta['data']['params'], args: any[], headers: Record<string, any>): any;
|
|
136
138
|
|
|
137
139
|
declare class Dev {
|
|
138
140
|
private readonly [UNMOUNT_SYMBOL];
|
|
141
|
+
protected context: P.BaseContext;
|
|
139
142
|
onUnmount(cb: () => void): void;
|
|
143
|
+
private unmount;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
declare abstract class PFilter<C extends P.BaseContext = any, E extends Exception = Exception> extends Dev {
|
|
143
|
-
readonly key:
|
|
147
|
+
readonly key: PropertyKey;
|
|
144
148
|
constructor(tag?: string);
|
|
145
149
|
abstract use(error: Error | E, ctx?: C): P.Error;
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
declare abstract class PGuard<C extends P.BaseContext = any> extends Dev {
|
|
149
153
|
abstract use(ctx: C): Promise<boolean> | boolean;
|
|
150
|
-
readonly key:
|
|
154
|
+
readonly key: PropertyKey;
|
|
151
155
|
constructor(tag?: string);
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
declare abstract class PInterceptor<C extends P.BaseContext = any> extends Dev {
|
|
155
159
|
abstract use(ctx: C): Function | Promise<Function> | any;
|
|
156
|
-
readonly key:
|
|
160
|
+
readonly key: PropertyKey;
|
|
157
161
|
constructor(tag?: string);
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
declare abstract class PPipe<C extends P.BaseContext = any> extends Dev {
|
|
161
|
-
readonly key:
|
|
165
|
+
readonly key: PropertyKey;
|
|
162
166
|
constructor(tag?: string);
|
|
163
167
|
abstract use(param: {
|
|
164
168
|
arg: any;
|
|
@@ -170,8 +174,8 @@ declare abstract class PPipe<C extends P.BaseContext = any> extends Dev {
|
|
|
170
174
|
}, ctx: C): any;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
|
-
declare abstract class
|
|
174
|
-
readonly key:
|
|
177
|
+
declare abstract class PPlugin<Params extends any[] = any[]> extends Dev {
|
|
178
|
+
readonly key: PropertyKey;
|
|
175
179
|
constructor(tag?: string);
|
|
176
180
|
abstract use(...args: Params): void;
|
|
177
181
|
}
|
|
@@ -188,10 +192,10 @@ interface PExtension<C extends P.BaseContext = any, E extends Exception = Except
|
|
|
188
192
|
reflect: any;
|
|
189
193
|
}, ctx: C): any;
|
|
190
194
|
filter(error: Error | E, ctx?: C): P.Error;
|
|
191
|
-
|
|
195
|
+
plugin(...args: any): void;
|
|
192
196
|
}
|
|
193
197
|
declare class PExtension extends Dev {
|
|
194
|
-
readonly key:
|
|
198
|
+
readonly key: PropertyKey;
|
|
195
199
|
constructor(tag?: string);
|
|
196
200
|
}
|
|
197
201
|
|
|
@@ -202,6 +206,6 @@ declare function generateHTTPCode(meta: P.MetaData[]): string;
|
|
|
202
206
|
declare function log(msg: string, level?: 'error' | 'info' | 'warn'): void;
|
|
203
207
|
declare function getConfig<C = any>(key: string, defaultConf?: C): C;
|
|
204
208
|
declare function setConfig<C = any>(key: string, conf: C, force?: boolean): void;
|
|
205
|
-
declare function Mix<C1 extends Construct, C2 extends Construct>(InternalClass: C1, ExtendClass: C2): new (...args: ConstructorParameters<C2>) => InstanceType<C1> & InstanceType<C2>;
|
|
209
|
+
declare function Mix<C1 extends Construct | AbConstruct, C2 extends Construct>(InternalClass: C1, ExtendClass: C2): new (...args: ConstructorParameters<C2>) => InstanceType<C1> & InstanceType<C2>;
|
|
206
210
|
|
|
207
|
-
export { Arg, BadGatewayException, BadRequestException, BaseParam, Body, ConflictException, Context, Controller, Define, Delete, Dev, Event, Exception, Filter, ForbiddenException, FrameworkException, Get, Guard, Head, Header, Interceptor, InvalidInputException, Meta, Mix, NotFoundException, P,
|
|
211
|
+
export { Arg, BadGatewayException, BadRequestException, BaseParam, Body, ConflictException, Context, Controller, Define, Delete, Dev, Event, Exception, Filter, ForbiddenException, FrameworkException, Get, Guard, Head, Header, Interceptor, InvalidInputException, Meta, Mix, NotFoundException, P, PExtension, PFilter, PGuard, PInterceptor, PPipe, PPlugin, Param, Patch, PayloadLargeException, Pipe, Plugin, Post, Put, Query, Route, Rpc, ServiceUnavailableException, TimeoutException, UNMOUNT_SYMBOL, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, argToReq, defaultPipe, generateHTTPCode, generateRPCCode, getConfig, guardRecord, isAopDepInject, log, resolveDep, setConfig };
|