phecda-server 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/assets/ps.json +25 -0
- package/{bin → assets}/schema.json +55 -55
- package/assets/tsconfig.json +21 -0
- package/bin/cli.mjs +150 -189
- package/dist/{chunk-6UQYEBAN.js → chunk-5BVUCNMA.js} +19 -20
- package/dist/{chunk-QG4X6H5Y.js → chunk-BSE2DSDK.js} +121 -124
- package/dist/{chunk-OTHER3YM.mjs → chunk-CKQW3FDK.mjs} +4 -5
- package/dist/{chunk-6W7CGOZC.mjs → chunk-JE6BBDXW.mjs} +64 -67
- package/dist/{chunk-5DOVDDO7.mjs → chunk-V3WIKOP3.mjs} +11 -6
- package/dist/{chunk-H4N6SHNG.mjs → chunk-VLV3AO3H.mjs} +0 -1
- package/dist/{chunk-GHOKWS5V.js → chunk-VMLHTEW3.js} +48 -43
- package/dist/{chunk-Z4YJHEXT.js → chunk-ZP7HNASU.js} +0 -1
- package/dist/core-7f6d2be6.d.ts +27 -0
- package/dist/{helper-fcbf6aa8.d.ts → helper-49c7213c.d.ts} +1 -1
- package/dist/{helper-867a598d.d.ts → helper-5d755442.d.ts} +1 -1
- package/dist/helper.d.ts +25 -0
- package/dist/helper.js +21 -0
- package/dist/helper.mjs +21 -0
- package/dist/index.d.ts +5 -25
- package/dist/index.js +39 -58
- package/dist/index.mjs +6 -25
- package/dist/rpc/bullmq/index.d.ts +3 -2
- package/dist/rpc/bullmq/index.js +12 -13
- package/dist/rpc/bullmq/index.mjs +2 -3
- package/dist/rpc/kafka/index.d.ts +3 -2
- package/dist/rpc/kafka/index.js +10 -11
- package/dist/rpc/kafka/index.mjs +2 -3
- package/dist/rpc/nats/index.d.ts +3 -2
- package/dist/rpc/nats/index.js +11 -12
- package/dist/rpc/nats/index.mjs +2 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -2
- package/dist/rpc/rabbitmq/index.js +13 -14
- package/dist/rpc/rabbitmq/index.mjs +2 -3
- package/dist/rpc/redis/index.d.ts +3 -2
- package/dist/rpc/redis/index.js +11 -12
- package/dist/rpc/redis/index.mjs +2 -3
- package/dist/server/elysia/index.d.ts +3 -2
- package/dist/server/elysia/index.js +20 -21
- package/dist/server/elysia/index.mjs +3 -4
- package/dist/server/express/index.d.ts +3 -2
- package/dist/server/express/index.js +18 -19
- package/dist/server/express/index.mjs +2 -3
- package/dist/server/fastify/index.d.ts +3 -2
- package/dist/server/fastify/index.js +19 -20
- package/dist/server/fastify/index.mjs +3 -4
- package/dist/server/h3/index.d.ts +3 -2
- package/dist/server/h3/index.js +16 -17
- package/dist/server/h3/index.mjs +2 -3
- package/dist/server/hono/index.d.ts +3 -2
- package/dist/server/hono/index.js +17 -18
- package/dist/server/hono/index.mjs +2 -3
- package/dist/server/hyper-express/index.d.ts +3 -2
- package/dist/server/hyper-express/index.js +17 -18
- package/dist/server/hyper-express/index.mjs +2 -3
- package/dist/server/koa/index.d.ts +3 -2
- package/dist/server/koa/index.js +18 -19
- package/dist/server/koa/index.mjs +2 -3
- package/dist/test.d.ts +2 -1
- package/dist/test.js +6 -7
- package/dist/test.mjs +2 -3
- package/dist/{core-fd134ffa.d.ts → types-81be0ba3.d.ts} +2 -24
- package/package.json +62 -54
- package/register/index.mjs +40 -40
- package/register/loader.mjs +367 -341
- package/register/utils.mjs +56 -81
- package/dist/chunk-423JPSEB.js +0 -253
- package/dist/chunk-423JPSEB.js.map +0 -1
- package/dist/chunk-4R55T3HG.js +0 -253
- package/dist/chunk-4R55T3HG.js.map +0 -1
- package/dist/chunk-4YVAW3L4.mjs +0 -76
- package/dist/chunk-4YVAW3L4.mjs.map +0 -1
- package/dist/chunk-5DOVDDO7.mjs.map +0 -1
- package/dist/chunk-5WQ2SMIK.js +0 -295
- package/dist/chunk-5WQ2SMIK.js.map +0 -1
- package/dist/chunk-6MQP6OHU.mjs +0 -295
- package/dist/chunk-6MQP6OHU.mjs.map +0 -1
- package/dist/chunk-6Q2PCC3A.mjs +0 -295
- package/dist/chunk-6Q2PCC3A.mjs.map +0 -1
- package/dist/chunk-6UQYEBAN.js.map +0 -1
- package/dist/chunk-6W7CGOZC.mjs.map +0 -1
- package/dist/chunk-7Y37NSBM.js +0 -88
- package/dist/chunk-7Y37NSBM.js.map +0 -1
- package/dist/chunk-BQBSVGMG.mjs +0 -253
- package/dist/chunk-BQBSVGMG.mjs.map +0 -1
- package/dist/chunk-BZP6GKM6.mjs +0 -565
- package/dist/chunk-BZP6GKM6.mjs.map +0 -1
- package/dist/chunk-C5JAHCS2.mjs +0 -88
- package/dist/chunk-C5JAHCS2.mjs.map +0 -1
- package/dist/chunk-DTBKDALR.mjs +0 -295
- package/dist/chunk-DTBKDALR.mjs.map +0 -1
- package/dist/chunk-GHOKWS5V.js.map +0 -1
- package/dist/chunk-H4N6SHNG.mjs.map +0 -1
- package/dist/chunk-ICYHM4UM.js +0 -565
- package/dist/chunk-ICYHM4UM.js.map +0 -1
- package/dist/chunk-LOLXPM4J.mjs +0 -529
- package/dist/chunk-LOLXPM4J.mjs.map +0 -1
- package/dist/chunk-MSS6A2TU.js +0 -585
- package/dist/chunk-MSS6A2TU.js.map +0 -1
- package/dist/chunk-NEM3FY7C.mjs +0 -537
- package/dist/chunk-NEM3FY7C.mjs.map +0 -1
- package/dist/chunk-OTHER3YM.mjs.map +0 -1
- package/dist/chunk-Q2FYFIEY.js +0 -295
- package/dist/chunk-Q2FYFIEY.js.map +0 -1
- package/dist/chunk-QG4X6H5Y.js.map +0 -1
- package/dist/chunk-QIEZ6YTG.mjs +0 -295
- package/dist/chunk-QIEZ6YTG.mjs.map +0 -1
- package/dist/chunk-QOAKHCM7.js +0 -295
- package/dist/chunk-QOAKHCM7.js.map +0 -1
- package/dist/chunk-QVUD6L5X.js +0 -565
- package/dist/chunk-QVUD6L5X.js.map +0 -1
- package/dist/chunk-RGLTGKAU.js +0 -537
- package/dist/chunk-RGLTGKAU.js.map +0 -1
- package/dist/chunk-SHRK3TVB.js +0 -295
- package/dist/chunk-SHRK3TVB.js.map +0 -1
- package/dist/chunk-TCH6S42Z.js +0 -529
- package/dist/chunk-TCH6S42Z.js.map +0 -1
- package/dist/chunk-UCGRFVHC.mjs +0 -253
- package/dist/chunk-UCGRFVHC.mjs.map +0 -1
- package/dist/chunk-VOISXWVF.mjs +0 -295
- package/dist/chunk-VOISXWVF.mjs.map +0 -1
- package/dist/chunk-W6BC5INO.mjs +0 -295
- package/dist/chunk-W6BC5INO.mjs.map +0 -1
- package/dist/chunk-X5WQRO4R.js +0 -295
- package/dist/chunk-X5WQRO4R.js.map +0 -1
- package/dist/chunk-XDMCVVD3.mjs +0 -585
- package/dist/chunk-XDMCVVD3.mjs.map +0 -1
- package/dist/chunk-XNTMYLK6.js +0 -76
- package/dist/chunk-XNTMYLK6.js.map +0 -1
- package/dist/chunk-Y6LI4FDO.js +0 -537
- package/dist/chunk-Y6LI4FDO.js.map +0 -1
- package/dist/chunk-YZ2AQ6IL.mjs +0 -537
- package/dist/chunk-YZ2AQ6IL.mjs.map +0 -1
- package/dist/chunk-Z4YJHEXT.js.map +0 -1
- package/dist/chunk-ZE336SKZ.js +0 -295
- package/dist/chunk-ZE336SKZ.js.map +0 -1
- package/dist/chunk-ZJD235TO.mjs +0 -565
- package/dist/chunk-ZJD235TO.mjs.map +0 -1
- package/dist/core-39f27fe8.d.ts +0 -131
- package/dist/core-930ea883.d.ts +0 -131
- package/dist/core-eb646fe5.d.ts +0 -139
- package/dist/helper-06d25b37.d.ts +0 -19
- package/dist/helper-48454c0b.d.ts +0 -20
- package/dist/helper-6133f78f.d.ts +0 -18
- package/dist/helper-73e8d2f0.d.ts +0 -18
- package/dist/helper-88b19c66.d.ts +0 -12
- package/dist/helper-9e206c66.d.ts +0 -12
- package/dist/helper-f29f082f.d.ts +0 -19
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/rpc/bullmq/index.js.map +0 -1
- package/dist/rpc/bullmq/index.mjs.map +0 -1
- package/dist/rpc/kafka/index.js.map +0 -1
- package/dist/rpc/kafka/index.mjs.map +0 -1
- package/dist/rpc/nats/index.js.map +0 -1
- package/dist/rpc/nats/index.mjs.map +0 -1
- package/dist/rpc/rabbitmq/index.js.map +0 -1
- package/dist/rpc/rabbitmq/index.mjs.map +0 -1
- package/dist/rpc/redis/index.js.map +0 -1
- package/dist/rpc/redis/index.mjs.map +0 -1
- package/dist/server/elysia/index.js.map +0 -1
- package/dist/server/elysia/index.mjs.map +0 -1
- package/dist/server/express/index.js.map +0 -1
- package/dist/server/express/index.mjs.map +0 -1
- package/dist/server/fastify/index.js.map +0 -1
- package/dist/server/fastify/index.mjs.map +0 -1
- package/dist/server/h3/index.js.map +0 -1
- package/dist/server/h3/index.mjs.map +0 -1
- package/dist/server/hono/index.js.map +0 -1
- package/dist/server/hono/index.mjs.map +0 -1
- package/dist/server/hyper-express/index.js.map +0 -1
- package/dist/server/hyper-express/index.mjs.map +0 -1
- package/dist/server/koa/index.js.map +0 -1
- package/dist/server/koa/index.mjs.map +0 -1
- package/dist/test.js.map +0 -1
- package/dist/test.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { B as BaseContext, D as DefaultOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { B as BaseContext, D as DefaultOptions, C as ControllerMetaData, M as MetaData, U as UNMOUNT_SYMBOL, a as BaseError } from './types-81be0ba3.js';
|
|
2
|
+
export { e as BaseRequestType, d as BaseReturn, i as ControllerMeta, f as CustomResponse, j as ERROR_SYMBOL, E as Emitter, g as ExtractResponse, I as IS_HMR, k as IS_ONLY_GENERATE, l as IS_STRICT, L as LOG_LEVEL, h as Meta, O as OmitFunction, m as PS_EXIT_CODE, P as PickFunc, S as ServiceMetaData, c as ToClientFn, b as ToClientInstance, T as ToClientMap } from './types-81be0ba3.js';
|
|
3
|
+
import { G as Generator } from './core-7f6d2be6.js';
|
|
4
|
+
export { F as Factory, e as emitter } from './core-7f6d2be6.js';
|
|
3
5
|
import { Construct, AbConstruct } from 'phecda-core';
|
|
4
6
|
export * from 'phecda-core';
|
|
5
|
-
export { a as HttpContext, H as HttpOptions, b as argToReq, r as resolveDep } from './helper-fcbf6aa8.js';
|
|
6
|
-
export { a as RpcClientOptions, b as RpcContext, R as RpcServerOptions, g as genClientQueue } from './helper-6133f78f.js';
|
|
7
|
-
import 'node:http';
|
|
8
7
|
|
|
9
8
|
declare class Exception extends Error {
|
|
10
9
|
message: string;
|
|
@@ -241,23 +240,4 @@ declare function setLogger(logger: Record<LogLevel, (msg: string) => void>): voi
|
|
|
241
240
|
declare function log(msg: string, level?: LogLevel): void;
|
|
242
241
|
declare function Mix<C1 extends Construct | AbConstruct, C2 extends Construct>(InternalClass: C1, ExtendClass: C2): new (...args: ConstructorParameters<C2>) => InstanceType<C1> & InstanceType<C2>;
|
|
243
242
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
declare function shallowClone(obj: any): any;
|
|
247
|
-
declare function mergeObject(...args: any[]): any;
|
|
248
|
-
declare function mergeArray(...args: any[]): any[];
|
|
249
|
-
|
|
250
|
-
declare function createControllerMetaMap(meta: Meta[], filter: (meta: Meta) => boolean | void): Map<string, Record<string, ControllerMeta>>;
|
|
251
|
-
declare function detectAopDep(meta: Meta[], { guards, interceptors, plugins }?: {
|
|
252
|
-
guards?: string[];
|
|
253
|
-
interceptors?: string[];
|
|
254
|
-
plugins?: string[];
|
|
255
|
-
}, controller?: string): {
|
|
256
|
-
pluginSet: Set<string>;
|
|
257
|
-
guardSet: Set<string>;
|
|
258
|
-
interceptorSet: Set<string>;
|
|
259
|
-
pipeSet: Set<string>;
|
|
260
|
-
filterSet: Set<string>;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMeta, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Dev, Event, Exception, Filter, FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, GuardType, HMR, HTTPGenerator, Head, Header, Injectable, Interceptor, InterceptorType, InvalidInputException, Meta, MetaData, Mix, NotFoundException, PExtension, PFilter, PGuard, PInterceptor, PPipe, PPlugin, Param, Patch, PayloadLargeException, Pipe, PipeArg, PipeType, Plugin, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, ServiceUnavailableException, TimeoutException, TimerException, UNMOUNT_SYMBOL, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, createControllerMetaMap, defaultPipe, detectAopDep, log, mergeArray, mergeObject, setLogger, shallowClone };
|
|
243
|
+
export { Arg, BadGatewayException, BadRequestException, BaseContext, BaseError, BaseParam, Body, ConflictException, Context, Controller, ControllerMetaData, Ctx, DefaultOptions, Define, Delete, Dev, Event, Exception, Filter, FilterType, ForbiddenException, FrameworkException, Generator, Get, Guard, GuardType, HTTPGenerator, Head, Header, Injectable, Interceptor, InterceptorType, InvalidInputException, MetaData, Mix, NotFoundException, PExtension, PFilter, PGuard, PInterceptor, PPipe, PPlugin, Param, Patch, PayloadLargeException, Pipe, PipeArg, PipeType, Plugin, Post, Put, Query, Queue, RPCGenerator, Route, Rpc, ServiceUnavailableException, TimeoutException, TimerException, UNMOUNT_SYMBOL, UnauthorizedException, UndefinedException, UnsupportedMediaTypeException, ValidateException, WorkerException, addFilter, addGuard, addInterceptor, addPipe, addPlugin, defaultPipe, log, setLogger };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk5BVUCNMAjs = require('./chunk-5BVUCNMA.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -29,7 +29,7 @@ var _chunk423JPSEBjs = require('./chunk-423JPSEB.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkVMLHTEW3js = require('./chunk-VMLHTEW3.js');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
@@ -55,6 +55,7 @@ var _chunkGHOKWS5Vjs = require('./chunk-GHOKWS5V.js');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
var _chunkBSE2DSDKjs = require('./chunk-BSE2DSDK.js');
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
|
|
@@ -64,27 +65,17 @@ var _chunkGHOKWS5Vjs = require('./chunk-GHOKWS5V.js');
|
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
|
|
67
|
-
var _chunkQG4X6H5Yjs = require('./chunk-QG4X6H5Y.js');
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var _chunkXNTMYLK6js = require('./chunk-XNTMYLK6.js');
|
|
71
|
+
var _chunkZP7HNASUjs = require('./chunk-ZP7HNASU.js');
|
|
81
72
|
|
|
82
73
|
// src/types.ts
|
|
83
74
|
var ResponseSymbol = Symbol("response");
|
|
84
75
|
var CustomResponse = class {
|
|
85
76
|
|
|
86
77
|
};
|
|
87
|
-
|
|
78
|
+
_chunkZP7HNASUjs.__name.call(void 0, CustomResponse, "CustomResponse");
|
|
88
79
|
|
|
89
80
|
// src/modules/dev.ts
|
|
90
81
|
var _phecdacore = require('phecda-core'); _createStarExport(_phecdacore);
|
|
@@ -102,14 +93,14 @@ var __metadata = function(k, v) {
|
|
|
102
93
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
103
94
|
return Reflect.metadata(k, v);
|
|
104
95
|
};
|
|
105
|
-
var Dev = /* @__PURE__ */
|
|
106
|
-
__init() {this[
|
|
96
|
+
var Dev = /* @__PURE__ */ _chunkZP7HNASUjs.__name.call(void 0, (_class =class Dev2 {constructor() { _class.prototype.__init.call(this); }
|
|
97
|
+
__init() {this[_chunkZP7HNASUjs.UNMOUNT_SYMBOL] = []}
|
|
107
98
|
|
|
108
99
|
onUnmount(cb) {
|
|
109
|
-
this[
|
|
100
|
+
this[_chunkZP7HNASUjs.UNMOUNT_SYMBOL].push(cb);
|
|
110
101
|
}
|
|
111
102
|
async unmount() {
|
|
112
|
-
for (const cb of this[
|
|
103
|
+
for (const cb of this[_chunkZP7HNASUjs.UNMOUNT_SYMBOL])
|
|
113
104
|
await cb();
|
|
114
105
|
}
|
|
115
106
|
}, _class), "Dev");
|
|
@@ -129,13 +120,13 @@ var PFilter = class extends Dev {
|
|
|
129
120
|
constructor(tag) {
|
|
130
121
|
super();
|
|
131
122
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
132
|
-
|
|
123
|
+
_chunkBSE2DSDKjs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
133
124
|
this.onUnmount(() => {
|
|
134
|
-
delete
|
|
125
|
+
delete _chunkBSE2DSDKjs.Context.filterRecord[this.key];
|
|
135
126
|
});
|
|
136
127
|
}
|
|
137
128
|
};
|
|
138
|
-
|
|
129
|
+
_chunkZP7HNASUjs.__name.call(void 0, PFilter, "PFilter");
|
|
139
130
|
|
|
140
131
|
// src/modules/guard.ts
|
|
141
132
|
|
|
@@ -144,13 +135,13 @@ var PGuard = class extends Dev {
|
|
|
144
135
|
constructor(tag) {
|
|
145
136
|
super();
|
|
146
137
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
147
|
-
|
|
138
|
+
_chunkBSE2DSDKjs.addGuard.call(void 0, this.key, this.use.bind(this));
|
|
148
139
|
this.onUnmount(() => {
|
|
149
|
-
delete
|
|
140
|
+
delete _chunkBSE2DSDKjs.Context.guardRecord[this.key];
|
|
150
141
|
});
|
|
151
142
|
}
|
|
152
143
|
};
|
|
153
|
-
|
|
144
|
+
_chunkZP7HNASUjs.__name.call(void 0, PGuard, "PGuard");
|
|
154
145
|
|
|
155
146
|
// src/modules/interceptor.ts
|
|
156
147
|
|
|
@@ -160,12 +151,12 @@ var PInterceptor = class extends Dev {
|
|
|
160
151
|
super();
|
|
161
152
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
162
153
|
this.onUnmount(() => {
|
|
163
|
-
delete
|
|
154
|
+
delete _chunkBSE2DSDKjs.Context.interceptorRecord[this.key];
|
|
164
155
|
});
|
|
165
|
-
|
|
156
|
+
_chunkBSE2DSDKjs.addInterceptor.call(void 0, this.key, this.use.bind(this));
|
|
166
157
|
}
|
|
167
158
|
};
|
|
168
|
-
|
|
159
|
+
_chunkZP7HNASUjs.__name.call(void 0, PInterceptor, "PInterceptor");
|
|
169
160
|
|
|
170
161
|
// src/modules/pipe.ts
|
|
171
162
|
|
|
@@ -174,13 +165,13 @@ var PPipe = class extends Dev {
|
|
|
174
165
|
constructor(tag) {
|
|
175
166
|
super();
|
|
176
167
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
177
|
-
|
|
168
|
+
_chunkBSE2DSDKjs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
178
169
|
this.onUnmount(() => {
|
|
179
|
-
delete
|
|
170
|
+
delete _chunkBSE2DSDKjs.Context.pipeRecord[this.key];
|
|
180
171
|
});
|
|
181
172
|
}
|
|
182
173
|
};
|
|
183
|
-
|
|
174
|
+
_chunkZP7HNASUjs.__name.call(void 0, PPipe, "PPipe");
|
|
184
175
|
|
|
185
176
|
// src/modules/plugin.ts
|
|
186
177
|
|
|
@@ -189,13 +180,13 @@ var PPlugin = class extends Dev {
|
|
|
189
180
|
constructor(tag) {
|
|
190
181
|
super();
|
|
191
182
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
192
|
-
|
|
183
|
+
_chunkBSE2DSDKjs.addPlugin.call(void 0, this.key, this.use.bind(this));
|
|
193
184
|
this.onUnmount(() => {
|
|
194
|
-
delete
|
|
185
|
+
delete _chunkBSE2DSDKjs.Context.pluginRecord[this.key];
|
|
195
186
|
});
|
|
196
187
|
}
|
|
197
188
|
};
|
|
198
|
-
|
|
189
|
+
_chunkZP7HNASUjs.__name.call(void 0, PPlugin, "PPlugin");
|
|
199
190
|
|
|
200
191
|
// src/modules/extension.ts
|
|
201
192
|
|
|
@@ -205,38 +196,38 @@ var PExtension = class extends Dev {
|
|
|
205
196
|
super();
|
|
206
197
|
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
207
198
|
if (this.pipe) {
|
|
208
|
-
|
|
199
|
+
_chunkBSE2DSDKjs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
209
200
|
this.onUnmount(() => {
|
|
210
|
-
delete
|
|
201
|
+
delete _chunkBSE2DSDKjs.Context.pipeRecord[key];
|
|
211
202
|
});
|
|
212
203
|
}
|
|
213
204
|
if (this.plugin) {
|
|
214
|
-
|
|
205
|
+
_chunkBSE2DSDKjs.addPlugin.call(void 0, key, this.plugin.bind(this));
|
|
215
206
|
this.onUnmount(() => {
|
|
216
|
-
delete
|
|
207
|
+
delete _chunkBSE2DSDKjs.Context.pluginRecord[key];
|
|
217
208
|
});
|
|
218
209
|
}
|
|
219
210
|
if (this.intercept) {
|
|
220
|
-
|
|
211
|
+
_chunkBSE2DSDKjs.addInterceptor.call(void 0, key, this.intercept.bind(this));
|
|
221
212
|
this.onUnmount(() => {
|
|
222
|
-
delete
|
|
213
|
+
delete _chunkBSE2DSDKjs.Context.interceptorRecord[key];
|
|
223
214
|
});
|
|
224
215
|
}
|
|
225
216
|
if (this.guard) {
|
|
226
|
-
|
|
217
|
+
_chunkBSE2DSDKjs.addGuard.call(void 0, key, this.guard.bind(this));
|
|
227
218
|
this.onUnmount(() => {
|
|
228
|
-
delete
|
|
219
|
+
delete _chunkBSE2DSDKjs.Context.guardRecord[key];
|
|
229
220
|
});
|
|
230
221
|
}
|
|
231
222
|
if (this.filter) {
|
|
232
|
-
|
|
223
|
+
_chunkBSE2DSDKjs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
233
224
|
this.onUnmount(() => {
|
|
234
|
-
delete
|
|
225
|
+
delete _chunkBSE2DSDKjs.Context.filterRecord[key];
|
|
235
226
|
});
|
|
236
227
|
}
|
|
237
228
|
}
|
|
238
229
|
};
|
|
239
|
-
|
|
230
|
+
_chunkZP7HNASUjs.__name.call(void 0, PExtension, "PExtension");
|
|
240
231
|
|
|
241
232
|
// src/generator/utils.ts
|
|
242
233
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
@@ -253,7 +244,7 @@ var Generator = class {
|
|
|
253
244
|
await _fsextra2.default.outputFile(this.path, this.generateCode(meta.map((item) => item.data)));
|
|
254
245
|
}
|
|
255
246
|
};
|
|
256
|
-
|
|
247
|
+
_chunkZP7HNASUjs.__name.call(void 0, Generator, "Generator");
|
|
257
248
|
|
|
258
249
|
// src/generator/rpc.ts
|
|
259
250
|
var RPCGenerator = (_class2 = class extends Generator {constructor(...args2) { super(...args2); _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
|
|
@@ -290,7 +281,7 @@ var RPCGenerator = (_class2 = class extends Generator {constructor(...args2) { s
|
|
|
290
281
|
return this.getContent();
|
|
291
282
|
}
|
|
292
283
|
}, _class2);
|
|
293
|
-
|
|
284
|
+
_chunkZP7HNASUjs.__name.call(void 0, RPCGenerator, "RPCGenerator");
|
|
294
285
|
|
|
295
286
|
// src/generator/http.ts
|
|
296
287
|
var HTTPGenerator = (_class3 = class extends Generator {constructor(...args3) { super(...args3); _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
|
|
@@ -332,7 +323,7 @@ return ret
|
|
|
332
323
|
return this.getContent();
|
|
333
324
|
}
|
|
334
325
|
}, _class3);
|
|
335
|
-
|
|
326
|
+
_chunkZP7HNASUjs.__name.call(void 0, HTTPGenerator, "HTTPGenerator");
|
|
336
327
|
|
|
337
328
|
// src/index.ts
|
|
338
329
|
|
|
@@ -410,14 +401,4 @@ _chunkXNTMYLK6js.__name.call(void 0, HTTPGenerator, "HTTPGenerator");
|
|
|
410
401
|
|
|
411
402
|
|
|
412
403
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
exports.Arg = _chunkGHOKWS5Vjs.Arg; exports.BadGatewayException = _chunkQG4X6H5Yjs.BadGatewayException; exports.BadRequestException = _chunkQG4X6H5Yjs.BadRequestException; exports.BaseParam = _chunkGHOKWS5Vjs.BaseParam; exports.Body = _chunkGHOKWS5Vjs.Body; exports.ConflictException = _chunkQG4X6H5Yjs.ConflictException; exports.Context = _chunkQG4X6H5Yjs.Context; exports.Controller = _chunkGHOKWS5Vjs.Controller; exports.Ctx = _chunkGHOKWS5Vjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkGHOKWS5Vjs.Define; exports.Delete = _chunkGHOKWS5Vjs.Delete; exports.Dev = Dev; exports.ERROR_SYMBOL = _chunkXNTMYLK6js.ERROR_SYMBOL; exports.Event = _chunkGHOKWS5Vjs.Event; exports.Exception = _chunkQG4X6H5Yjs.Exception; exports.Factory = _chunk423JPSEBjs.Factory; exports.Filter = _chunkGHOKWS5Vjs.Filter; exports.ForbiddenException = _chunkQG4X6H5Yjs.ForbiddenException; exports.FrameworkException = _chunkQG4X6H5Yjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkGHOKWS5Vjs.Get; exports.Guard = _chunkGHOKWS5Vjs.Guard; exports.HMR = _chunkQG4X6H5Yjs.HMR; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkGHOKWS5Vjs.Head; exports.Header = _chunkGHOKWS5Vjs.Header; exports.IS_HMR = _chunkXNTMYLK6js.IS_HMR; exports.IS_ONLY_GENERATE = _chunkXNTMYLK6js.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkXNTMYLK6js.IS_STRICT; exports.Injectable = _chunkGHOKWS5Vjs.Injectable; exports.Interceptor = _chunkGHOKWS5Vjs.Interceptor; exports.InvalidInputException = _chunkQG4X6H5Yjs.InvalidInputException; exports.LOG_LEVEL = _chunkXNTMYLK6js.LOG_LEVEL; exports.Meta = _chunk423JPSEBjs.Meta; exports.Mix = _chunkXNTMYLK6js.Mix; exports.NotFoundException = _chunkQG4X6H5Yjs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkXNTMYLK6js.PS_EXIT_CODE; exports.Param = _chunkGHOKWS5Vjs.Param; exports.Patch = _chunkGHOKWS5Vjs.Patch; exports.PayloadLargeException = _chunkQG4X6H5Yjs.PayloadLargeException; exports.Pipe = _chunkGHOKWS5Vjs.Pipe; exports.Plugin = _chunkGHOKWS5Vjs.Plugin; exports.Post = _chunkGHOKWS5Vjs.Post; exports.Put = _chunkGHOKWS5Vjs.Put; exports.Query = _chunkGHOKWS5Vjs.Query; exports.Queue = _chunkGHOKWS5Vjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkGHOKWS5Vjs.Route; exports.Rpc = _chunkGHOKWS5Vjs.Rpc; exports.ServiceUnavailableException = _chunkQG4X6H5Yjs.ServiceUnavailableException; exports.TimeoutException = _chunkQG4X6H5Yjs.TimeoutException; exports.TimerException = _chunkQG4X6H5Yjs.TimerException; exports.UNMOUNT_SYMBOL = _chunkXNTMYLK6js.UNMOUNT_SYMBOL; exports.UnauthorizedException = _chunkQG4X6H5Yjs.UnauthorizedException; exports.UndefinedException = _chunkQG4X6H5Yjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkQG4X6H5Yjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkQG4X6H5Yjs.ValidateException; exports.WorkerException = _chunkQG4X6H5Yjs.WorkerException; exports.addFilter = _chunkQG4X6H5Yjs.addFilter; exports.addGuard = _chunkQG4X6H5Yjs.addGuard; exports.addInterceptor = _chunkQG4X6H5Yjs.addInterceptor; exports.addPipe = _chunkQG4X6H5Yjs.addPipe; exports.addPlugin = _chunkQG4X6H5Yjs.addPlugin; exports.argToReq = _chunkQG4X6H5Yjs.argToReq; exports.createControllerMetaMap = _chunkQG4X6H5Yjs.createControllerMetaMap; exports.defaultPipe = _chunkQG4X6H5Yjs.defaultPipe; exports.detectAopDep = _chunkQG4X6H5Yjs.detectAopDep; exports.emitter = _chunk423JPSEBjs.emitter; exports.genClientQueue = _chunkQG4X6H5Yjs.genClientQueue; exports.log = _chunkXNTMYLK6js.log; exports.mergeArray = _chunkQG4X6H5Yjs.mergeArray; exports.mergeObject = _chunkQG4X6H5Yjs.mergeObject; exports.resolveDep = _chunkQG4X6H5Yjs.resolveDep; exports.setLogger = _chunkXNTMYLK6js.setLogger; exports.shallowClone = _chunkQG4X6H5Yjs.shallowClone;
|
|
423
|
-
//# sourceMappingURL=index.js.map
|
|
404
|
+
exports.Arg = _chunkVMLHTEW3js.Arg; exports.BadGatewayException = _chunkBSE2DSDKjs.BadGatewayException; exports.BadRequestException = _chunkBSE2DSDKjs.BadRequestException; exports.BaseParam = _chunkVMLHTEW3js.BaseParam; exports.Body = _chunkVMLHTEW3js.Body; exports.ConflictException = _chunkBSE2DSDKjs.ConflictException; exports.Context = _chunkBSE2DSDKjs.Context; exports.Controller = _chunkVMLHTEW3js.Controller; exports.Ctx = _chunkVMLHTEW3js.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkVMLHTEW3js.Define; exports.Delete = _chunkVMLHTEW3js.Delete; exports.Dev = Dev; exports.ERROR_SYMBOL = _chunkZP7HNASUjs.ERROR_SYMBOL; exports.Event = _chunkVMLHTEW3js.Event; exports.Exception = _chunkBSE2DSDKjs.Exception; exports.Factory = _chunk5BVUCNMAjs.Factory; exports.Filter = _chunkVMLHTEW3js.Filter; exports.ForbiddenException = _chunkBSE2DSDKjs.ForbiddenException; exports.FrameworkException = _chunkBSE2DSDKjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkVMLHTEW3js.Get; exports.Guard = _chunkVMLHTEW3js.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkVMLHTEW3js.Head; exports.Header = _chunkVMLHTEW3js.Header; exports.IS_HMR = _chunkZP7HNASUjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkZP7HNASUjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkZP7HNASUjs.IS_STRICT; exports.Injectable = _chunkVMLHTEW3js.Injectable; exports.Interceptor = _chunkVMLHTEW3js.Interceptor; exports.InvalidInputException = _chunkBSE2DSDKjs.InvalidInputException; exports.LOG_LEVEL = _chunkZP7HNASUjs.LOG_LEVEL; exports.Meta = _chunk5BVUCNMAjs.Meta; exports.Mix = _chunkZP7HNASUjs.Mix; exports.NotFoundException = _chunkBSE2DSDKjs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkZP7HNASUjs.PS_EXIT_CODE; exports.Param = _chunkVMLHTEW3js.Param; exports.Patch = _chunkVMLHTEW3js.Patch; exports.PayloadLargeException = _chunkBSE2DSDKjs.PayloadLargeException; exports.Pipe = _chunkVMLHTEW3js.Pipe; exports.Plugin = _chunkVMLHTEW3js.Plugin; exports.Post = _chunkVMLHTEW3js.Post; exports.Put = _chunkVMLHTEW3js.Put; exports.Query = _chunkVMLHTEW3js.Query; exports.Queue = _chunkVMLHTEW3js.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkVMLHTEW3js.Route; exports.Rpc = _chunkVMLHTEW3js.Rpc; exports.ServiceUnavailableException = _chunkBSE2DSDKjs.ServiceUnavailableException; exports.TimeoutException = _chunkBSE2DSDKjs.TimeoutException; exports.TimerException = _chunkBSE2DSDKjs.TimerException; exports.UNMOUNT_SYMBOL = _chunkZP7HNASUjs.UNMOUNT_SYMBOL; exports.UnauthorizedException = _chunkBSE2DSDKjs.UnauthorizedException; exports.UndefinedException = _chunkBSE2DSDKjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkBSE2DSDKjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkBSE2DSDKjs.ValidateException; exports.WorkerException = _chunkBSE2DSDKjs.WorkerException; exports.addFilter = _chunkBSE2DSDKjs.addFilter; exports.addGuard = _chunkBSE2DSDKjs.addGuard; exports.addInterceptor = _chunkBSE2DSDKjs.addInterceptor; exports.addPipe = _chunkBSE2DSDKjs.addPipe; exports.addPlugin = _chunkBSE2DSDKjs.addPlugin; exports.defaultPipe = _chunkBSE2DSDKjs.defaultPipe; exports.emitter = _chunk5BVUCNMAjs.emitter; exports.log = _chunkZP7HNASUjs.log; exports.setLogger = _chunkZP7HNASUjs.setLogger;
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Factory,
|
|
3
3
|
Meta,
|
|
4
4
|
emitter
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CKQW3FDK.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Arg,
|
|
8
8
|
BaseParam,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
Queue,
|
|
30
30
|
Route,
|
|
31
31
|
Rpc
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-V3WIKOP3.mjs";
|
|
33
33
|
import {
|
|
34
34
|
BadGatewayException,
|
|
35
35
|
BadRequestException,
|
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
Exception,
|
|
39
39
|
ForbiddenException,
|
|
40
40
|
FrameworkException,
|
|
41
|
-
HMR,
|
|
42
41
|
InvalidInputException,
|
|
43
42
|
NotFoundException,
|
|
44
43
|
PayloadLargeException,
|
|
@@ -55,16 +54,8 @@ import {
|
|
|
55
54
|
addInterceptor,
|
|
56
55
|
addPipe,
|
|
57
56
|
addPlugin,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
defaultPipe,
|
|
61
|
-
detectAopDep,
|
|
62
|
-
genClientQueue,
|
|
63
|
-
mergeArray,
|
|
64
|
-
mergeObject,
|
|
65
|
-
resolveDep,
|
|
66
|
-
shallowClone
|
|
67
|
-
} from "./chunk-ZJD235TO.mjs";
|
|
57
|
+
defaultPipe
|
|
58
|
+
} from "./chunk-JE6BBDXW.mjs";
|
|
68
59
|
import {
|
|
69
60
|
ERROR_SYMBOL,
|
|
70
61
|
IS_HMR,
|
|
@@ -77,7 +68,7 @@ import {
|
|
|
77
68
|
__name,
|
|
78
69
|
log,
|
|
79
70
|
setLogger
|
|
80
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-VLV3AO3H.mjs";
|
|
81
72
|
|
|
82
73
|
// src/types.ts
|
|
83
74
|
var ResponseSymbol = Symbol("response");
|
|
@@ -360,7 +351,6 @@ export {
|
|
|
360
351
|
Generator,
|
|
361
352
|
Get,
|
|
362
353
|
Guard,
|
|
363
|
-
HMR,
|
|
364
354
|
HTTPGenerator,
|
|
365
355
|
Head,
|
|
366
356
|
Header,
|
|
@@ -407,17 +397,8 @@ export {
|
|
|
407
397
|
addInterceptor,
|
|
408
398
|
addPipe,
|
|
409
399
|
addPlugin,
|
|
410
|
-
argToReq,
|
|
411
|
-
createControllerMetaMap,
|
|
412
400
|
defaultPipe,
|
|
413
|
-
detectAopDep,
|
|
414
401
|
emitter,
|
|
415
|
-
genClientQueue,
|
|
416
402
|
log,
|
|
417
|
-
|
|
418
|
-
mergeObject,
|
|
419
|
-
resolveDep,
|
|
420
|
-
setLogger,
|
|
421
|
-
shallowClone
|
|
403
|
+
setLogger
|
|
422
404
|
};
|
|
423
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory
|
|
3
|
-
import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-
|
|
2
|
+
import { F as Factory } from '../../core-7f6d2be6.js';
|
|
3
|
+
import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-5d755442.js';
|
|
4
|
+
import { T as ToClientMap } from '../../types-81be0ba3.js';
|
|
4
5
|
import 'phecda-core';
|
|
5
6
|
|
|
6
7
|
interface BullmqCtx extends RpcContext {
|
package/dist/rpc/bullmq/index.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
|
|
11
11
|
|
|
12
12
|
// src/rpc/bullmq/bind.ts
|
|
13
13
|
var _bullmq = require('bullmq');
|
|
@@ -18,14 +18,14 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
18
18
|
const workerMap = {};
|
|
19
19
|
const queueMap = {};
|
|
20
20
|
const existQueue = /* @__PURE__ */ new Set();
|
|
21
|
-
const metaMap =
|
|
21
|
+
const metaMap = _chunkBSE2DSDKjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
22
22
|
const { controller, rpc, func, tag } = meta2.data;
|
|
23
23
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
24
24
|
debug(`register method "${func}" in module "${tag}"`);
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
_chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
guards: globalGuards,
|
|
30
30
|
interceptors: globalInterceptors
|
|
31
31
|
}, "rpc");
|
|
@@ -45,7 +45,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
_chunkZP7HNASUjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
49
49
|
async function handleRequest(job) {
|
|
50
50
|
const { data } = job;
|
|
51
51
|
const { tag, func, args, id, queue: clientQueue, _ps } = data;
|
|
@@ -56,7 +56,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
56
56
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
57
57
|
if (!isEvent && !(clientQueue in queueMap))
|
|
58
58
|
queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
|
|
59
|
-
const context = new (0,
|
|
59
|
+
const context = new (0, _chunkBSE2DSDKjs.Context)({
|
|
60
60
|
type: "bullmq",
|
|
61
61
|
moduleMap,
|
|
62
62
|
meta: meta2,
|
|
@@ -89,9 +89,9 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
_chunkZP7HNASUjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
93
93
|
subscribeQueues();
|
|
94
|
-
|
|
94
|
+
_chunkBSE2DSDKjs.HMR.call(void 0, async () => {
|
|
95
95
|
for (const i in workerMap)
|
|
96
96
|
await workerMap[i].close(true);
|
|
97
97
|
for (const i in queueMap)
|
|
@@ -103,7 +103,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
103
103
|
queueMap
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
_chunkZP7HNASUjs.__name.call(void 0, create, "create");
|
|
107
107
|
|
|
108
108
|
// src/rpc/bullmq/client.ts
|
|
109
109
|
var _events = require('events');
|
|
@@ -114,7 +114,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
114
114
|
const { max, workerOpts, queueOpts, timeout, key } = opts;
|
|
115
115
|
const ret = {};
|
|
116
116
|
const emitter = new (0, _events.EventEmitter)();
|
|
117
|
-
const clientQueue =
|
|
117
|
+
const clientQueue = _chunkBSE2DSDKjs.genClientQueue.call(void 0, key);
|
|
118
118
|
const queueMap = {};
|
|
119
119
|
new (0, _bullmq.Worker)(clientQueue, async (job) => {
|
|
120
120
|
const { data, id, error } = job.data;
|
|
@@ -166,7 +166,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
166
166
|
else
|
|
167
167
|
resolve(data);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_chunkZP7HNASUjs.__name.call(void 0, listener, "listener");
|
|
170
170
|
eventCount++;
|
|
171
171
|
emitter.once(id, listener);
|
|
172
172
|
});
|
|
@@ -176,9 +176,8 @@ async function createClient(controllers, opts = {}) {
|
|
|
176
176
|
}
|
|
177
177
|
return ret;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
_chunkZP7HNASUjs.__name.call(void 0, createClient, "createClient");
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
exports.create = create; exports.createClient = createClient;
|
|
184
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
genClientQueue
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-JE6BBDXW.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-VLV3AO3H.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rpc/bullmq/bind.ts
|
|
13
13
|
import { Queue, Worker } from "bullmq";
|
|
@@ -181,4 +181,3 @@ export {
|
|
|
181
181
|
create,
|
|
182
182
|
createClient
|
|
183
183
|
};
|
|
184
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Consumer, Producer } from 'kafkajs';
|
|
2
|
-
import { F as Factory
|
|
3
|
-
import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-
|
|
2
|
+
import { F as Factory } from '../../core-7f6d2be6.js';
|
|
3
|
+
import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-5d755442.js';
|
|
4
|
+
import { T as ToClientMap } from '../../types-81be0ba3.js';
|
|
4
5
|
import 'phecda-core';
|
|
5
6
|
|
|
6
7
|
interface KafkaCtx extends RpcContext {
|
package/dist/rpc/kafka/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkBSE2DSDKjs = require('../../chunk-BSE2DSDK.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkZP7HNASUjs = require('../../chunk-ZP7HNASU.js');
|
|
10
10
|
|
|
11
11
|
// src/rpc/kafka/bind.ts
|
|
12
12
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
@@ -14,14 +14,14 @@ var debug = _debug2.default.call(void 0, "phecda-server/kafka");
|
|
|
14
14
|
async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
15
15
|
const { globalGuards, globalInterceptors, globalFilter, globalPipe } = opts;
|
|
16
16
|
const existQueue = /* @__PURE__ */ new Set();
|
|
17
|
-
const metaMap =
|
|
17
|
+
const metaMap = _chunkBSE2DSDKjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
18
18
|
const { controller, rpc, func, tag } = meta2.data;
|
|
19
19
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
20
20
|
debug(`register method "${func}" in module "${tag}"`);
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
_chunkBSE2DSDKjs.detectAopDep.call(void 0, meta, {
|
|
25
25
|
guards: globalGuards,
|
|
26
26
|
interceptors: globalInterceptors
|
|
27
27
|
}, "rpc");
|
|
@@ -44,7 +44,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_chunkZP7HNASUjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
48
48
|
await subscribeQueues();
|
|
49
49
|
await consumer.run({
|
|
50
50
|
eachMessage: async ({ message, partition, topic, heartbeat, pause }) => {
|
|
@@ -58,7 +58,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
|
58
58
|
const meta2 = metaMap.get(tag)[func];
|
|
59
59
|
const { data: { rpc } } = meta2;
|
|
60
60
|
const isEvent = rpc.isEvent;
|
|
61
|
-
const context = new (0,
|
|
61
|
+
const context = new (0, _chunkBSE2DSDKjs.Context)({
|
|
62
62
|
type: "kafka",
|
|
63
63
|
moduleMap,
|
|
64
64
|
meta: meta2,
|
|
@@ -111,7 +111,7 @@ async function bind({ consumer, producer }, { moduleMap, meta }, opts = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
_chunkZP7HNASUjs.__name.call(void 0, bind, "bind");
|
|
115
115
|
|
|
116
116
|
// src/rpc/kafka/client.ts
|
|
117
117
|
var _events = require('events');
|
|
@@ -120,7 +120,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
120
120
|
let eventCount = 1;
|
|
121
121
|
const ret = {};
|
|
122
122
|
const emitter = new (0, _events.EventEmitter)();
|
|
123
|
-
const clientQueue =
|
|
123
|
+
const clientQueue = _chunkBSE2DSDKjs.genClientQueue.call(void 0, _optionalChain([opts, 'optionalAccess', _2 => _2.key]));
|
|
124
124
|
await consumer.subscribe({
|
|
125
125
|
topic: clientQueue,
|
|
126
126
|
fromBeginning: true
|
|
@@ -176,7 +176,7 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
176
176
|
else
|
|
177
177
|
resolve(data);
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
_chunkZP7HNASUjs.__name.call(void 0, listener, "listener");
|
|
180
180
|
eventCount++;
|
|
181
181
|
emitter.once(id, listener);
|
|
182
182
|
});
|
|
@@ -194,9 +194,8 @@ async function createClient({ producer, consumer }, controllers, opts) {
|
|
|
194
194
|
});
|
|
195
195
|
return ret;
|
|
196
196
|
}
|
|
197
|
-
|
|
197
|
+
_chunkZP7HNASUjs.__name.call(void 0, createClient, "createClient");
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
|
|
201
201
|
exports.bind = bind; exports.createClient = createClient;
|
|
202
|
-
//# sourceMappingURL=index.js.map
|
package/dist/rpc/kafka/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep,
|
|
5
5
|
genClientQueue
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-JE6BBDXW.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-VLV3AO3H.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/kafka/bind.ts
|
|
12
12
|
import Debug from "debug";
|
|
@@ -199,4 +199,3 @@ export {
|
|
|
199
199
|
bind,
|
|
200
200
|
createClient
|
|
201
201
|
};
|
|
202
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/rpc/nats/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NatsConnection } from 'nats';
|
|
2
|
-
import { F as Factory
|
|
3
|
-
import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-
|
|
2
|
+
import { F as Factory } from '../../core-7f6d2be6.js';
|
|
3
|
+
import { b as RpcContext, R as RpcServerOptions, a as RpcClientOptions } from '../../helper-5d755442.js';
|
|
4
|
+
import { T as ToClientMap } from '../../types-81be0ba3.js';
|
|
4
5
|
import 'phecda-core';
|
|
5
6
|
|
|
6
7
|
interface NatsCtx extends RpcContext {
|