phecda-server 4.0.0-alpha.6 → 4.0.0-alpha.8
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/core-edac98be.d.ts +21 -0
- package/dist/index.d.ts +52 -49
- package/dist/index.js +113 -371
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -360
- package/dist/index.mjs.map +1 -1
- package/dist/rpc/rabbitmq/index.d.ts +11 -28
- package/dist/rpc/rabbitmq/index.js +47 -60
- package/dist/rpc/rabbitmq/index.js.map +1 -1
- package/dist/rpc/rabbitmq/index.mjs +46 -51
- package/dist/rpc/rabbitmq/index.mjs.map +1 -1
- package/dist/rpc/redis/index.d.ts +12 -28
- package/dist/rpc/redis/index.js +49 -61
- package/dist/rpc/redis/index.js.map +1 -1
- package/dist/rpc/redis/index.mjs +48 -52
- package/dist/rpc/redis/index.mjs.map +1 -1
- package/dist/server/express/index.d.ts +23 -0
- package/dist/server/express/index.js +496 -0
- package/dist/server/express/index.js.map +1 -0
- package/dist/server/express/index.mjs +465 -0
- package/dist/server/express/index.mjs.map +1 -0
- package/dist/server/fastify/index.d.ts +22 -0
- package/dist/server/fastify/index.js +467 -0
- package/dist/server/fastify/index.js.map +1 -0
- package/dist/server/fastify/index.mjs +442 -0
- package/dist/server/fastify/index.mjs.map +1 -0
- package/dist/test.d.ts +3 -3
- package/dist/test.js +3 -5
- package/dist/test.js.map +1 -1
- package/dist/test.mjs +3 -5
- package/dist/test.mjs.map +1 -1
- package/dist/{types-2c710fc7.d.ts → types-0b94277f.d.ts} +1 -18
- package/package.json +17 -1
- package/register/index.mjs +2 -0
- package/dist/core-c289deb2.d.ts +0 -49
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { P, a as Emitter, C as Construct } from './types-0b94277f.js';
|
|
2
|
+
|
|
3
|
+
declare class Meta {
|
|
4
|
+
data: P.Meta;
|
|
5
|
+
handlers: P.Handler[];
|
|
6
|
+
reflect: any[];
|
|
7
|
+
constructor(data: P.Meta, handlers: P.Handler[], reflect: any[]);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const emitter: Emitter;
|
|
11
|
+
declare function Factory(Modules: (new (...args: any) => any)[], opts?: {
|
|
12
|
+
http?: string;
|
|
13
|
+
rpc?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
moduleMap: Map<string, any>;
|
|
16
|
+
meta: Meta[];
|
|
17
|
+
constructorMap: Map<any, any>;
|
|
18
|
+
update: (Module: Construct) => Promise<void>;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
export { Factory as F, Meta as M, emitter as e };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
import { B as BaseContext, F as Factory } from './core-c289deb2.js';
|
|
5
|
-
export { e as emitter } from './core-c289deb2.js';
|
|
1
|
+
import { E as Exception, P } from './types-0b94277f.js';
|
|
2
|
+
export { B as BaseError, C as Construct, a as Emitter, M as MergeType, R as RequestType, S as ServerErr, T as ToInstance } from './types-0b94277f.js';
|
|
3
|
+
export { F as Factory, M as Meta, e as emitter } from './core-edac98be.js';
|
|
6
4
|
export * from 'phecda-core';
|
|
7
5
|
|
|
6
|
+
declare class Histroy {
|
|
7
|
+
guard: string[];
|
|
8
|
+
interceptor: string[];
|
|
9
|
+
record(name: string, type: 'guard' | 'interceptor'): boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
declare class UndefinedException extends Exception {
|
|
9
13
|
constructor(message: string);
|
|
10
14
|
}
|
|
@@ -61,40 +65,39 @@ declare class FrameworkException extends Exception {
|
|
|
61
65
|
constructor(message: string);
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
declare const guardsRecord: Record<string, P.Guard<
|
|
65
|
-
declare
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
68
|
+
declare const guardsRecord: Record<string, P.Guard<any>>;
|
|
69
|
+
declare class Context<Data = any> {
|
|
70
|
+
tag: string;
|
|
71
|
+
data: Data;
|
|
72
|
+
method: string;
|
|
73
|
+
params: string[];
|
|
74
|
+
history: Histroy;
|
|
75
|
+
static filter: P.Filter;
|
|
76
|
+
static pipe: P.Pipe;
|
|
77
|
+
static guardsRecord: Record<string, P.Guard>;
|
|
78
|
+
static interceptorsRecord: Record<string, P.Interceptor>;
|
|
76
79
|
static middlewareRecord: Record<string, (...params: any) => any>;
|
|
77
|
-
guardsRecord: Record<string, P.Guard<ServerCtx>>;
|
|
78
|
-
interceptorsRecord: Record<string, P.Interceptor<ServerCtx>>;
|
|
79
80
|
postInterceptors: Function[];
|
|
81
|
+
constructor(tag: string, data: Data);
|
|
82
|
+
usePipe(args: {
|
|
83
|
+
arg: any;
|
|
84
|
+
option?: any;
|
|
85
|
+
type: string;
|
|
86
|
+
key: string;
|
|
87
|
+
index: number;
|
|
88
|
+
reflect: any;
|
|
89
|
+
}[]): Promise<any[]>;
|
|
90
|
+
useFilter(arg: any): any;
|
|
91
|
+
useGuard(guards: string[]): Promise<void>;
|
|
92
|
+
usePostInterceptor(ret: any): Promise<any>;
|
|
93
|
+
useInterceptor(interceptors: string[]): Promise<true | undefined>;
|
|
80
94
|
static useMiddleware(middlewares: string[]): ((...params: any) => any)[];
|
|
81
95
|
}
|
|
82
|
-
declare function addMiddleware(key: string, handler:
|
|
83
|
-
declare function setPipe(pipe: P.Pipe
|
|
84
|
-
declare function setFilter(filter: P.Filter
|
|
85
|
-
declare function addGuard(key: string, handler: P.Guard
|
|
86
|
-
declare function addInterceptor(key: string, handler: P.Interceptor
|
|
87
|
-
|
|
88
|
-
interface Options {
|
|
89
|
-
dev?: boolean;
|
|
90
|
-
route?: string;
|
|
91
|
-
globalGuards?: string[];
|
|
92
|
-
globalInterceptors?: string[];
|
|
93
|
-
middlewares?: string[];
|
|
94
|
-
parallel?: boolean;
|
|
95
|
-
series?: boolean;
|
|
96
|
-
}
|
|
97
|
-
declare function bindApp(app: Router, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, options?: Options): void;
|
|
96
|
+
declare function addMiddleware(key: string, handler: (...params: any) => any): void;
|
|
97
|
+
declare function setPipe(pipe: P.Pipe): void;
|
|
98
|
+
declare function setFilter(filter: P.Filter): void;
|
|
99
|
+
declare function addGuard(key: string, handler: P.Guard): void;
|
|
100
|
+
declare function addInterceptor(key: string, handler: P.Interceptor): void;
|
|
98
101
|
|
|
99
102
|
declare function BaseParam(type: string, key: string, option?: any): any;
|
|
100
103
|
declare function Body(key?: string, pipeOpts?: any): any;
|
|
@@ -110,7 +113,7 @@ declare function Put(route: string): any;
|
|
|
110
113
|
declare function Patch(route: string): any;
|
|
111
114
|
declare function Delete(route: string): any;
|
|
112
115
|
declare function Controller(route: string): any;
|
|
113
|
-
declare function Rpc(...rpc: string[]): (target: any, key: PropertyKey) => void;
|
|
116
|
+
declare function Rpc(...rpc: ('mq' | 'redis' | string)[]): (target: any, key: PropertyKey) => void;
|
|
114
117
|
|
|
115
118
|
declare function Guard(...guards: string[]): any;
|
|
116
119
|
declare function Middle(...middlewares: string[]): any;
|
|
@@ -135,35 +138,35 @@ declare class Dev {
|
|
|
135
138
|
onUnmount(cb: () => void): void;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
declare abstract class
|
|
139
|
-
|
|
141
|
+
declare abstract class PFilter {
|
|
142
|
+
constructor();
|
|
143
|
+
abstract use<C, S, E extends Exception>(error: Error | E, tag?: string, ctx?: C): S;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare abstract class PGuard {
|
|
147
|
+
abstract use<C>(tag: string, ctx: C): Promise<boolean> | boolean;
|
|
140
148
|
constructor(tag: string);
|
|
141
149
|
}
|
|
142
150
|
|
|
143
|
-
declare abstract class
|
|
144
|
-
abstract use(tag: string, ctx:
|
|
151
|
+
declare abstract class PInterceptor {
|
|
152
|
+
abstract use<C>(tag: string, ctx: C): ((arg: any) => any) | void;
|
|
145
153
|
constructor(tag: string);
|
|
146
154
|
}
|
|
147
155
|
|
|
148
|
-
declare abstract class
|
|
156
|
+
declare abstract class PPipe {
|
|
149
157
|
constructor();
|
|
150
|
-
abstract use(args: {
|
|
158
|
+
abstract use<C>(args: {
|
|
151
159
|
arg: any;
|
|
152
160
|
option?: any;
|
|
153
161
|
key: string;
|
|
154
162
|
type: string;
|
|
155
163
|
index: number;
|
|
156
164
|
reflect: any;
|
|
157
|
-
}[], tag: string, ctx:
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
declare abstract class ServerFilter {
|
|
161
|
-
constructor();
|
|
162
|
-
abstract use<E extends Exception>(error: Error | E, tag?: string, ctx?: ServerCtx): ServerErr | Promise<ServerErr>;
|
|
165
|
+
}[], tag: string, ctx: C): Promise<any[]>;
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
declare function generateRPCCode(meta: P.Meta[]): string;
|
|
166
169
|
|
|
167
170
|
declare function generateHTTPCode(meta: P.Meta[]): string;
|
|
168
171
|
|
|
169
|
-
export { APP_SYMBOL, Arg, BadGatewayException, BadRequestException,
|
|
172
|
+
export { APP_SYMBOL, Arg, BadGatewayException, BadRequestException, BaseParam, Body, ConflictException, Context, Controller, Define, Delete, Dev, Exception, ForbiddenException, FrameworkException, Get, Guard, Head, Header, Interceptor, InvalidInputException, MERGE_SYMBOL, META_SYMBOL, MODULE_SYMBOL, Middle, NotFoundException, P, PFilter, PGuard, PInterceptor, PPipe, Param, Patch, PayloadLargeException, Post, Put, Query, Route, Rpc, SERIES_SYMBOL, ServiceUnavailableException, TimeoutException, UNMOUNT_SYMBOL, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, addGuard, addInterceptor, addMiddleware, defaultPipe, generateHTTPCode, generateRPCCode, guardsRecord, resolveDep, setFilter, setPipe };
|