phecda-server 1.2.3 → 1.2.4

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/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { S as ServerMeta, P as PHandler, R as RequestType, a as PhecdaEmitter, C as Construct } from './axios-13a49ed4.js';
2
2
  export { $ as $S, B as BaseError, M as MergeType, f as MqContextData, b as PError, d as PRes, g as RequestMethod, c as ResOrErr, e as ServerContextData, T as Transform, U as UnWrap, j as createParallelReq, h as createReq, i as createSeriesReq, k as isError, m as merge, t as toReq } from './axios-13a49ed4.js';
3
3
  import { Express } from 'express';
4
- import { PluginOption } from 'vite';
5
4
  export * from 'phecda-core';
6
5
  import amqplib from 'amqplib';
7
6
  import 'axios';
@@ -152,6 +151,7 @@ declare const emitter: PhecdaEmitter;
152
151
  declare function Factory<T>(Modules: Construct<T>[]): Promise<{
153
152
  moduleMap: Map<string, any>;
154
153
  meta: Pmeta[];
154
+ output: (p: string) => void;
155
155
  }>;
156
156
 
157
157
  interface Options {
@@ -182,12 +182,10 @@ declare function MQ(queue: string, routeKey: string, options?: amqplib.Options.C
182
182
  declare function Inject(_target: any): void;
183
183
  declare function Header(name: string, value: string): (target: any, k: PropertyKey) => void;
184
184
 
185
- declare function Server(localPath?: string): PluginOption;
186
-
187
185
  declare function bindMQ(ch: amqplib.Channel, { meta, moduleMap }: Awaited<ReturnType<typeof Factory>>): Promise<void>;
188
186
  type MqMethod<T> = (arg: T) => void;
189
187
  declare function createPub<T extends (...args: any[]) => any>(ch: amqplib.Channel, method: T, type?: string): Promise<MqMethod<Parameters<T>>>;
190
188
 
191
189
  declare function createMqReq(channel: amqplib.Channel): <R>(arg: R) => Promise<void>;
192
190
 
193
- export { BadRequestException, BaseParam, Body, Construct, Controller, Delete, Factory, ForbiddenException, Get, Guard, Header, HttpException, Inject, Interceptor, MQ, Middle, NotFoundException, Options, PHandler, Param, Pcompiler, Pcontext, PhecdaEmitter, Pmeta, Post, Put, Query, RabbitMqContext, RequestType, Route, Server, ServerContext, ServerMeta, UndefinedException, ValidateException, ValidatePipe, WrongMetaException, addGuard, addInterceptor, addMiddleware, bindApp, bindMQ, createMqReq, createPub, defaultPipe, emitter, getInstance, parseMeta, useMqFilter, useMqPipe, useServerFilter, useServerPipe };
191
+ export { BadRequestException, BaseParam, Body, Construct, Controller, Delete, Factory, ForbiddenException, Get, Guard, Header, HttpException, Inject, Interceptor, MQ, Middle, NotFoundException, Options, PHandler, Param, Pcompiler, Pcontext, PhecdaEmitter, Pmeta, Post, Put, Query, RabbitMqContext, RequestType, Route, ServerContext, ServerMeta, UndefinedException, ValidateException, ValidatePipe, WrongMetaException, addGuard, addInterceptor, addMiddleware, bindApp, bindMQ, createMqReq, createPub, defaultPipe, emitter, getInstance, parseMeta, useMqFilter, useMqPipe, useServerFilter, useServerPipe };
package/dist/index.js CHANGED
@@ -59,7 +59,6 @@ __export(src_exports, {
59
59
  Query: () => Query,
60
60
  RabbitMqContext: () => RabbitMqContext,
61
61
  Route: () => Route,
62
- Server: () => Server,
63
62
  ServerContext: () => ServerContext,
64
63
  UndefinedException: () => UndefinedException,
65
64
  ValidateException: () => ValidateException,
@@ -128,16 +127,15 @@ var defaultPipe = {
128
127
  const { validate, arg } = args[i];
129
128
  if (validate === false)
130
129
  continue;
131
- if (validate && !(arg?.constructor === reflect[i])) {
132
- throw new ValidateException(`${arg} is not ${reflect[i].name}`);
130
+ if ((0, import_phecda_core.isPhecda)(reflect[i])) {
131
+ const ret = await (0, import_phecda_core.plainToClass)(reflect[i], arg, {
132
+ transform: true
133
+ });
134
+ if (ret.err.length > 0)
135
+ throw new ValidateException(ret.err[0]);
136
+ args[i].arg = ret.data;
133
137
  } else {
134
- if ((0, import_phecda_core.isPhecda)(reflect[i])) {
135
- const ret = await (0, import_phecda_core.plainToClass)(reflect[i], arg, {
136
- transform: false
137
- });
138
- if (ret.err.length > 0)
139
- throw new ValidateException(ret.err[0]);
140
- }
138
+ args[i].arg = reflect[i](arg);
141
139
  }
142
140
  }
143
141
  return args.map((item) => item.arg);
@@ -536,7 +534,7 @@ function bindApp(app, { meta, moduleMap }, options = {}) {
536
534
  }
537
535
  if (category === "parallel") {
538
536
  return Promise.all(data.map((item) => {
539
- return new Promise(async (resolve2) => {
537
+ return new Promise(async (resolve) => {
540
538
  const { tag } = item;
541
539
  const [name] = tag.split("-");
542
540
  const { guards, reflect, interceptors, params } = Pcontext.metaDataRecord[tag];
@@ -554,11 +552,11 @@ function bindApp(app, { meta, moduleMap }, options = {}) {
554
552
  };
555
553
  }), reflect);
556
554
  instance.meta = contextData;
557
- resolve2(await context.usePost(await methodMap[tag](...args)));
555
+ resolve(await context.usePost(await methodMap[tag](...args)));
558
556
  } catch (e) {
559
557
  const m = Pcontext.metaRecord[tag];
560
558
  m.handlers.forEach((handler) => handler.error?.(e));
561
- resolve2(await context.useFilter(e));
559
+ resolve(await context.useFilter(e));
562
560
  }
563
561
  });
564
562
  })).then((ret2) => {
@@ -573,6 +571,7 @@ __name(bindApp, "bindApp");
573
571
  // src/core.ts
574
572
  var import_reflect_metadata = require("reflect-metadata");
575
573
  var import_events = __toESM(require("events"));
574
+ var import_fs = __toESM(require("fs"));
576
575
  var import_phecda_core2 = require("phecda-core");
577
576
 
578
577
  // src/meta.ts
@@ -604,7 +603,8 @@ async function Factory(Modules) {
604
603
  await buildNestModule(Module, moduleMap, meta);
605
604
  return {
606
605
  moduleMap,
607
- meta
606
+ meta,
607
+ output: (p) => import_fs.default.writeFileSync(p, JSON.stringify(meta.map((item) => item.data)))
608
608
  };
609
609
  }
610
610
  __name(Factory, "Factory");
@@ -861,50 +861,6 @@ function Header(name, value) {
861
861
  }
862
862
  __name(Header, "Header");
863
863
 
864
- // src/vite/index.ts
865
- var import_path = require("path");
866
- var import_vite = require("vite");
867
- function Server(localPath = "pmeta.js") {
868
- let root;
869
- let metaPath;
870
- let command;
871
- return {
872
- name: "phecda-server-vite:client",
873
- enforce: "pre",
874
- configResolved(config) {
875
- command = config.command;
876
- root = config.root || process.cwd();
877
- metaPath = (0, import_vite.normalizePath)((0, import_path.resolve)(root, localPath));
878
- },
879
- buildStart() {
880
- if (command === "build") {
881
- this.emitFile({
882
- type: "chunk",
883
- id: metaPath,
884
- fileName: localPath,
885
- preserveSignature: "allow-extension"
886
- });
887
- }
888
- },
889
- resolveId(id) {
890
- if (id.endsWith(".controller"))
891
- return metaPath;
892
- },
893
- transform(code, id) {
894
- if (id === metaPath) {
895
- const meta = JSON.parse(code);
896
- const compiler = new Pcompiler();
897
- for (const i of meta)
898
- compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params);
899
- return {
900
- code: compiler.getContent()
901
- };
902
- }
903
- }
904
- };
905
- }
906
- __name(Server, "Server");
907
-
908
864
  // src/index.ts
909
865
  __reExport(src_exports, require("phecda-core"), module.exports);
910
866
 
@@ -1087,7 +1043,6 @@ __name(createMqReq, "createMqReq");
1087
1043
  Query,
1088
1044
  RabbitMqContext,
1089
1045
  Route,
1090
- Server,
1091
1046
  ServerContext,
1092
1047
  UndefinedException,
1093
1048
  ValidateException,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/pipe.ts","../src/exception/base.ts","../src/exception/validate.ts","../src/exception/undefine.ts","../src/exception/forbidden.ts","../src/exception/bad-request.ts","../src/exception/wrong-meta.ts","../src/exception/not-found.ts","../src/filter.ts","../src/history.ts","../src/context/base.ts","../src/context/server.ts","../src/context/micro.ts","../src/compiler.ts","../src/utils.ts","../src/common.ts","../src/server/express.ts","../src/core.ts","../src/meta.ts","../src/decorators/index.ts","../src/decorators/param.ts","../src/decorators/route.ts","../src/decorators/micro.ts","../src/vite/index.ts","../src/config.ts","../src/micro-services/rabbitmq.ts","../src/client/axios.ts","../src/client/server.ts"],"sourcesContent":["export * from './context'\nexport * from './types'\nexport * from './compiler'\nexport * from './server/express'\nexport * from './core'\nexport * from './decorators'\nexport * from './vite'\nexport * from './exception'\nexport * from './pipe'\nexport * from './meta'\nexport * from 'phecda-core'\nexport * from './micro-services/rabbitmq'\nexport * from './client/server'\n","import { isPhecda, plainToClass } from 'phecda-core'\nimport { ValidateException } from './exception/validate'\n\nexport interface ValidatePipe {\n transform(args: { arg: any; validate?: boolean }[], reflect: any[]): Promise<any[]>\n}\n\nexport const defaultPipe = {\n async transform(args: { arg: any; validate: boolean }[], reflect: any[]) {\n for (const i in args) {\n const { validate, arg } = args[i]\n if (validate === false)\n continue\n if (validate && !(arg?.constructor === reflect[i])) {\n throw new ValidateException(`${arg} is not ${reflect[i].name}`)\n }\n else {\n if (isPhecda(reflect[i])) {\n const ret = await plainToClass(reflect[i], arg, { transform: false })\n if (ret.err.length > 0)\n throw new ValidateException(ret.err[0])\n }\n }\n }\n return args.map(item => item.arg)\n },\n} as ValidatePipe\n","export class HttpException extends Error {\n constructor(public message: string, public status: number, public description = 'Http exception') {\n super(message)\n }\n\n get data() {\n return { message: this.message, description: this.description, status: this.status, error: true }\n }\n}\n\n// export class BaseException extends Error {\n// constructor(public message: string, public description = 'Base exception') {\n// super(message)\n// }\n\n// get data() {\n// return { message: this.message, description: this.description, status: this.status, error: true }\n// }\n// }\n","import { HttpException } from './base'\n\nexport class ValidateException extends HttpException {\n constructor(message: string) {\n super(message, 400, 'Validate exception')\n }\n}\n","import { HttpException } from './base'\n\nexport class UndefinedException extends HttpException {\n constructor(message: string) {\n super(message, 500, 'Undefined error')\n }\n}\n","import { HttpException } from './base'\n\nexport class ForbiddenException extends HttpException {\n constructor(message: string) {\n super(message, 403, 'Forbidden resource')\n }\n}\n","import { HttpException } from './base'\n\nexport class BadRequestException extends HttpException {\n constructor(message: string) {\n super(message, 400, 'Bad Request')\n }\n}\n","import { HttpException } from './base'\n\nexport class WrongMetaException extends HttpException {\n constructor(message: string) {\n super(message, 500, 'Meta is not correct')\n }\n}\n","import { HttpException } from './base'\n\nexport class NotFoundException extends HttpException {\n constructor(message: string) {\n super(message, 404, 'Not Found')\n }\n}\n","import { HttpException, UndefinedException } from './exception'\nexport type ErrorFilter<E extends HttpException = any> = (err: E | Error, contextData: any) => any\n\nexport const serverFilter: ErrorFilter = (e: any) => {\n if (!(e instanceof HttpException))\n e = new UndefinedException(e.message || e)\n return e.data\n}\n\nexport const rabbitMqFilter: ErrorFilter = (e: any, data) => {\n const { channel, message } = data\n channel!.reject(message!, true)\n}\n","export class Phistroy {\n guard: string[] = []\n interceptor: string[] = []\n record(name: string, type: 'guard' | 'interceptor') {\n if (!this[type].includes(name)) {\n this[type].push(name)\n return true\n }\n return false\n }\n}\n","import { WrongMetaException } from '../exception/wrong-meta'\nimport { Phistroy } from '../history'\nimport { ForbiddenException } from '../exception'\n\nimport type { Pmeta } from '../meta'\n\nexport abstract class Pcontext {\n method: string\n params: string[]\n\n static metaRecord: Record<string, Pmeta> = {}\n static metaDataRecord: Record<string, ReturnType<typeof parseMeta>> = {}\n static instanceRecord: Record<string, any> = {}\n static guardsRecord: Record<string, (req: any, isMerge: boolean) => boolean> = {}\n static interceptorsRecord: Record<string, (req: any, isMerge: boolean) => any > = {}\n // static serverRecord: Record<string, Pcontext> = {}\n post: ((...params: any) => any)[]\n history = new Phistroy()\n constructor(public key: string, public data: any) {\n }\n\n static registerGuard(key: string, handler: any) {\n Pcontext.guardsRecord[key] = handler\n }\n\n static registerInterceptor(key: string, handler: any) {\n Pcontext.interceptorsRecord[key] = handler\n }\n\n async useGuard(guards: string[], isMerge = false) {\n for (const guard of guards) {\n if (this.history.record(guard, 'guard')) {\n if (!(guard in Pcontext.guardsRecord))\n throw new WrongMetaException(`can't find guard named ${guard}`)\n if (!await Pcontext.guardsRecord[guard](this.data, isMerge))\n throw new ForbiddenException(`Guard exception--${guard}`)\n }\n }\n }\n\n async useInterceptor(interceptors: string[], isMerge = false) {\n const ret = []\n for (const interceptor of interceptors) {\n if (this.history.record(interceptor, 'interceptor')) {\n if (!(interceptor in Pcontext.interceptorsRecord))\n throw new WrongMetaException(`can't find guard named ${interceptor}`)\n const post = await Pcontext.interceptorsRecord[interceptor](this.data, isMerge)\n if (post)\n ret.push(post)\n }\n }\n this.post = ret\n }\n\n async usePost(data: any) {\n if (!this.post)\n return data\n for (const cb of this.post)\n data = (await cb(data)) | data\n\n return data\n }\n}\n\nexport function addGuard(key: string, handler: (contextData: any, isMerge: boolean) => boolean) {\n Pcontext.registerGuard(key, handler)\n}\n\nexport function addInterceptor(key: string, handler: (contextData: any, isMerge: boolean) => any) {\n Pcontext.registerInterceptor(key, handler)\n}\nexport function getInstance(tag: string) {\n return Pcontext.instanceRecord[tag]\n}\n\nexport function parseMeta(meta: Pmeta) {\n const { data: { params, guards, interceptors, middlewares }, reflect } = meta\n return {\n guards,\n reflect,\n interceptors,\n middlewares,\n params: params.map((param) => {\n const { type, key, validate } = param\n return { type, key, validate }\n }),\n }\n}\n","import type { ValidatePipe } from '../pipe'\nimport { defaultPipe } from '../pipe'\nimport type { ErrorFilter } from '../filter'\nimport { serverFilter } from '../filter'\nimport { WrongMetaException } from '../exception/wrong-meta'\nimport { Pcontext } from './base'\n\nexport class ServerContext extends Pcontext {\n static pipe = defaultPipe\n static filter = serverFilter\n static middlewareRecord: Record<string, (...params: any) => any> = {}\n static useMiddleware(middlewares: string[]) {\n return middlewares.map((m) => {\n if (!(m in ServerContext.middlewareRecord))\n throw new WrongMetaException(`can't find middleware named ${m}`)\n return ServerContext.middlewareRecord[m]\n })\n }\n\n async usePipe(args: { arg: any; validate?: boolean }[], reflect: any[]) {\n return ServerContext.pipe.transform?.(args, reflect)\n }\n\n useFilter(arg: any) {\n return ServerContext.filter(arg, this.data)\n }\n}\n\nexport function addMiddleware(key: string, handler: (...params: any) => any) {\n ServerContext.middlewareRecord[key] = handler\n}\n\nexport function useServerPipe(pipe: ValidatePipe) {\n ServerContext.pipe = pipe\n}\nexport function useServerFilter(filter: ErrorFilter) {\n ServerContext.filter = filter\n}\n","import type { ValidatePipe } from '../pipe'\nimport { defaultPipe } from '../pipe'\nimport type { ErrorFilter } from '../filter'\nimport { rabbitMqFilter } from '../filter'\nimport { WrongMetaException } from '../exception/wrong-meta'\nimport { Pcontext } from './base'\n\nexport class RabbitMqContext extends Pcontext {\n static pipe = defaultPipe\n static filter = rabbitMqFilter\n static middlewareRecord: Record<string, (...params: any) => boolean> = {}\n static useMiddleware(middlewares: string[]) {\n return middlewares.map((m) => {\n if (!(m in RabbitMqContext.middlewareRecord))\n throw new WrongMetaException(`can't find middleware named ${m}`)\n return RabbitMqContext.middlewareRecord[m]\n })\n }\n\n async usePipe(args: { arg: any; validate?: boolean }[], reflect: any[]) {\n return RabbitMqContext.pipe.transform?.(args, reflect)\n }\n\n useFilter(arg: any) {\n return RabbitMqContext.filter(arg, this.data)\n }\n}\nexport function useMqPipe(pipe: ValidatePipe) {\n RabbitMqContext.pipe = pipe\n}\nexport function useMqFilter(filter: ErrorFilter) {\n RabbitMqContext.filter = filter\n}\n","import type { RequestType } from './types'\n\nexport class Pcompiler {\n content = ''\n classMap: Record<string, { [key: string]: string }> = {}\n constructor() { }\n\n getContent() {\n let content = ''\n\n for (const name in this.classMap) {\n content += `\n export class ${name}{\n ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}\n }`\n }\n return content\n }\n\n addMethod(className: string, methodName: string, route = '', requestType: RequestType | '' = '', params: { type: string; key: string; index: number }[] = []) {\n const url = route.replace(/\\/\\:([^\\/]*)/g, '')\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",body:{},query:{},params:{},realParam:'',method:\"${requestType}\",url:\"${url}\"}\n${params.filter(item => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}\\n${c.type === 'params' ? `ret.realParam+='/'+arg${i}\\n` : ''}`, '')}\nreturn ret\n }\n `\n }\n\n addMqMethod(className: string, methodName: string, exchange = '', routeKey = '', queue = '', params: { type: string; key: string; index: number }[] = []) {\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",exchange:\"${exchange}\",routeKey:\"${routeKey}\",queue:\"${queue}\",args:{}}\n${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}\\n`, '')}\nreturn ret\n }\n `\n }\n}\n\nfunction genParams(decorators: any[]) {\n let index = 0\n return decorators.reduce((p) => {\n return `${`${p}arg${index++}`},`\n }, '')\n}\n","export const isUndefined = (obj: any): obj is undefined =>\n typeof obj === 'undefined'\nexport const isNil = (obj: any): obj is null | undefined =>\n isUndefined(obj) || obj === null\n\nexport const isObject = (fn: any): fn is object =>\n !isNil(fn) && typeof fn === 'object'\n\nexport function resolveDep(ret: any, key: string) {\n if (key)\n return ret?.[key]\n return ret\n}\n\n/**\n * @experiment\n */\nexport class Wrap<F, T> {\n constructor(public v1: F,\n public V2: T) {\n\n }\n\n get value() {\n return this.V2\n }\n}\n","export const SERIES_SYMBOL = '__symbol_series__'\nexport const REQ_SYMBOL = '__symbol_req__'\n","import type { Express } from 'express'\nimport { Pcontext, ServerContext, parseMeta } from '../context'\nimport { isObject, resolveDep } from '../utils'\nimport { REQ_SYMBOL, SERIES_SYMBOL } from '../common'\nimport type { Factory } from '../core'\nimport { NotFoundException } from '../exception/not-found'\n\nexport interface Options {\n/**\n * 专用路由的值,默认为/__PHECDA_SERVER__,处理phecda-client发出的合并请求\n */\n route?: string\n /**\n * 全局守卫\n */\n globalGuards?: string[]\n /**\n * 全局拦截器\n */\n globalInterceptors?: string[]\n /**\n * 专用路由的中间件,全局中间件请在bindApp以外设置\n */\n middlewares?: string[]\n}\n\nexport function bindApp(app: Express, { meta, moduleMap }: Awaited<ReturnType<typeof Factory>>, options: Options = {}) {\n const { globalGuards, globalInterceptors, route, middlewares: proMiddle } = { route: '/__PHECDA_SERVER__', globalGuards: [], globalInterceptors: [], middlewares: [], ...options } as Required<Options>\n const methodMap = {} as Record<string, (...args: any[]) => any>\n for (const i of meta) {\n const { name, method, route, header } = i.data\n const instance = moduleMap.get(name)!\n const tag = `${name}-${method}`\n\n Pcontext.metaRecord[tag] = i\n let {\n guards,\n reflect,\n interceptors,\n params,\n middlewares,\n } = Pcontext.metaDataRecord[tag] ? Pcontext.metaDataRecord[tag] : (Pcontext.metaDataRecord[tag] = parseMeta(i))\n\n guards = [...globalGuards!, ...guards]\n interceptors = [...globalInterceptors!, ...interceptors]\n\n const handler = instance[method].bind(instance)\n methodMap[tag] = handler\n Pcontext.instanceRecord[name] = instance\n if (route) {\n app[route.type](route.route, ...ServerContext.useMiddleware(middlewares), async (req, res) => {\n const contextData = {\n request: req,\n tag,\n response: res,\n }\n const context = new ServerContext(tag, contextData)\n\n try {\n for (const name in header)\n res.set(name, header[name])\n await context.useGuard(guards)\n await context.useInterceptor(interceptors)\n const args = await context.usePipe(params.map(({ type, key, validate }) => {\n return { arg: resolveDep((req as any)[type], key), validate }\n }), reflect)\n instance.meta = contextData\n\n const ret = await context.usePost(await handler(...args))\n if (isObject(ret))\n res.json(ret)\n else\n res.send(String(ret))\n }\n catch (e: any) {\n i.handlers.forEach(handler => handler.error?.(e))\n const err = await context.useFilter(e)\n res.status(err.status).json(err)\n }\n })\n }\n }\n\n app.post(route, (req, _res, next) => {\n (req as any)[REQ_SYMBOL] = true\n next()\n }, ...ServerContext.useMiddleware(proMiddle), async (req, res) => {\n const contextData = {\n request: req,\n response: res,\n }\n const context = new ServerContext(route, contextData)\n const ret = [] as any[]\n\n const { body: { category, data } } = req\n if (category === 'series') {\n for (const item of data) {\n const { tag } = item\n const [name] = tag.split('-')\n const {\n guards,\n reflect,\n interceptors,\n params,\n } = Pcontext.metaDataRecord[tag]\n const instance = moduleMap.get(name)\n\n try {\n if (!params)\n throw new NotFoundException(`\"${tag}\" doesn't exist`)\n\n await context.useGuard(guards, true)\n await context.useInterceptor(interceptors, true)\n const args = await context.usePipe(params.map(({ type, key, validate }) => {\n const arg = resolveDep(item[type], key)\n if (typeof arg === 'string' && arg.startsWith(SERIES_SYMBOL)) {\n const [, index, argKey] = arg.split('@')\n return { arg: resolveDep(ret[Number(index)], argKey || key), validate }\n }\n\n return { arg, validate }\n }), reflect) as any\n instance.meta = contextData\n\n ret.push(await context.usePost(await methodMap[tag](...args)))\n }\n catch (e: any) {\n const m = Pcontext.metaRecord[tag]\n m.handlers.forEach(handler => handler.error?.(e))\n ret.push(await context.useFilter(e))\n }\n }\n return res.json(ret)\n }\n if (category === 'parallel') {\n return Promise.all(data.map((item: any) => {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n const { tag } = item\n const [name] = tag.split('-')\n const {\n guards,\n reflect,\n interceptors,\n params,\n } = Pcontext.metaDataRecord[tag]\n const instance = moduleMap.get(name)\n\n try {\n if (!params)\n throw new NotFoundException(`\"${tag}\" doesn't exist`)\n\n await context.useGuard(guards, true)\n await context.useInterceptor(interceptors, true)\n const args = await context.usePipe(params.map(({ type, key, validate }) => {\n const arg = resolveDep(item[type], key)\n return { arg, validate }\n }), reflect) as any\n instance.meta = contextData\n resolve(await context.usePost(await methodMap[tag](...args)))\n }\n catch (e: any) {\n const m = Pcontext.metaRecord[tag]\n m.handlers.forEach(handler => handler.error?.(e))\n resolve(await context.useFilter(e))\n }\n })\n })).then((ret) => {\n res.json(ret)\n })\n }\n\n res.json(await context.useFilter(new NotFoundException('category should be \\'parallel\\' or \\'series\\'')))\n })\n}\n","import 'reflect-metadata'\nimport EventEmitter from 'events'\nimport type { Phecda } from 'phecda-core'\nimport { getExposeKey, getHandler, getState, injectProperty, registerAsync } from 'phecda-core'\nimport type { Construct, PhecdaEmitter, ServerMeta } from './types'\nimport { Pmeta } from './meta'\n\n// TODO: support both phecda-emitter types and origin emitter type in future\nexport const emitter: PhecdaEmitter = new EventEmitter() as any\n\nexport async function Factory<T>(Modules: Construct<T>[]) {\n const moduleMap = new Map<string, InstanceType<Construct>>()\n const meta: Pmeta[] = []\n injectProperty('watcher', ({ eventName, instance, key, options }: { eventName: string; instance: any; key: string; options?: { once: boolean } }) => {\n const fn = typeof instance[key] === 'function' ? instance[key].bind(instance) : (v: any) => instance[key] = v\n\n if (options?.once)\n (emitter as any).once(eventName, fn)\n\n else\n (emitter as any).on(eventName, fn)\n })\n\n for (const Module of Modules)\n await buildNestModule(Module, moduleMap, meta) as InstanceType<Construct<T>>\n\n return { moduleMap, meta }\n}\n\nasync function buildNestModule(Module: Construct, map: Map<string, InstanceType<Construct>>, meta: Pmeta[]) {\n const paramtypes = getParamtypes(Module) as Construct[]\n let instance: InstanceType<Construct>\n const name = Module.prototype._namespace?.__TAG__ || Module.name\n if (map.has(name)) {\n instance = map.get(name)\n if (!instance)\n throw new Error(`exist Circular Module dep--${Module}`)\n\n return instance\n }\n map.set(name, undefined)\n if (paramtypes) {\n for (const i in paramtypes)\n paramtypes[i] = await buildNestModule(paramtypes[i], map, meta)\n\n instance = new Module(...paramtypes)\n }\n else {\n instance = new Module()\n }\n meta.push(...getMetaFromInstance(instance, Module.name))\n await registerAsync(instance)\n map.set(name, instance)\n\n return instance\n}\n\nfunction getMetaFromInstance(instance: Phecda, name: string) {\n const vars = getExposeKey(instance).filter(item => item !== '__CLASS')\n const baseState = (getState(instance, '__CLASS') || {}) as ServerMeta\n initState(baseState)\n return vars.map((i) => {\n const state = (getState(instance, i) || {}) as ServerMeta\n if (baseState.route && state.route)\n state.route.route = baseState.route.route + state.route.route\n state.name = name\n state.method = i\n const params = [] as any[]\n for (const i of state.params || []) {\n params.unshift(i)\n if (i.index === 0)\n break\n }\n state.params = params\n initState(state)\n state.header = Object.assign({}, baseState.header, state.header)\n state.middlewares = [...new Set([...baseState.middlewares, ...state.middlewares])]\n state.guards = [...new Set([...baseState.guards, ...state.guards])]\n state.interceptors = [...new Set([...baseState.interceptors, ...state.interceptors])]\n\n return new Pmeta(state as unknown as ServerMeta, getHandler(instance, i), getParamtypes(instance, i) || [])\n })\n}\n\nfunction getParamtypes(Module: any, key?: string | symbol) {\n return Reflect.getMetadata('design:paramtypes', Module, key!)\n}\n\nfunction initState(state: any) {\n if (!state.header)\n state.header = {}\n if (!state.middlewares)\n state.middlewares = []\n if (!state.guards)\n state.guards = []\n if (!state.interceptors)\n state.interceptors = []\n}\n","import type { PHandler, ServerMeta } from './types'\n\nexport class Pmeta {\n constructor(public data: ServerMeta, public handlers: PHandler[], public reflect: any[]) {\n\n }\n}\n","import { mergeState, setModalVar } from 'phecda-core'\n\nexport function Inject(_target: any) { }\n\nexport function Header(name: string, value: string) {\n return (target: any, k: PropertyKey) => {\n setModalVar(target, k)\n mergeState(target, k, {\n header: { name, value },\n })\n }\n}\n\nexport * from './param'\nexport * from './route'\n\nexport * from './micro'\n","import { mergeState, setModalVar } from 'phecda-core'\n\nexport function BaseParam(type: string, key: string, validate?: boolean): any {\n return (target: any, k: PropertyKey, index: number) => {\n setModalVar(target, k)\n mergeState(target, k, {\n params: [{ type, key, index, validate }],\n })\n }\n}\n\nexport function Body(key = '', validate?: boolean) {\n return BaseParam('body', key, validate)\n}\nexport function Query(key: string, validate?: boolean) {\n return BaseParam('query', key, validate)\n}\nexport function Param(key: string, validate?: boolean) {\n return BaseParam('params', key, validate)\n}\n","import { mergeState, setModalVar } from 'phecda-core'\n\nexport function Route(route: string, type?: string): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n route: {\n route,\n type,\n },\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n route: {\n route,\n type,\n },\n })\n }\n }\n}\n\nexport function Get(route: string) {\n return Route(route, 'get')\n}\n\nexport function Post(route: string) {\n return Route(route, 'post')\n}\nexport function Put(route: string) {\n return Route(route, 'put')\n}\n\nexport function Delete(route: string) {\n return Route(route, 'delete')\n}\n\nexport function Controller(route: string) {\n return Route(route)\n}\n\nexport function Guard(...guards: string[]): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n guards: [...guards],\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n guards: [...guards],\n })\n }\n }\n}\n\nexport function Middle(...middlewares: string[]): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n middlewares: [...middlewares],\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n middlewares: [...middlewares],\n })\n }\n }\n}\n\nexport function Interceptor(...interceptors: string[]): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n interceptors: [...interceptors],\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n interceptors: [...interceptors],\n })\n }\n }\n}\n","import { mergeState, setModalVar } from 'phecda-core'\nimport type amqplib from 'amqplib'\nexport function MQ(queue: string, routeKey: string, options?: amqplib.Options.Consume) {\n return (target: any, k: PropertyKey) => {\n setModalVar(target, k)\n mergeState(target, k, {\n mq: {\n queue,\n routeKey,\n options,\n },\n })\n }\n}\n","import { resolve } from 'path'\nimport type { PluginOption } from 'vite'\nimport { normalizePath } from 'vite'\nimport { Pcompiler } from '../compiler'\nimport type { ServerMeta } from '../types'\nexport function Server(localPath = 'pmeta.js'): PluginOption {\n let root: string\n let metaPath: string\n let command: string\n return {\n name: 'phecda-server-vite:client',\n enforce: 'pre',\n configResolved(config) {\n command = config.command\n root = config.root || process.cwd()\n metaPath = normalizePath(resolve(root, localPath))\n },\n\n buildStart() {\n if (command === 'build') {\n this.emitFile({\n type: 'chunk',\n id: metaPath,\n fileName: localPath,\n preserveSignature: 'allow-extension',\n })\n }\n },\n resolveId(id) {\n if (id.endsWith('.controller'))\n\n return metaPath\n },\n\n transform(code, id) {\n if (id === metaPath) {\n const meta = JSON.parse(code) as ServerMeta[]\n const compiler = new Pcompiler()\n\n for (const i of meta)\n compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params)\n\n return {\n code: compiler.getContent(),\n }\n }\n },\n }\n}\n","export const Pconfig = {\n rabbitmq: {\n guard: false,\n interceptor: false,\n },\n}\n","import type amqplib from 'amqplib'\n\nimport { Pcontext, RabbitMqContext, parseMeta } from '../context'\nimport { resolveDep } from '../utils'\nimport { Pconfig } from '../config'\nimport type { Factory } from '../core'\nexport async function bindMQ(ch: amqplib.Channel, { meta, moduleMap }: Awaited<ReturnType<typeof Factory>>) {\n for (const item of meta) {\n const { route, name, method, mq: { routeKey, queue: queueName, options } = {} } = item.data\n const tag = `${name}-${method}`\n Pcontext.metaRecord[tag] = item\n\n const {\n guards,\n reflect,\n interceptors,\n params,\n } = Pcontext.metaDataRecord[tag] ? Pcontext.metaDataRecord[tag] : (Pcontext.metaDataRecord[tag] = parseMeta(item))\n const instance = moduleMap.get(name)!\n const handler = instance[method].bind(instance)\n\n Pcontext.instanceRecord[name] = instance\n\n if (route) {\n const { queue } = await ch.assertQueue(route.route)\n if (queueName && routeKey)\n await ch.bindQueue(queue, queueName, routeKey)\n\n ch.consume(route.route, async (msg) => {\n if (msg !== null) {\n const content = msg.content.toString()\n\n const data = params.length > 0 ? JSON.parse(content) : content\n const contextMeta = {\n message: msg,\n content,\n channel: ch,\n\n }\n const context = new RabbitMqContext(tag, contextMeta)\n\n try {\n if (Pconfig.rabbitmq.guard)\n await context.useGuard(guards)\n if (Pconfig.rabbitmq.interceptor)\n await context.useInterceptor(interceptors)\n\n const args = await context.usePipe(params.map(({ key, validate }) => {\n return { arg: resolveDep(data, key), validate }\n }), reflect)\n\n instance.meta = contextMeta\n\n await context.usePost(await handler(...args))\n ch.ack(msg)\n }\n catch (e) {\n item.handlers.forEach(handler => handler.error?.(e))\n context.useFilter(e)\n }\n }\n else {\n // console.log('Consumer cancelled by server')\n }\n }, options)\n }\n }\n}\n\ntype MqMethod<T> = (arg: T) => void\n\n/**\n * @experiment\n */\nexport async function createPub<T extends (...args: any[]) => any>(ch: amqplib.Channel, method: T, type?: string): Promise<MqMethod<Parameters<T>>> {\n const { exchange, routeKey, queue } = method()\n if (exchange)\n await ch.assertExchange(exchange, type!)\n\n else\n await ch.assertQueue(queue)\n\n return async (arg: Parameters<T>) => {\n const { args } = method(arg)\n const msg = Buffer.from(JSON.stringify(args))\n if (exchange)\n await ch.publish(exchange, routeKey, msg)\n\n else\n await ch.sendToQueue(queue, msg)\n }\n}\n","import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport type { PError, PRes, RequestType, ResOrErr } from '../types'\nimport { SERIES_SYMBOL } from '../common'\ninterface RequestArgs {\n body: Record<string, any>\n query: Record<string, string>\n params: Record<string, string>\n realParam: string\n method: RequestType\n url: string\n tag: string\n}\ntype MergedReqArg = Pick<RequestArgs, 'body' | 'query' | 'params' | 'tag' >\nexport function toReq(arg: RequestArgs) {\n const { body, query, realParam, method, url } = arg\n return { method, url, body, query: Object.keys(query).length > 0 ? `?${Object.entries(query).map(([k, v]) => `${k}=${v}`).join('&')}` : '', params: realParam }\n}\n\nexport const merge = (...args: RequestArgs[]) => {\n const ret = [] as MergedReqArg[]\n for (const i of args) {\n const { body, query, params, tag } = i\n ret.push({ tag, body, query, params })\n }\n\n return ret\n}\n\nexport type RequestMethod = <F extends (...args: any[]) => any >(fn: F, args: Parameters<F>) => Promise<ReturnType<F>>\n\nexport function createReq(instance: AxiosInstance): <R>(arg: R, config?: AxiosRequestConfig) => Promise<AxiosResponse<PRes<Awaited<R>>> > {\n // @ts-expect-error methods without route decorator won't send request\n return (arg: any, config?: AxiosRequestConfig) => {\n const { url, params, query, body, method } = toReq(arg as RequestArgs)\n if (!method) {\n console.warn('methods without route decorator won\\'t send request')\n return\n }\n\n const ret = [`${url}${params}${query}`] as any[]\n body && ret.push(body)\n config && ret.push(config)\n // @ts-expect-error misdirction\n return instance[method](...ret)\n }\n}\n\nexport function createSeriesReq(instance: AxiosInstance, key = '/__PHECDA_SERVER__'): < R extends unknown[]>(args: R, config?: AxiosRequestConfig) => Promise<AxiosResponse<ResOrErr<PRes<R>>>> {\n // @ts-expect-error misdirction\n return (args: RequestArgs[], config?: AxiosRequestConfig) => {\n return instance.post(key, {\n category: 'series',\n data: merge(...args),\n }, config)\n }\n}\n\nexport function createParallelReq(instance: AxiosInstance, key = '/__PHECDA_SERVER__'): < R extends unknown[]>(args: R, config?: AxiosRequestConfig) => Promise<AxiosResponse<ResOrErr<PRes<R>>>> {\n // @ts-expect-error misdirction\n return (args: RequestArgs[], config?: AxiosRequestConfig) => {\n return instance.post(key, {\n category: 'parallel',\n data: merge(...args),\n }, config)\n }\n}\n\nexport function isError<T = any>(data: T | PError): data is PError {\n return typeof data === 'object' && (data as any).error\n}\n\nexport function $S(index: number, key = ''): any {\n return `${SERIES_SYMBOL}@${index}@${key}`\n}\n","import type amqplib from 'amqplib'\nexport * from './axios'\n\nexport function createMqReq(channel: amqplib.Channel): <R>(arg: R) => Promise<void> {\n return async (arg: any) => {\n const { url, body } = arg\n await channel.assertQueue(url)\n await channel.sendToQueue(url, Buffer.from(JSON.stringify(body)))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,yBAAuC;;;ACAhC,IAAMA,gBAAN,cAA4BC,MAAAA;EACdC;EAAwBC;EAAuBC;EAAlEC,YAAmBH,SAAwBC,QAAuBC,cAAc,kBAAkB;AAChG,UAAMF,OAAAA;mBADWA;kBAAwBC;uBAAuBC;EAElE;EAEA,IAAIE,OAAO;AACT,WAAO;MAAEJ,SAAS,KAAKA;MAASE,aAAa,KAAKA;MAAaD,QAAQ,KAAKA;MAAQI,OAAO;IAAK;EAClG;AACF;AARaP;;;ACEN,IAAMQ,oBAAN,cAAgCC,cAAAA;EACrCC,YAAYC,SAAiB;AAC3B,UAAMA,SAAS,KAAK,oBAAA;EACtB;AACF;AAJaH;;;AFKN,IAAMI,cAAc;EACzB,MAAMC,UAAUC,MAAyCC,SA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BAAiI;AAEhM,SAAO,CAACX,MAAqBO,WAAgC;AAC3D,WAAOD,SAASM,KAAKD,KAAK;MACxBE,UAAU;MACVC,MAAMf,MAAAA,GAASC,IAAAA;IACjB,GAAGO,MAAAA;EACL;AACF;AARgBQ;AAUT,SAASC,QAAiBF,MAAkC;AACjE,SAAO,OAAOA,SAAS,YAAaA,KAAaG;AACnD;AAFgBD;AAIT,SAASE,GAAGC,OAAeR,MAAM,IAAS;AAC/C,SAAO,GAAGS,iBAAiBD,SAASR;AACtC;AAFgBO;;;ACpET,SAASG,YAAYC,SAAwD;AAClF,SAAO,OAAOC,QAAa;AACzB,UAAM,EAAEC,KAAKC,KAAI,IAAKF;AACtB,UAAMD,QAAQI,YAAYF,GAAAA;AAC1B,UAAMF,QAAQK,YAAYH,KAAKI,OAAOC,KAAKC,KAAKC,UAAUN,IAAAA,CAAAA,CAAAA;EAC5D;AACF;AANgBJ;","names":["HttpException","Error","message","status","description","constructor","data","error","ValidateException","HttpException","constructor","message","defaultPipe","transform","args","reflect","i","validate","arg","constructor","ValidateException","name","isPhecda","ret","plainToClass","err","length","map","item","UndefinedException","HttpException","constructor","message","ForbiddenException","HttpException","constructor","message","BadRequestException","HttpException","constructor","message","WrongMetaException","HttpException","constructor","message","NotFoundException","HttpException","constructor","message","serverFilter","e","HttpException","UndefinedException","message","data","rabbitMqFilter","channel","reject","Phistroy","guard","interceptor","record","name","type","includes","push","Pcontext","key","data","method","params","post","history","constructor","Phistroy","registerGuard","handler","guardsRecord","registerInterceptor","interceptorsRecord","useGuard","guards","isMerge","guard","record","WrongMetaException","ForbiddenException","useInterceptor","interceptors","ret","interceptor","push","usePost","cb","metaRecord","metaDataRecord","instanceRecord","addGuard","addInterceptor","getInstance","tag","parseMeta","meta","middlewares","reflect","map","param","type","validate","ServerContext","Pcontext","useMiddleware","middlewares","map","m","middlewareRecord","WrongMetaException","usePipe","args","reflect","pipe","transform","useFilter","arg","filter","data","defaultPipe","serverFilter","addMiddleware","key","handler","useServerPipe","useServerFilter","RabbitMqContext","Pcontext","useMiddleware","middlewares","map","m","middlewareRecord","WrongMetaException","usePipe","args","reflect","pipe","transform","useFilter","arg","filter","data","defaultPipe","rabbitMqFilter","useMqPipe","useMqFilter","Pcompiler","content","classMap","constructor","getContent","name","Object","values","reduce","p","c","addMethod","className","methodName","route","requestType","params","url","replace","genParams","filter","item","key","i","type","addMqMethod","exchange","routeKey","queue","decorators","index","isUndefined","obj","isNil","isObject","fn","resolveDep","ret","key","SERIES_SYMBOL","REQ_SYMBOL","bindApp","app","meta","moduleMap","options","globalGuards","globalInterceptors","route","middlewares","proMiddle","methodMap","i","name","method","header","data","instance","get","tag","Pcontext","metaRecord","guards","reflect","interceptors","params","metaDataRecord","parseMeta","handler","bind","instanceRecord","type","ServerContext","useMiddleware","req","res","contextData","request","response","context","set","useGuard","useInterceptor","args","usePipe","map","key","validate","arg","resolveDep","ret","usePost","isObject","json","send","String","e","handlers","forEach","error","err","useFilter","status","post","_res","next","REQ_SYMBOL","body","category","item","split","NotFoundException","startsWith","SERIES_SYMBOL","index","argKey","Number","push","m","Promise","all","resolve","then","import_phecda_core","Pmeta","data","handlers","reflect","constructor","emitter","EventEmitter","Factory","Modules","moduleMap","Map","meta","injectProperty","eventName","instance","key","options","fn","bind","v","once","on","Module","buildNestModule","map","paramtypes","getParamtypes","name","prototype","_namespace","__TAG__","has","get","Error","set","undefined","i","push","getMetaFromInstance","registerAsync","vars","getExposeKey","filter","item","baseState","getState","initState","state","route","method","params","unshift","index","header","Object","assign","middlewares","Set","guards","interceptors","Pmeta","getHandler","Reflect","getMetadata","import_phecda_core","import_phecda_core","BaseParam","type","key","validate","target","k","index","setModalVar","mergeState","params","Body","Query","Param","import_phecda_core","Route","route","type","target","key","setModalVar","mergeState","prototype","Get","Post","Put","Delete","Controller","Guard","guards","Middle","middlewares","Interceptor","interceptors","import_phecda_core","MQ","queue","routeKey","options","target","k","setModalVar","mergeState","mq","Inject","_target","Header","name","value","target","k","setModalVar","mergeState","header","Server","localPath","root","metaPath","command","name","enforce","configResolved","config","process","cwd","normalizePath","resolve","buildStart","emitFile","type","id","fileName","preserveSignature","resolveId","endsWith","transform","code","meta","JSON","parse","compiler","Pcompiler","i","addMethod","method","route","params","getContent","Pconfig","rabbitmq","guard","interceptor","bindMQ","ch","meta","moduleMap","item","route","name","method","mq","routeKey","queue","queueName","options","data","tag","Pcontext","metaRecord","guards","reflect","interceptors","params","metaDataRecord","parseMeta","instance","get","handler","bind","instanceRecord","assertQueue","bindQueue","consume","msg","content","toString","length","JSON","parse","contextMeta","message","channel","context","RabbitMqContext","Pconfig","rabbitmq","guard","useGuard","interceptor","useInterceptor","args","usePipe","map","key","validate","arg","resolveDep","usePost","ack","e","handlers","forEach","error","useFilter","createPub","type","exchange","assertExchange","Buffer","from","stringify","publish","sendToQueue","toReq","arg","body","query","realParam","method","url","Object","keys","length","entries","map","k","v","join","params","merge","args","ret","i","tag","push","createReq","instance","config","console","warn","createSeriesReq","key","post","category","data","createParallelReq","isError","error","$S","index","SERIES_SYMBOL","createMqReq","channel","arg","url","body","assertQueue","sendToQueue","Buffer","from","JSON","stringify"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/pipe.ts","../src/exception/base.ts","../src/exception/validate.ts","../src/exception/undefine.ts","../src/exception/forbidden.ts","../src/exception/bad-request.ts","../src/exception/wrong-meta.ts","../src/exception/not-found.ts","../src/filter.ts","../src/history.ts","../src/context/base.ts","../src/context/server.ts","../src/context/micro.ts","../src/compiler.ts","../src/utils.ts","../src/common.ts","../src/server/express.ts","../src/core.ts","../src/meta.ts","../src/decorators/index.ts","../src/decorators/param.ts","../src/decorators/route.ts","../src/decorators/micro.ts","../src/config.ts","../src/micro-services/rabbitmq.ts","../src/client/axios.ts","../src/client/server.ts"],"sourcesContent":["export * from './context'\nexport * from './types'\nexport * from './compiler'\nexport * from './server/express'\nexport * from './core'\nexport * from './decorators'\nexport * from './exception'\nexport * from './pipe'\nexport * from './meta'\nexport * from 'phecda-core'\nexport * from './micro-services/rabbitmq'\nexport * from './client/server'\n","import { isPhecda, plainToClass } from 'phecda-core'\nimport { ValidateException } from './exception/validate'\n\nexport interface ValidatePipe {\n transform(args: { arg: any; validate?: boolean }[], reflect: any[]): Promise<any[]>\n}\n\nexport const defaultPipe = {\n async transform(args: { arg: any; validate: boolean }[], reflect: any[]) {\n for (const i in args) {\n const { validate, arg } = args[i]\n if (validate === false)\n continue\n\n if (isPhecda(reflect[i])) {\n const ret = await plainToClass(reflect[i], arg, { transform: true })\n if (ret.err.length > 0)\n throw new ValidateException(ret.err[0])\n args[i].arg = ret.data\n }\n else {\n args[i].arg = reflect[i](arg)\n }\n }\n return args.map(item => item.arg)\n },\n} as ValidatePipe\n","export class HttpException extends Error {\n constructor(public message: string, public status: number, public description = 'Http exception') {\n super(message)\n }\n\n get data() {\n return { message: this.message, description: this.description, status: this.status, error: true }\n }\n}\n\n// export class BaseException extends Error {\n// constructor(public message: string, public description = 'Base exception') {\n// super(message)\n// }\n\n// get data() {\n// return { message: this.message, description: this.description, status: this.status, error: true }\n// }\n// }\n","import { HttpException } from './base'\n\nexport class ValidateException extends HttpException {\n constructor(message: string) {\n super(message, 400, 'Validate exception')\n }\n}\n","import { HttpException } from './base'\n\nexport class UndefinedException extends HttpException {\n constructor(message: string) {\n super(message, 500, 'Undefined error')\n }\n}\n","import { HttpException } from './base'\n\nexport class ForbiddenException extends HttpException {\n constructor(message: string) {\n super(message, 403, 'Forbidden resource')\n }\n}\n","import { HttpException } from './base'\n\nexport class BadRequestException extends HttpException {\n constructor(message: string) {\n super(message, 400, 'Bad Request')\n }\n}\n","import { HttpException } from './base'\n\nexport class WrongMetaException extends HttpException {\n constructor(message: string) {\n super(message, 500, 'Meta is not correct')\n }\n}\n","import { HttpException } from './base'\n\nexport class NotFoundException extends HttpException {\n constructor(message: string) {\n super(message, 404, 'Not Found')\n }\n}\n","import { HttpException, UndefinedException } from './exception'\nexport type ErrorFilter<E extends HttpException = any> = (err: E | Error, contextData: any) => any\n\nexport const serverFilter: ErrorFilter = (e: any) => {\n if (!(e instanceof HttpException))\n e = new UndefinedException(e.message || e)\n return e.data\n}\n\nexport const rabbitMqFilter: ErrorFilter = (e: any, data) => {\n const { channel, message } = data\n channel!.reject(message!, true)\n}\n","export class Phistroy {\n guard: string[] = []\n interceptor: string[] = []\n record(name: string, type: 'guard' | 'interceptor') {\n if (!this[type].includes(name)) {\n this[type].push(name)\n return true\n }\n return false\n }\n}\n","import { WrongMetaException } from '../exception/wrong-meta'\nimport { Phistroy } from '../history'\nimport { ForbiddenException } from '../exception'\n\nimport type { Pmeta } from '../meta'\n\nexport abstract class Pcontext {\n method: string\n params: string[]\n\n static metaRecord: Record<string, Pmeta> = {}\n static metaDataRecord: Record<string, ReturnType<typeof parseMeta>> = {}\n static instanceRecord: Record<string, any> = {}\n static guardsRecord: Record<string, (req: any, isMerge: boolean) => boolean> = {}\n static interceptorsRecord: Record<string, (req: any, isMerge: boolean) => any > = {}\n // static serverRecord: Record<string, Pcontext> = {}\n post: ((...params: any) => any)[]\n history = new Phistroy()\n constructor(public key: string, public data: any) {\n }\n\n static registerGuard(key: string, handler: any) {\n Pcontext.guardsRecord[key] = handler\n }\n\n static registerInterceptor(key: string, handler: any) {\n Pcontext.interceptorsRecord[key] = handler\n }\n\n async useGuard(guards: string[], isMerge = false) {\n for (const guard of guards) {\n if (this.history.record(guard, 'guard')) {\n if (!(guard in Pcontext.guardsRecord))\n throw new WrongMetaException(`can't find guard named ${guard}`)\n if (!await Pcontext.guardsRecord[guard](this.data, isMerge))\n throw new ForbiddenException(`Guard exception--${guard}`)\n }\n }\n }\n\n async useInterceptor(interceptors: string[], isMerge = false) {\n const ret = []\n for (const interceptor of interceptors) {\n if (this.history.record(interceptor, 'interceptor')) {\n if (!(interceptor in Pcontext.interceptorsRecord))\n throw new WrongMetaException(`can't find guard named ${interceptor}`)\n const post = await Pcontext.interceptorsRecord[interceptor](this.data, isMerge)\n if (post)\n ret.push(post)\n }\n }\n this.post = ret\n }\n\n async usePost(data: any) {\n if (!this.post)\n return data\n for (const cb of this.post)\n data = (await cb(data)) | data\n\n return data\n }\n}\n\nexport function addGuard(key: string, handler: (contextData: any, isMerge: boolean) => boolean) {\n Pcontext.registerGuard(key, handler)\n}\n\nexport function addInterceptor(key: string, handler: (contextData: any, isMerge: boolean) => any) {\n Pcontext.registerInterceptor(key, handler)\n}\nexport function getInstance(tag: string) {\n return Pcontext.instanceRecord[tag]\n}\n\nexport function parseMeta(meta: Pmeta) {\n const { data: { params, guards, interceptors, middlewares }, reflect } = meta\n return {\n guards,\n reflect,\n interceptors,\n middlewares,\n params: params.map((param) => {\n const { type, key, validate } = param\n return { type, key, validate }\n }),\n }\n}\n","import type { ValidatePipe } from '../pipe'\nimport { defaultPipe } from '../pipe'\nimport type { ErrorFilter } from '../filter'\nimport { serverFilter } from '../filter'\nimport { WrongMetaException } from '../exception/wrong-meta'\nimport { Pcontext } from './base'\n\nexport class ServerContext extends Pcontext {\n static pipe = defaultPipe\n static filter = serverFilter\n static middlewareRecord: Record<string, (...params: any) => any> = {}\n static useMiddleware(middlewares: string[]) {\n return middlewares.map((m) => {\n if (!(m in ServerContext.middlewareRecord))\n throw new WrongMetaException(`can't find middleware named ${m}`)\n return ServerContext.middlewareRecord[m]\n })\n }\n\n async usePipe(args: { arg: any; validate?: boolean }[], reflect: any[]) {\n return ServerContext.pipe.transform?.(args, reflect)\n }\n\n useFilter(arg: any) {\n return ServerContext.filter(arg, this.data)\n }\n}\n\nexport function addMiddleware(key: string, handler: (...params: any) => any) {\n ServerContext.middlewareRecord[key] = handler\n}\n\nexport function useServerPipe(pipe: ValidatePipe) {\n ServerContext.pipe = pipe\n}\nexport function useServerFilter(filter: ErrorFilter) {\n ServerContext.filter = filter\n}\n","import type { ValidatePipe } from '../pipe'\nimport { defaultPipe } from '../pipe'\nimport type { ErrorFilter } from '../filter'\nimport { rabbitMqFilter } from '../filter'\nimport { WrongMetaException } from '../exception/wrong-meta'\nimport { Pcontext } from './base'\n\nexport class RabbitMqContext extends Pcontext {\n static pipe = defaultPipe\n static filter = rabbitMqFilter\n static middlewareRecord: Record<string, (...params: any) => boolean> = {}\n static useMiddleware(middlewares: string[]) {\n return middlewares.map((m) => {\n if (!(m in RabbitMqContext.middlewareRecord))\n throw new WrongMetaException(`can't find middleware named ${m}`)\n return RabbitMqContext.middlewareRecord[m]\n })\n }\n\n async usePipe(args: { arg: any; validate?: boolean }[], reflect: any[]) {\n return RabbitMqContext.pipe.transform?.(args, reflect)\n }\n\n useFilter(arg: any) {\n return RabbitMqContext.filter(arg, this.data)\n }\n}\nexport function useMqPipe(pipe: ValidatePipe) {\n RabbitMqContext.pipe = pipe\n}\nexport function useMqFilter(filter: ErrorFilter) {\n RabbitMqContext.filter = filter\n}\n","import type { RequestType } from './types'\n\nexport class Pcompiler {\n content = ''\n classMap: Record<string, { [key: string]: string }> = {}\n constructor() { }\n\n getContent() {\n let content = ''\n\n for (const name in this.classMap) {\n content += `\n export class ${name}{\n ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}\n }`\n }\n return content\n }\n\n addMethod(className: string, methodName: string, route = '', requestType: RequestType | '' = '', params: { type: string; key: string; index: number }[] = []) {\n const url = route.replace(/\\/\\:([^\\/]*)/g, '')\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",body:{},query:{},params:{},realParam:'',method:\"${requestType}\",url:\"${url}\"}\n${params.filter(item => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}\\n${c.type === 'params' ? `ret.realParam+='/'+arg${i}\\n` : ''}`, '')}\nreturn ret\n }\n `\n }\n\n addMqMethod(className: string, methodName: string, exchange = '', routeKey = '', queue = '', params: { type: string; key: string; index: number }[] = []) {\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",exchange:\"${exchange}\",routeKey:\"${routeKey}\",queue:\"${queue}\",args:{}}\n${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}\\n`, '')}\nreturn ret\n }\n `\n }\n}\n\nfunction genParams(decorators: any[]) {\n let index = 0\n return decorators.reduce((p) => {\n return `${`${p}arg${index++}`},`\n }, '')\n}\n","export const isUndefined = (obj: any): obj is undefined =>\n typeof obj === 'undefined'\nexport const isNil = (obj: any): obj is null | undefined =>\n isUndefined(obj) || obj === null\n\nexport const isObject = (fn: any): fn is object =>\n !isNil(fn) && typeof fn === 'object'\n\nexport function resolveDep(ret: any, key: string) {\n if (key)\n return ret?.[key]\n return ret\n}\n\n/**\n * @experiment\n */\nexport class Wrap<F, T> {\n constructor(public v1: F,\n public V2: T) {\n\n }\n\n get value() {\n return this.V2\n }\n}\n","export const SERIES_SYMBOL = '__symbol_series__'\nexport const REQ_SYMBOL = '__symbol_req__'\n","import type { Express } from 'express'\nimport { Pcontext, ServerContext, parseMeta } from '../context'\nimport { isObject, resolveDep } from '../utils'\nimport { REQ_SYMBOL, SERIES_SYMBOL } from '../common'\nimport type { Factory } from '../core'\nimport { NotFoundException } from '../exception/not-found'\n\nexport interface Options {\n/**\n * 专用路由的值,默认为/__PHECDA_SERVER__,处理phecda-client发出的合并请求\n */\n route?: string\n /**\n * 全局守卫\n */\n globalGuards?: string[]\n /**\n * 全局拦截器\n */\n globalInterceptors?: string[]\n /**\n * 专用路由的中间件,全局中间件请在bindApp以外设置\n */\n middlewares?: string[]\n}\n\nexport function bindApp(app: Express, { meta, moduleMap }: Awaited<ReturnType<typeof Factory>>, options: Options = {}) {\n const { globalGuards, globalInterceptors, route, middlewares: proMiddle } = { route: '/__PHECDA_SERVER__', globalGuards: [], globalInterceptors: [], middlewares: [], ...options } as Required<Options>\n const methodMap = {} as Record<string, (...args: any[]) => any>\n for (const i of meta) {\n const { name, method, route, header } = i.data\n const instance = moduleMap.get(name)!\n const tag = `${name}-${method}`\n\n Pcontext.metaRecord[tag] = i\n let {\n guards,\n reflect,\n interceptors,\n params,\n middlewares,\n } = Pcontext.metaDataRecord[tag] ? Pcontext.metaDataRecord[tag] : (Pcontext.metaDataRecord[tag] = parseMeta(i))\n\n guards = [...globalGuards!, ...guards]\n interceptors = [...globalInterceptors!, ...interceptors]\n\n const handler = instance[method].bind(instance)\n methodMap[tag] = handler\n Pcontext.instanceRecord[name] = instance\n if (route) {\n app[route.type](route.route, ...ServerContext.useMiddleware(middlewares), async (req, res) => {\n const contextData = {\n request: req,\n tag,\n response: res,\n }\n const context = new ServerContext(tag, contextData)\n\n try {\n for (const name in header)\n res.set(name, header[name])\n await context.useGuard(guards)\n await context.useInterceptor(interceptors)\n const args = await context.usePipe(params.map(({ type, key, validate }) => {\n return { arg: resolveDep((req as any)[type], key), validate }\n }), reflect)\n instance.meta = contextData\n\n const ret = await context.usePost(await handler(...args))\n if (isObject(ret))\n res.json(ret)\n else\n res.send(String(ret))\n }\n catch (e: any) {\n i.handlers.forEach(handler => handler.error?.(e))\n const err = await context.useFilter(e)\n res.status(err.status).json(err)\n }\n })\n }\n }\n\n app.post(route, (req, _res, next) => {\n (req as any)[REQ_SYMBOL] = true\n next()\n }, ...ServerContext.useMiddleware(proMiddle), async (req, res) => {\n const contextData = {\n request: req,\n response: res,\n }\n const context = new ServerContext(route, contextData)\n const ret = [] as any[]\n\n const { body: { category, data } } = req\n if (category === 'series') {\n for (const item of data) {\n const { tag } = item\n const [name] = tag.split('-')\n const {\n guards,\n reflect,\n interceptors,\n params,\n } = Pcontext.metaDataRecord[tag]\n const instance = moduleMap.get(name)\n\n try {\n if (!params)\n throw new NotFoundException(`\"${tag}\" doesn't exist`)\n\n await context.useGuard(guards, true)\n await context.useInterceptor(interceptors, true)\n const args = await context.usePipe(params.map(({ type, key, validate }) => {\n const arg = resolveDep(item[type], key)\n if (typeof arg === 'string' && arg.startsWith(SERIES_SYMBOL)) {\n const [, index, argKey] = arg.split('@')\n return { arg: resolveDep(ret[Number(index)], argKey || key), validate }\n }\n\n return { arg, validate }\n }), reflect) as any\n instance.meta = contextData\n\n ret.push(await context.usePost(await methodMap[tag](...args)))\n }\n catch (e: any) {\n const m = Pcontext.metaRecord[tag]\n m.handlers.forEach(handler => handler.error?.(e))\n ret.push(await context.useFilter(e))\n }\n }\n return res.json(ret)\n }\n if (category === 'parallel') {\n return Promise.all(data.map((item: any) => {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n const { tag } = item\n const [name] = tag.split('-')\n const {\n guards,\n reflect,\n interceptors,\n params,\n } = Pcontext.metaDataRecord[tag]\n const instance = moduleMap.get(name)\n\n try {\n if (!params)\n throw new NotFoundException(`\"${tag}\" doesn't exist`)\n\n await context.useGuard(guards, true)\n await context.useInterceptor(interceptors, true)\n const args = await context.usePipe(params.map(({ type, key, validate }) => {\n const arg = resolveDep(item[type], key)\n return { arg, validate }\n }), reflect) as any\n instance.meta = contextData\n resolve(await context.usePost(await methodMap[tag](...args)))\n }\n catch (e: any) {\n const m = Pcontext.metaRecord[tag]\n m.handlers.forEach(handler => handler.error?.(e))\n resolve(await context.useFilter(e))\n }\n })\n })).then((ret) => {\n res.json(ret)\n })\n }\n\n res.json(await context.useFilter(new NotFoundException('category should be \\'parallel\\' or \\'series\\'')))\n })\n}\n","import 'reflect-metadata'\nimport EventEmitter from 'events'\nimport fs from 'fs'\nimport type { Phecda } from 'phecda-core'\nimport { getExposeKey, getHandler, getState, injectProperty, registerAsync } from 'phecda-core'\nimport type { Construct, PhecdaEmitter, ServerMeta } from './types'\nimport { Pmeta } from './meta'\n// TODO: support both phecda-emitter types and origin emitter type in future\nexport const emitter: PhecdaEmitter = new EventEmitter() as any\n\nexport async function Factory<T>(Modules: Construct<T>[]) {\n const moduleMap = new Map<string, InstanceType<Construct>>()\n const meta: Pmeta[] = []\n injectProperty('watcher', ({ eventName, instance, key, options }: { eventName: string; instance: any; key: string; options?: { once: boolean } }) => {\n const fn = typeof instance[key] === 'function' ? instance[key].bind(instance) : (v: any) => instance[key] = v\n\n if (options?.once)\n (emitter as any).once(eventName, fn)\n\n else\n (emitter as any).on(eventName, fn)\n })\n\n for (const Module of Modules)\n await buildNestModule(Module, moduleMap, meta) as InstanceType<Construct<T>>\n\n return { moduleMap, meta, output: (p: string) => fs.writeFileSync(p, JSON.stringify(meta.map(item => item.data))) }\n}\n\nasync function buildNestModule(Module: Construct, map: Map<string, InstanceType<Construct>>, meta: Pmeta[]) {\n const paramtypes = getParamtypes(Module) as Construct[]\n let instance: InstanceType<Construct>\n const name = Module.prototype._namespace?.__TAG__ || Module.name\n if (map.has(name)) {\n instance = map.get(name)\n if (!instance)\n throw new Error(`exist Circular Module dep--${Module}`)\n\n return instance\n }\n map.set(name, undefined)\n if (paramtypes) {\n for (const i in paramtypes)\n paramtypes[i] = await buildNestModule(paramtypes[i], map, meta)\n\n instance = new Module(...paramtypes)\n }\n else {\n instance = new Module()\n }\n meta.push(...getMetaFromInstance(instance, Module.name))\n await registerAsync(instance)\n map.set(name, instance)\n\n return instance\n}\n\nfunction getMetaFromInstance(instance: Phecda, name: string) {\n const vars = getExposeKey(instance).filter(item => item !== '__CLASS')\n const baseState = (getState(instance, '__CLASS') || {}) as ServerMeta\n initState(baseState)\n return vars.map((i) => {\n const state = (getState(instance, i) || {}) as ServerMeta\n if (baseState.route && state.route)\n state.route.route = baseState.route.route + state.route.route\n state.name = name\n state.method = i\n const params = [] as any[]\n for (const i of state.params || []) {\n params.unshift(i)\n if (i.index === 0)\n break\n }\n state.params = params\n initState(state)\n state.header = Object.assign({}, baseState.header, state.header)\n state.middlewares = [...new Set([...baseState.middlewares, ...state.middlewares])]\n state.guards = [...new Set([...baseState.guards, ...state.guards])]\n state.interceptors = [...new Set([...baseState.interceptors, ...state.interceptors])]\n\n return new Pmeta(state as unknown as ServerMeta, getHandler(instance, i), getParamtypes(instance, i) || [])\n })\n}\n\nfunction getParamtypes(Module: any, key?: string | symbol) {\n return Reflect.getMetadata('design:paramtypes', Module, key!)\n}\n\nfunction initState(state: any) {\n if (!state.header)\n state.header = {}\n if (!state.middlewares)\n state.middlewares = []\n if (!state.guards)\n state.guards = []\n if (!state.interceptors)\n state.interceptors = []\n}\n","import type { PHandler, ServerMeta } from './types'\n\nexport class Pmeta {\n constructor(public data: ServerMeta, public handlers: PHandler[], public reflect: any[]) {\n\n }\n}\n","import { mergeState, setModalVar } from 'phecda-core'\n\nexport function Inject(_target: any) { }\n\nexport function Header(name: string, value: string) {\n return (target: any, k: PropertyKey) => {\n setModalVar(target, k)\n mergeState(target, k, {\n header: { name, value },\n })\n }\n}\n\nexport * from './param'\nexport * from './route'\n\nexport * from './micro'\n","import { mergeState, setModalVar } from 'phecda-core'\n\nexport function BaseParam(type: string, key: string, validate?: boolean): any {\n return (target: any, k: PropertyKey, index: number) => {\n setModalVar(target, k)\n mergeState(target, k, {\n params: [{ type, key, index, validate }],\n })\n }\n}\n\nexport function Body(key = '', validate?: boolean) {\n return BaseParam('body', key, validate)\n}\nexport function Query(key: string, validate?: boolean) {\n return BaseParam('query', key, validate)\n}\nexport function Param(key: string, validate?: boolean) {\n return BaseParam('params', key, validate)\n}\n","import { mergeState, setModalVar } from 'phecda-core'\n\nexport function Route(route: string, type?: string): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n route: {\n route,\n type,\n },\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n route: {\n route,\n type,\n },\n })\n }\n }\n}\n\nexport function Get(route: string) {\n return Route(route, 'get')\n}\n\nexport function Post(route: string) {\n return Route(route, 'post')\n}\nexport function Put(route: string) {\n return Route(route, 'put')\n}\n\nexport function Delete(route: string) {\n return Route(route, 'delete')\n}\n\nexport function Controller(route: string) {\n return Route(route)\n}\n\nexport function Guard(...guards: string[]): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n guards: [...guards],\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n guards: [...guards],\n })\n }\n }\n}\n\nexport function Middle(...middlewares: string[]): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n middlewares: [...middlewares],\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n middlewares: [...middlewares],\n })\n }\n }\n}\n\nexport function Interceptor(...interceptors: string[]): any {\n return (target: any, key?: PropertyKey) => {\n if (key) {\n setModalVar(target, key)\n mergeState(target, key, {\n interceptors: [...interceptors],\n })\n }\n else {\n setModalVar(target.prototype, '__CLASS')\n mergeState(target.prototype, '__CLASS', {\n interceptors: [...interceptors],\n })\n }\n }\n}\n","import { mergeState, setModalVar } from 'phecda-core'\nimport type amqplib from 'amqplib'\nexport function MQ(queue: string, routeKey: string, options?: amqplib.Options.Consume) {\n return (target: any, k: PropertyKey) => {\n setModalVar(target, k)\n mergeState(target, k, {\n mq: {\n queue,\n routeKey,\n options,\n },\n })\n }\n}\n","export const Pconfig = {\n rabbitmq: {\n guard: false,\n interceptor: false,\n },\n}\n","import type amqplib from 'amqplib'\n\nimport { Pcontext, RabbitMqContext, parseMeta } from '../context'\nimport { resolveDep } from '../utils'\nimport { Pconfig } from '../config'\nimport type { Factory } from '../core'\nexport async function bindMQ(ch: amqplib.Channel, { meta, moduleMap }: Awaited<ReturnType<typeof Factory>>) {\n for (const item of meta) {\n const { route, name, method, mq: { routeKey, queue: queueName, options } = {} } = item.data\n const tag = `${name}-${method}`\n Pcontext.metaRecord[tag] = item\n\n const {\n guards,\n reflect,\n interceptors,\n params,\n } = Pcontext.metaDataRecord[tag] ? Pcontext.metaDataRecord[tag] : (Pcontext.metaDataRecord[tag] = parseMeta(item))\n const instance = moduleMap.get(name)!\n const handler = instance[method].bind(instance)\n\n Pcontext.instanceRecord[name] = instance\n\n if (route) {\n const { queue } = await ch.assertQueue(route.route)\n if (queueName && routeKey)\n await ch.bindQueue(queue, queueName, routeKey)\n\n ch.consume(route.route, async (msg) => {\n if (msg !== null) {\n const content = msg.content.toString()\n\n const data = params.length > 0 ? JSON.parse(content) : content\n const contextMeta = {\n message: msg,\n content,\n channel: ch,\n\n }\n const context = new RabbitMqContext(tag, contextMeta)\n\n try {\n if (Pconfig.rabbitmq.guard)\n await context.useGuard(guards)\n if (Pconfig.rabbitmq.interceptor)\n await context.useInterceptor(interceptors)\n\n const args = await context.usePipe(params.map(({ key, validate }) => {\n return { arg: resolveDep(data, key), validate }\n }), reflect)\n\n instance.meta = contextMeta\n\n await context.usePost(await handler(...args))\n ch.ack(msg)\n }\n catch (e) {\n item.handlers.forEach(handler => handler.error?.(e))\n context.useFilter(e)\n }\n }\n else {\n // console.log('Consumer cancelled by server')\n }\n }, options)\n }\n }\n}\n\ntype MqMethod<T> = (arg: T) => void\n\n/**\n * @experiment\n */\nexport async function createPub<T extends (...args: any[]) => any>(ch: amqplib.Channel, method: T, type?: string): Promise<MqMethod<Parameters<T>>> {\n const { exchange, routeKey, queue } = method()\n if (exchange)\n await ch.assertExchange(exchange, type!)\n\n else\n await ch.assertQueue(queue)\n\n return async (arg: Parameters<T>) => {\n const { args } = method(arg)\n const msg = Buffer.from(JSON.stringify(args))\n if (exchange)\n await ch.publish(exchange, routeKey, msg)\n\n else\n await ch.sendToQueue(queue, msg)\n }\n}\n","import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport type { PError, PRes, RequestType, ResOrErr } from '../types'\nimport { SERIES_SYMBOL } from '../common'\ninterface RequestArgs {\n body: Record<string, any>\n query: Record<string, string>\n params: Record<string, string>\n realParam: string\n method: RequestType\n url: string\n tag: string\n}\ntype MergedReqArg = Pick<RequestArgs, 'body' | 'query' | 'params' | 'tag' >\nexport function toReq(arg: RequestArgs) {\n const { body, query, realParam, method, url } = arg\n return { method, url, body, query: Object.keys(query).length > 0 ? `?${Object.entries(query).map(([k, v]) => `${k}=${v}`).join('&')}` : '', params: realParam }\n}\n\nexport const merge = (...args: RequestArgs[]) => {\n const ret = [] as MergedReqArg[]\n for (const i of args) {\n const { body, query, params, tag } = i\n ret.push({ tag, body, query, params })\n }\n\n return ret\n}\n\nexport type RequestMethod = <F extends (...args: any[]) => any >(fn: F, args: Parameters<F>) => Promise<ReturnType<F>>\n\nexport function createReq(instance: AxiosInstance): <R>(arg: R, config?: AxiosRequestConfig) => Promise<AxiosResponse<PRes<Awaited<R>>> > {\n // @ts-expect-error methods without route decorator won't send request\n return (arg: any, config?: AxiosRequestConfig) => {\n const { url, params, query, body, method } = toReq(arg as RequestArgs)\n if (!method) {\n console.warn('methods without route decorator won\\'t send request')\n return\n }\n\n const ret = [`${url}${params}${query}`] as any[]\n body && ret.push(body)\n config && ret.push(config)\n // @ts-expect-error misdirction\n return instance[method](...ret)\n }\n}\n\nexport function createSeriesReq(instance: AxiosInstance, key = '/__PHECDA_SERVER__'): < R extends unknown[]>(args: R, config?: AxiosRequestConfig) => Promise<AxiosResponse<ResOrErr<PRes<R>>>> {\n // @ts-expect-error misdirction\n return (args: RequestArgs[], config?: AxiosRequestConfig) => {\n return instance.post(key, {\n category: 'series',\n data: merge(...args),\n }, config)\n }\n}\n\nexport function createParallelReq(instance: AxiosInstance, key = '/__PHECDA_SERVER__'): < R extends unknown[]>(args: R, config?: AxiosRequestConfig) => Promise<AxiosResponse<ResOrErr<PRes<R>>>> {\n // @ts-expect-error misdirction\n return (args: RequestArgs[], config?: AxiosRequestConfig) => {\n return instance.post(key, {\n category: 'parallel',\n data: merge(...args),\n }, config)\n }\n}\n\nexport function isError<T = any>(data: T | PError): data is PError {\n return typeof data === 'object' && (data as any).error\n}\n\nexport function $S(index: number, key = ''): any {\n return `${SERIES_SYMBOL}@${index}@${key}`\n}\n","import type amqplib from 'amqplib'\nexport * from './axios'\n\nexport function createMqReq(channel: amqplib.Channel): <R>(arg: R) => Promise<void> {\n return async (arg: any) => {\n const { url, body } = arg\n await channel.assertQueue(url)\n await channel.sendToQueue(url, Bu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AA,GAASC,IAAAA;IACjB,GAAGO,MAAAA;EACL;AACF;AARgBQ;AAUT,SAASC,QAAiBF,MAAkC;AACjE,SAAO,OAAOA,SAAS,YAAaA,KAAaG;AACnD;AAFgBD;AAIT,SAASE,GAAGC,OAAeR,MAAM,IAAS;AAC/C,SAAO,GAAGS,iBAAiBD,SAASR;AACtC;AAFgBO;;;ACpET,SAASG,YAAYC,SAAwD;AAClF,SAAO,OAAOC,QAAa;AACzB,UAAM,EAAEC,KAAKC,KAAI,IAAKF;AACtB,UAAMD,QAAQI,YAAYF,GAAAA;AAC1B,UAAMF,QAAQK,YAAYH,KAAKI,OAAOC,KAAKC,KAAKC,UAAUN,IAAAA,CAAAA,CAAAA;EAC5D;AACF;AANgBJ;","names":["HttpException","Error","message","status","description","constructor","data","error","ValidateException","HttpException","constructor","message","defaultPipe","transform","args","reflect","i","validate","arg","isPhecda","ret","plainToClass","err","length","ValidateException","data","map","item","UndefinedException","HttpException","constructor","message","ForbiddenException","HttpException","constructor","message","BadRequestException","HttpException","constructor","message","WrongMetaException","HttpException","constructor","message","NotFoundException","HttpException","constructor","message","serverFilter","e","HttpException","UndefinedException","message","data","rabbitMqFilter","channel","reject","Phistroy","guard","interceptor","record","name","type","includes","push","Pcontext","key","data","method","params","post","history","constructor","Phistroy","registerGuard","handler","guardsRecord","registerInterceptor","interceptorsRecord","useGuard","guards","isMerge","guard","record","WrongMetaException","ForbiddenException","useInterceptor","interceptors","ret","interceptor","push","usePost","cb","metaRecord","metaDataRecord","instanceRecord","addGuard","addInterceptor","getInstance","tag","parseMeta","meta","middlewares","reflect","map","param","type","validate","ServerContext","Pcontext","useMiddleware","middlewares","map","m","middlewareRecord","WrongMetaException","usePipe","args","reflect","pipe","transform","useFilter","arg","filter","data","defaultPipe","serverFilter","addMiddleware","key","handler","useServerPipe","useServerFilter","RabbitMqContext","Pcontext","useMiddleware","middlewares","map","m","middlewareRecord","WrongMetaException","usePipe","args","reflect","pipe","transform","useFilter","arg","filter","data","defaultPipe","rabbitMqFilter","useMqPipe","useMqFilter","Pcompiler","content","classMap","constructor","getContent","name","Object","values","reduce","p","c","addMethod","className","methodName","route","requestType","params","url","replace","genParams","filter","item","key","i","type","addMqMethod","exchange","routeKey","queue","decorators","index","isUndefined","obj","isNil","isObject","fn","resolveDep","ret","key","SERIES_SYMBOL","REQ_SYMBOL","bindApp","app","meta","moduleMap","options","globalGuards","globalInterceptors","route","middlewares","proMiddle","methodMap","i","name","method","header","data","instance","get","tag","Pcontext","metaRecord","guards","reflect","interceptors","params","metaDataRecord","parseMeta","handler","bind","instanceRecord","type","ServerContext","useMiddleware","req","res","contextData","request","response","context","set","useGuard","useInterceptor","args","usePipe","map","key","validate","arg","resolveDep","ret","usePost","isObject","json","send","String","e","handlers","forEach","error","err","useFilter","status","post","_res","next","REQ_SYMBOL","body","category","item","split","NotFoundException","startsWith","SERIES_SYMBOL","index","argKey","Number","push","m","Promise","all","resolve","then","import_phecda_core","Pmeta","data","handlers","reflect","constructor","emitter","EventEmitter","Factory","Modules","moduleMap","Map","meta","injectProperty","eventName","instance","key","options","fn","bind","v","once","on","Module","buildNestModule","output","p","fs","writeFileSync","JSON","stringify","map","item","data","paramtypes","getParamtypes","name","prototype","_namespace","__TAG__","has","get","Error","set","undefined","i","push","getMetaFromInstance","registerAsync","vars","getExposeKey","filter","baseState","getState","initState","state","route","method","params","unshift","index","header","Object","assign","middlewares","Set","guards","interceptors","Pmeta","getHandler","Reflect","getMetadata","import_phecda_core","import_phecda_core","BaseParam","type","key","validate","target","k","index","setModalVar","mergeState","params","Body","Query","Param","import_phecda_core","Route","route","type","target","key","setModalVar","mergeState","prototype","Get","Post","Put","Delete","Controller","Guard","guards","Middle","middlewares","Interceptor","interceptors","import_phecda_core","MQ","queue","routeKey","options","target","k","setModalVar","mergeState","mq","Inject","_target","Header","name","value","target","k","setModalVar","mergeState","header","Pconfig","rabbitmq","guard","interceptor","bindMQ","ch","meta","moduleMap","item","route","name","method","mq","routeKey","queue","queueName","options","data","tag","Pcontext","metaRecord","guards","reflect","interceptors","params","metaDataRecord","parseMeta","instance","get","handler","bind","instanceRecord","assertQueue","bindQueue","consume","msg","content","toString","length","JSON","parse","contextMeta","message","channel","context","RabbitMqContext","Pconfig","rabbitmq","guard","useGuard","interceptor","useInterceptor","args","usePipe","map","key","validate","arg","resolveDep","usePost","ack","e","handlers","forEach","error","useFilter","createPub","type","exchange","assertExchange","Buffer","from","stringify","publish","sendToQueue","toReq","arg","body","query","realParam","method","url","Object","keys","length","entries","map","k","v","join","params","merge","args","ret","i","tag","push","createReq","instance","config","console","warn","createSeriesReq","key","post","category","data","createParallelReq","isError","error","$S","index","SERIES_SYMBOL","createMqReq","channel","arg","url","body","assertQueue","sendToQueue","Buffer","from","JSON","stringify"]}
package/dist/index.mjs CHANGED
@@ -46,16 +46,15 @@ var defaultPipe = {
46
46
  const { validate, arg } = args[i];
47
47
  if (validate === false)
48
48
  continue;
49
- if (validate && !(arg?.constructor === reflect[i])) {
50
- throw new ValidateException(`${arg} is not ${reflect[i].name}`);
49
+ if (isPhecda(reflect[i])) {
50
+ const ret = await plainToClass(reflect[i], arg, {
51
+ transform: true
52
+ });
53
+ if (ret.err.length > 0)
54
+ throw new ValidateException(ret.err[0]);
55
+ args[i].arg = ret.data;
51
56
  } else {
52
- if (isPhecda(reflect[i])) {
53
- const ret = await plainToClass(reflect[i], arg, {
54
- transform: false
55
- });
56
- if (ret.err.length > 0)
57
- throw new ValidateException(ret.err[0]);
58
- }
57
+ args[i].arg = reflect[i](arg);
59
58
  }
60
59
  }
61
60
  return args.map((item) => item.arg);
@@ -454,7 +453,7 @@ function bindApp(app, { meta, moduleMap }, options = {}) {
454
453
  }
455
454
  if (category === "parallel") {
456
455
  return Promise.all(data.map((item) => {
457
- return new Promise(async (resolve2) => {
456
+ return new Promise(async (resolve) => {
458
457
  const { tag } = item;
459
458
  const [name] = tag.split("-");
460
459
  const { guards, reflect, interceptors, params } = Pcontext.metaDataRecord[tag];
@@ -472,11 +471,11 @@ function bindApp(app, { meta, moduleMap }, options = {}) {
472
471
  };
473
472
  }), reflect);
474
473
  instance.meta = contextData;
475
- resolve2(await context.usePost(await methodMap[tag](...args)));
474
+ resolve(await context.usePost(await methodMap[tag](...args)));
476
475
  } catch (e) {
477
476
  const m = Pcontext.metaRecord[tag];
478
477
  m.handlers.forEach((handler) => handler.error?.(e));
479
- resolve2(await context.useFilter(e));
478
+ resolve(await context.useFilter(e));
480
479
  }
481
480
  });
482
481
  })).then((ret2) => {
@@ -491,6 +490,7 @@ __name(bindApp, "bindApp");
491
490
  // src/core.ts
492
491
  import "reflect-metadata";
493
492
  import EventEmitter from "events";
493
+ import fs from "fs";
494
494
  import { getExposeKey, getHandler, getState, injectProperty, registerAsync } from "phecda-core";
495
495
 
496
496
  // src/meta.ts
@@ -522,7 +522,8 @@ async function Factory(Modules) {
522
522
  await buildNestModule(Module, moduleMap, meta);
523
523
  return {
524
524
  moduleMap,
525
- meta
525
+ meta,
526
+ output: (p) => fs.writeFileSync(p, JSON.stringify(meta.map((item) => item.data)))
526
527
  };
527
528
  }
528
529
  __name(Factory, "Factory");
@@ -779,50 +780,6 @@ function Header(name, value) {
779
780
  }
780
781
  __name(Header, "Header");
781
782
 
782
- // src/vite/index.ts
783
- import { resolve } from "path";
784
- import { normalizePath } from "vite";
785
- function Server(localPath = "pmeta.js") {
786
- let root;
787
- let metaPath;
788
- let command;
789
- return {
790
- name: "phecda-server-vite:client",
791
- enforce: "pre",
792
- configResolved(config) {
793
- command = config.command;
794
- root = config.root || process.cwd();
795
- metaPath = normalizePath(resolve(root, localPath));
796
- },
797
- buildStart() {
798
- if (command === "build") {
799
- this.emitFile({
800
- type: "chunk",
801
- id: metaPath,
802
- fileName: localPath,
803
- preserveSignature: "allow-extension"
804
- });
805
- }
806
- },
807
- resolveId(id) {
808
- if (id.endsWith(".controller"))
809
- return metaPath;
810
- },
811
- transform(code, id) {
812
- if (id === metaPath) {
813
- const meta = JSON.parse(code);
814
- const compiler = new Pcompiler();
815
- for (const i of meta)
816
- compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params);
817
- return {
818
- code: compiler.getContent()
819
- };
820
- }
821
- }
822
- };
823
- }
824
- __name(Server, "Server");
825
-
826
783
  // src/index.ts
827
784
  export * from "phecda-core";
828
785
 
@@ -1004,7 +961,6 @@ export {
1004
961
  Query,
1005
962
  RabbitMqContext,
1006
963
  Route,
1007
- Server,
1008
964
  ServerContext,
1009
965
  UndefinedException,
1010
966
  ValidateException,