phecda-server 6.0.1 → 6.1.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/dist/{chunk-YUXERDQ6.mjs → chunk-2CFYUXPM.mjs} +9 -12
- package/dist/{chunk-HDQAT2IM.mjs → chunk-3H3T54IC.mjs} +116 -87
- package/dist/{chunk-TZYATAJX.js → chunk-DVTBLV6I.js} +62 -65
- package/dist/{chunk-UXD62LGG.mjs → chunk-G7TD2VB7.mjs} +10 -2
- package/dist/{chunk-F3W3NN7F.mjs → chunk-J7B24YSE.mjs} +1 -1
- package/dist/{chunk-XCND2QW3.js → chunk-JDV2XJYE.js} +25 -25
- package/dist/chunk-NL6QBQAR.js +266 -0
- package/dist/{chunk-GHFSIZUO.js → chunk-TVT62GIX.js} +11 -3
- package/dist/core-BlN0Spy9.d.ts +47 -0
- package/dist/core-P1CsH6jz.d.mts +47 -0
- package/dist/helper.d.mts +1 -1
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/index.d.mts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +49 -43
- package/dist/index.mjs +19 -13
- package/dist/{types-BlIBlnVT.d.ts → meta-KtfiBIde.d.mts} +44 -44
- package/dist/{types-BlIBlnVT.d.mts → meta-KtfiBIde.d.ts} +44 -44
- package/dist/rpc/bullmq/index.d.mts +3 -3
- package/dist/rpc/bullmq/index.d.ts +3 -3
- package/dist/rpc/bullmq/index.js +12 -12
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +12 -12
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +11 -11
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +13 -13
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +11 -11
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/server/elysia/index.d.mts +3 -3
- package/dist/server/elysia/index.d.ts +3 -3
- package/dist/server/elysia/index.js +44 -32
- package/dist/server/elysia/index.mjs +17 -5
- package/dist/server/express/index.d.mts +3 -3
- package/dist/server/express/index.d.ts +3 -3
- package/dist/server/express/index.js +34 -30
- package/dist/server/express/index.mjs +8 -4
- package/dist/server/fastify/index.d.mts +3 -3
- package/dist/server/fastify/index.d.ts +3 -3
- package/dist/server/fastify/index.js +35 -31
- package/dist/server/fastify/index.mjs +9 -5
- package/dist/server/h3/index.d.mts +3 -3
- package/dist/server/h3/index.d.ts +3 -3
- package/dist/server/h3/index.js +34 -30
- package/dist/server/h3/index.mjs +8 -4
- package/dist/server/hono/index.d.mts +3 -3
- package/dist/server/hono/index.d.ts +3 -3
- package/dist/server/hono/index.js +33 -29
- package/dist/server/hono/index.mjs +8 -4
- package/dist/server/hyper-express/index.d.mts +3 -3
- package/dist/server/hyper-express/index.d.ts +3 -3
- package/dist/server/hyper-express/index.js +33 -29
- package/dist/server/hyper-express/index.mjs +8 -4
- package/dist/server/koa/index.d.mts +3 -3
- package/dist/server/koa/index.d.ts +3 -3
- package/dist/server/koa/index.js +34 -30
- package/dist/server/koa/index.mjs +8 -4
- package/dist/test.d.mts +3 -3
- package/dist/test.d.ts +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-BCJhmpQh.d.ts → types-BvD3B5Ny.d.mts} +4 -2
- package/dist/{types-Dgxirc9f.d.mts → types-DIw7B6Up.d.ts} +4 -2
- package/dist/{types-B-ZFZajI.d.ts → types-JVT0mgLD.d.ts} +1 -1
- package/dist/{types-AgVwUXPC.d.mts → types-t9D1fU6G.d.mts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-LYEZ6RGX.js +0 -237
- package/dist/core-Blq8frmr.d.ts +0 -30
- package/dist/core-D2oL8Ge0.d.mts +0 -30
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
|
|
@@ -24,15 +23,16 @@ var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
|
|
26
|
+
var _chunkJDV2XJYEjs = require('./chunk-JDV2XJYE.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var _chunkXCND2QW3js = require('./chunk-XCND2QW3.js');
|
|
34
33
|
|
|
35
34
|
|
|
35
|
+
var _chunkNL6QBQARjs = require('./chunk-NL6QBQAR.js');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -56,9 +56,9 @@ var _chunkXCND2QW3js = require('./chunk-XCND2QW3.js');
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
var _chunkTZYATAJXjs = require('./chunk-TZYATAJX.js');
|
|
60
59
|
|
|
61
60
|
|
|
61
|
+
var _chunkDVTBLV6Ijs = require('./chunk-DVTBLV6I.js');
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
@@ -68,13 +68,16 @@ var _chunkTZYATAJXjs = require('./chunk-TZYATAJX.js');
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var _chunkTVT62GIXjs = require('./chunk-TVT62GIX.js');
|
|
72
75
|
|
|
73
76
|
// src/types.ts
|
|
74
77
|
var ResponseSymbol = Symbol("response");
|
|
75
78
|
var CustomResponse = class {
|
|
76
79
|
static {
|
|
77
|
-
|
|
80
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "CustomResponse");
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
};
|
|
@@ -87,35 +90,35 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
87
90
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
88
91
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
89
92
|
}
|
|
90
|
-
|
|
93
|
+
_chunkTVT62GIXjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
|
|
91
94
|
function _ts_metadata(k, v) {
|
|
92
95
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
93
96
|
}
|
|
94
|
-
|
|
97
|
+
_chunkTVT62GIXjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
|
|
95
98
|
var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
|
|
96
99
|
static {
|
|
97
|
-
|
|
100
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "ServerBase");
|
|
98
101
|
}
|
|
99
|
-
__init() {this.emitter = exports.emitter =
|
|
102
|
+
__init() {this.emitter = exports.emitter = _chunkNL6QBQARjs.emitter}
|
|
100
103
|
}, _class);
|
|
101
104
|
var HttpBase = class extends ServerBase {
|
|
102
105
|
static {
|
|
103
|
-
|
|
106
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "HttpBase");
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
};
|
|
107
110
|
_ts_decorate([
|
|
108
|
-
|
|
111
|
+
_chunkJDV2XJYEjs.Ctx,
|
|
109
112
|
_ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
|
|
110
113
|
], HttpBase.prototype, "context", void 0);
|
|
111
114
|
var RpcBase = class extends ServerBase {
|
|
112
115
|
static {
|
|
113
|
-
|
|
116
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "RpcBase");
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
};
|
|
117
120
|
_ts_decorate([
|
|
118
|
-
|
|
121
|
+
_chunkJDV2XJYEjs.Ctx,
|
|
119
122
|
_ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
|
|
120
123
|
], RpcBase.prototype, "context", void 0);
|
|
121
124
|
|
|
@@ -123,15 +126,15 @@ _ts_decorate([
|
|
|
123
126
|
|
|
124
127
|
var PFilter = class extends ServerBase {
|
|
125
128
|
static {
|
|
126
|
-
|
|
129
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "PFilter");
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
constructor(tag) {
|
|
130
133
|
super();
|
|
131
134
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
132
|
-
|
|
135
|
+
_chunkDVTBLV6Ijs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
133
136
|
this.onUnmount(() => {
|
|
134
|
-
delete
|
|
137
|
+
delete _chunkDVTBLV6Ijs.Context.filterRecord[this.key];
|
|
135
138
|
});
|
|
136
139
|
}
|
|
137
140
|
};
|
|
@@ -140,15 +143,15 @@ var PFilter = class extends ServerBase {
|
|
|
140
143
|
|
|
141
144
|
var PGuard = class extends ServerBase {
|
|
142
145
|
static {
|
|
143
|
-
|
|
146
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "PGuard");
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
constructor(tag) {
|
|
147
150
|
super();
|
|
148
151
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
149
|
-
|
|
152
|
+
_chunkDVTBLV6Ijs.addGuard.call(void 0, this.key, this.use.bind(this));
|
|
150
153
|
this.onUnmount(() => {
|
|
151
|
-
delete
|
|
154
|
+
delete _chunkDVTBLV6Ijs.Context.guardRecord[this.key];
|
|
152
155
|
});
|
|
153
156
|
}
|
|
154
157
|
};
|
|
@@ -157,16 +160,16 @@ var PGuard = class extends ServerBase {
|
|
|
157
160
|
|
|
158
161
|
var PInterceptor = class extends ServerBase {
|
|
159
162
|
static {
|
|
160
|
-
|
|
163
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "PInterceptor");
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
constructor(tag) {
|
|
164
167
|
super();
|
|
165
168
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
166
169
|
this.onUnmount(() => {
|
|
167
|
-
delete
|
|
170
|
+
delete _chunkDVTBLV6Ijs.Context.interceptorRecord[this.key];
|
|
168
171
|
});
|
|
169
|
-
|
|
172
|
+
_chunkDVTBLV6Ijs.addInterceptor.call(void 0, this.key, this.use.bind(this));
|
|
170
173
|
}
|
|
171
174
|
};
|
|
172
175
|
|
|
@@ -174,15 +177,15 @@ var PInterceptor = class extends ServerBase {
|
|
|
174
177
|
|
|
175
178
|
var PPipe = class extends ServerBase {
|
|
176
179
|
static {
|
|
177
|
-
|
|
180
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "PPipe");
|
|
178
181
|
}
|
|
179
182
|
|
|
180
183
|
constructor(tag) {
|
|
181
184
|
super();
|
|
182
185
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
183
|
-
|
|
186
|
+
_chunkDVTBLV6Ijs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
184
187
|
this.onUnmount(() => {
|
|
185
|
-
delete
|
|
188
|
+
delete _chunkDVTBLV6Ijs.Context.pipeRecord[this.key];
|
|
186
189
|
});
|
|
187
190
|
}
|
|
188
191
|
};
|
|
@@ -191,15 +194,15 @@ var PPipe = class extends ServerBase {
|
|
|
191
194
|
|
|
192
195
|
var PPlugin = class extends ServerBase {
|
|
193
196
|
static {
|
|
194
|
-
|
|
197
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "PPlugin");
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
constructor(tag) {
|
|
198
201
|
super();
|
|
199
202
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
200
|
-
|
|
203
|
+
_chunkDVTBLV6Ijs.addPlugin.call(void 0, this.key, this.use.bind(this));
|
|
201
204
|
this.onUnmount(() => {
|
|
202
|
-
delete
|
|
205
|
+
delete _chunkDVTBLV6Ijs.Context.pluginRecord[this.key];
|
|
203
206
|
});
|
|
204
207
|
}
|
|
205
208
|
};
|
|
@@ -208,40 +211,40 @@ var PPlugin = class extends ServerBase {
|
|
|
208
211
|
|
|
209
212
|
var PExtension = class extends ServerBase {
|
|
210
213
|
static {
|
|
211
|
-
|
|
214
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "PExtension");
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
constructor(tag) {
|
|
215
218
|
super();
|
|
216
219
|
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
217
220
|
if (this.pipe) {
|
|
218
|
-
|
|
221
|
+
_chunkDVTBLV6Ijs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
219
222
|
this.onUnmount(() => {
|
|
220
|
-
delete
|
|
223
|
+
delete _chunkDVTBLV6Ijs.Context.pipeRecord[key];
|
|
221
224
|
});
|
|
222
225
|
}
|
|
223
226
|
if (this.plugin) {
|
|
224
|
-
|
|
227
|
+
_chunkDVTBLV6Ijs.addPlugin.call(void 0, key, this.plugin.bind(this));
|
|
225
228
|
this.onUnmount(() => {
|
|
226
|
-
delete
|
|
229
|
+
delete _chunkDVTBLV6Ijs.Context.pluginRecord[key];
|
|
227
230
|
});
|
|
228
231
|
}
|
|
229
232
|
if (this.intercept) {
|
|
230
|
-
|
|
233
|
+
_chunkDVTBLV6Ijs.addInterceptor.call(void 0, key, this.intercept.bind(this));
|
|
231
234
|
this.onUnmount(() => {
|
|
232
|
-
delete
|
|
235
|
+
delete _chunkDVTBLV6Ijs.Context.interceptorRecord[key];
|
|
233
236
|
});
|
|
234
237
|
}
|
|
235
238
|
if (this.guard) {
|
|
236
|
-
|
|
239
|
+
_chunkDVTBLV6Ijs.addGuard.call(void 0, key, this.guard.bind(this));
|
|
237
240
|
this.onUnmount(() => {
|
|
238
|
-
delete
|
|
241
|
+
delete _chunkDVTBLV6Ijs.Context.guardRecord[key];
|
|
239
242
|
});
|
|
240
243
|
}
|
|
241
244
|
if (this.filter) {
|
|
242
|
-
|
|
245
|
+
_chunkDVTBLV6Ijs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
243
246
|
this.onUnmount(() => {
|
|
244
|
-
delete
|
|
247
|
+
delete _chunkDVTBLV6Ijs.Context.filterRecord[key];
|
|
245
248
|
});
|
|
246
249
|
}
|
|
247
250
|
}
|
|
@@ -251,7 +254,7 @@ var PExtension = class extends ServerBase {
|
|
|
251
254
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
252
255
|
var Generator = class {
|
|
253
256
|
static {
|
|
254
|
-
|
|
257
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "Generator");
|
|
255
258
|
}
|
|
256
259
|
|
|
257
260
|
constructor(path) {
|
|
@@ -268,7 +271,7 @@ var Generator = class {
|
|
|
268
271
|
// src/generator/rpc.ts
|
|
269
272
|
var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { super(...args3); _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
|
|
270
273
|
static {
|
|
271
|
-
|
|
274
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "RPCGenerator");
|
|
272
275
|
}
|
|
273
276
|
__init2() {this.name = "RPC"}
|
|
274
277
|
__init3() {this.classMap = {}}
|
|
@@ -304,7 +307,7 @@ var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { s
|
|
|
304
307
|
// src/generator/http.ts
|
|
305
308
|
var HTTPGenerator = (_class3 = class extends Generator {constructor(...args4) { super(...args4); _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
|
|
306
309
|
static {
|
|
307
|
-
|
|
310
|
+
_chunkTVT62GIXjs.__name.call(void 0, this, "HTTPGenerator");
|
|
308
311
|
}
|
|
309
312
|
__init4() {this.name = "HTTP"}
|
|
310
313
|
__init5() {this.classMap = {}}
|
|
@@ -420,4 +423,7 @@ return ret
|
|
|
420
423
|
|
|
421
424
|
|
|
422
425
|
|
|
423
|
-
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
exports.Arg = _chunkJDV2XJYEjs.Arg; exports.BadGatewayException = _chunkDVTBLV6Ijs.BadGatewayException; exports.BadRequestException = _chunkDVTBLV6Ijs.BadRequestException; exports.BaseParam = _chunkJDV2XJYEjs.BaseParam; exports.Body = _chunkJDV2XJYEjs.Body; exports.ConflictException = _chunkDVTBLV6Ijs.ConflictException; exports.Context = _chunkDVTBLV6Ijs.Context; exports.Controller = _chunkJDV2XJYEjs.Controller; exports.Ctx = _chunkJDV2XJYEjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkJDV2XJYEjs.Define; exports.Delete = _chunkJDV2XJYEjs.Delete; exports.ERROR_SYMBOL = _chunkTVT62GIXjs.ERROR_SYMBOL; exports.Exception = _chunkDVTBLV6Ijs.Exception; exports.Factory = _chunkNL6QBQARjs.Factory; exports.Filter = _chunkJDV2XJYEjs.Filter; exports.ForbiddenException = _chunkDVTBLV6Ijs.ForbiddenException; exports.FrameworkException = _chunkDVTBLV6Ijs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkJDV2XJYEjs.Get; exports.Guard = _chunkJDV2XJYEjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkJDV2XJYEjs.Head; exports.Header = _chunkJDV2XJYEjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkTVT62GIXjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkTVT62GIXjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkTVT62GIXjs.IS_STRICT; exports.Interceptor = _chunkJDV2XJYEjs.Interceptor; exports.InvalidInputException = _chunkDVTBLV6Ijs.InvalidInputException; exports.LOG_LEVEL = _chunkTVT62GIXjs.LOG_LEVEL; exports.Meta = _chunkNL6QBQARjs.Meta; exports.Mixin = _chunkTVT62GIXjs.Mixin; exports.NotFoundException = _chunkDVTBLV6Ijs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_EXIT_CODE = _chunkTVT62GIXjs.PS_EXIT_CODE; exports.Param = _chunkJDV2XJYEjs.Param; exports.Patch = _chunkJDV2XJYEjs.Patch; exports.PayloadLargeException = _chunkDVTBLV6Ijs.PayloadLargeException; exports.Pipe = _chunkJDV2XJYEjs.Pipe; exports.Plugin = _chunkJDV2XJYEjs.Plugin; exports.Post = _chunkJDV2XJYEjs.Post; exports.Put = _chunkJDV2XJYEjs.Put; exports.Query = _chunkJDV2XJYEjs.Query; exports.Queue = _chunkJDV2XJYEjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkJDV2XJYEjs.Route; exports.Rpc = _chunkJDV2XJYEjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkJDV2XJYEjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkNL6QBQARjs.ServerPhecda; exports.ServiceUnavailableException = _chunkDVTBLV6Ijs.ServiceUnavailableException; exports.TimeoutException = _chunkDVTBLV6Ijs.TimeoutException; exports.TimerException = _chunkDVTBLV6Ijs.TimerException; exports.UnauthorizedException = _chunkDVTBLV6Ijs.UnauthorizedException; exports.UndefinedException = _chunkDVTBLV6Ijs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkDVTBLV6Ijs.UnsupportedMediaTypeException; exports.ValidateException = _chunkDVTBLV6Ijs.ValidateException; exports.WorkerException = _chunkDVTBLV6Ijs.WorkerException; exports.addFilter = _chunkDVTBLV6Ijs.addFilter; exports.addGuard = _chunkDVTBLV6Ijs.addGuard; exports.addInterceptor = _chunkDVTBLV6Ijs.addInterceptor; exports.addPipe = _chunkDVTBLV6Ijs.addPipe; exports.addPlugin = _chunkDVTBLV6Ijs.addPlugin; exports.defaultPipe = _chunkDVTBLV6Ijs.defaultPipe; exports.defaultServerInject = _chunkNL6QBQARjs.defaultServerInject; exports.emitter = _chunkNL6QBQARjs.emitter; exports.getLogger = _chunkTVT62GIXjs.getLogger; exports.log = _chunkTVT62GIXjs.log; exports.phecdaNamespace = _chunkNL6QBQARjs.phecdaNamespace; exports.setLogger = _chunkTVT62GIXjs.setLogger; exports.useS = _chunkNL6QBQARjs.useS;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Factory,
|
|
3
|
-
Meta,
|
|
4
|
-
createPhecda,
|
|
5
|
-
emitter,
|
|
6
|
-
isObject
|
|
7
|
-
} from "./chunk-HDQAT2IM.mjs";
|
|
8
1
|
import {
|
|
9
2
|
Arg,
|
|
10
3
|
BaseParam,
|
|
@@ -30,7 +23,16 @@ import {
|
|
|
30
23
|
Route,
|
|
31
24
|
Rpc,
|
|
32
25
|
Search
|
|
33
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-J7B24YSE.mjs";
|
|
27
|
+
import {
|
|
28
|
+
Factory,
|
|
29
|
+
Meta,
|
|
30
|
+
ServerPhecda,
|
|
31
|
+
defaultServerInject,
|
|
32
|
+
emitter,
|
|
33
|
+
phecdaNamespace,
|
|
34
|
+
useS
|
|
35
|
+
} from "./chunk-3H3T54IC.mjs";
|
|
34
36
|
import {
|
|
35
37
|
BadGatewayException,
|
|
36
38
|
BadRequestException,
|
|
@@ -56,7 +58,7 @@ import {
|
|
|
56
58
|
addPipe,
|
|
57
59
|
addPlugin,
|
|
58
60
|
defaultPipe
|
|
59
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-2CFYUXPM.mjs";
|
|
60
62
|
import {
|
|
61
63
|
ERROR_SYMBOL,
|
|
62
64
|
IS_HMR,
|
|
@@ -66,9 +68,10 @@ import {
|
|
|
66
68
|
Mixin,
|
|
67
69
|
PS_EXIT_CODE,
|
|
68
70
|
__name,
|
|
71
|
+
getLogger,
|
|
69
72
|
log,
|
|
70
73
|
setLogger
|
|
71
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-G7TD2VB7.mjs";
|
|
72
75
|
|
|
73
76
|
// src/types.ts
|
|
74
77
|
var ResponseSymbol = Symbol("response");
|
|
@@ -401,6 +404,7 @@ export {
|
|
|
401
404
|
RpcBase,
|
|
402
405
|
Search,
|
|
403
406
|
ServerBase,
|
|
407
|
+
ServerPhecda,
|
|
404
408
|
ServiceUnavailableException,
|
|
405
409
|
TimeoutException,
|
|
406
410
|
TimerException,
|
|
@@ -414,10 +418,12 @@ export {
|
|
|
414
418
|
addInterceptor,
|
|
415
419
|
addPipe,
|
|
416
420
|
addPlugin,
|
|
417
|
-
createPhecda,
|
|
418
421
|
defaultPipe,
|
|
422
|
+
defaultServerInject,
|
|
419
423
|
emitter,
|
|
420
|
-
|
|
424
|
+
getLogger,
|
|
421
425
|
log,
|
|
422
|
-
|
|
426
|
+
phecdaNamespace,
|
|
427
|
+
setLogger,
|
|
428
|
+
useS
|
|
423
429
|
};
|
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
import { Events, Construct } from 'phecda-core';
|
|
2
2
|
|
|
3
|
-
interface ServiceMetaData {
|
|
4
|
-
func: string;
|
|
5
|
-
name: string;
|
|
6
|
-
tag: string;
|
|
7
|
-
define?: any;
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}
|
|
10
|
-
interface ControllerMetaData extends ServiceMetaData {
|
|
11
|
-
controller: string;
|
|
12
|
-
http?: {
|
|
13
|
-
type: BaseRequestType;
|
|
14
|
-
prefix: string;
|
|
15
|
-
route: string;
|
|
16
|
-
headers?: Record<string, string>;
|
|
17
|
-
};
|
|
18
|
-
rpc?: {
|
|
19
|
-
queue?: string;
|
|
20
|
-
isEvent?: boolean;
|
|
21
|
-
};
|
|
22
|
-
ctxs?: string[];
|
|
23
|
-
params: {
|
|
24
|
-
type: string;
|
|
25
|
-
index: number;
|
|
26
|
-
key: string;
|
|
27
|
-
pipe?: string;
|
|
28
|
-
define: Record<string, any>;
|
|
29
|
-
}[];
|
|
30
|
-
guards: string[];
|
|
31
|
-
pipe?: string;
|
|
32
|
-
filter?: string;
|
|
33
|
-
interceptors: string[];
|
|
34
|
-
plugins: string[];
|
|
35
|
-
}
|
|
36
|
-
type MetaData = ControllerMetaData | ServiceMetaData;
|
|
37
|
-
declare class Meta {
|
|
38
|
-
data: MetaData;
|
|
39
|
-
paramsType: any[];
|
|
40
|
-
constructor(data: MetaData, paramsType: any[]);
|
|
41
|
-
}
|
|
42
|
-
interface ControllerMeta extends Meta {
|
|
43
|
-
data: ControllerMetaData;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
3
|
declare const ERROR_SYMBOL = "__PS_ERROR__";
|
|
47
4
|
declare const IS_HMR: boolean;
|
|
48
5
|
declare const IS_ONLY_GENERATE: boolean;
|
|
@@ -104,4 +61,47 @@ declare class CustomResponse<Value> {
|
|
|
104
61
|
}
|
|
105
62
|
type ExtractResponse<Class extends CustomResponse<any>> = Class extends CustomResponse<infer Value> ? Value : never;
|
|
106
63
|
|
|
107
|
-
|
|
64
|
+
interface ServiceMetaData {
|
|
65
|
+
func: string;
|
|
66
|
+
name: string;
|
|
67
|
+
tag: string;
|
|
68
|
+
define?: any;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
interface ControllerMetaData extends ServiceMetaData {
|
|
72
|
+
controller: string;
|
|
73
|
+
http?: {
|
|
74
|
+
type: BaseRequestType;
|
|
75
|
+
prefix: string;
|
|
76
|
+
route: string;
|
|
77
|
+
headers?: Record<string, string>;
|
|
78
|
+
};
|
|
79
|
+
rpc?: {
|
|
80
|
+
queue?: string;
|
|
81
|
+
isEvent?: boolean;
|
|
82
|
+
};
|
|
83
|
+
ctxs?: string[];
|
|
84
|
+
params: {
|
|
85
|
+
type: string;
|
|
86
|
+
index: number;
|
|
87
|
+
key: string;
|
|
88
|
+
pipe?: string;
|
|
89
|
+
define: Record<string, any>;
|
|
90
|
+
}[];
|
|
91
|
+
guards: string[];
|
|
92
|
+
pipe?: string;
|
|
93
|
+
filter?: string;
|
|
94
|
+
interceptors: string[];
|
|
95
|
+
plugins: string[];
|
|
96
|
+
}
|
|
97
|
+
type MetaData = ControllerMetaData | ServiceMetaData;
|
|
98
|
+
declare class Meta {
|
|
99
|
+
data: MetaData;
|
|
100
|
+
paramsType: any[];
|
|
101
|
+
constructor(data: MetaData, paramsType: any[]);
|
|
102
|
+
}
|
|
103
|
+
interface ControllerMeta extends Meta {
|
|
104
|
+
data: ControllerMetaData;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { type BaseContext as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_HMR as I, LOG_LEVEL as L, Meta as M, type OmitFunction as O, type PickFunc as P, type ServiceMetaData as S, type ToClientMap as T, type ControllerMeta as a, type MetaData as b, type BaseError as c, type ToClientInstance as d, type ToClientFn as e, type BaseReturn as f, type BaseRequestType as g, CustomResponse as h, type ExtractResponse as i, ERROR_SYMBOL as j, IS_ONLY_GENERATE as k, IS_STRICT as l, PS_EXIT_CODE as m };
|
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
import { Events, Construct } from 'phecda-core';
|
|
2
2
|
|
|
3
|
-
interface ServiceMetaData {
|
|
4
|
-
func: string;
|
|
5
|
-
name: string;
|
|
6
|
-
tag: string;
|
|
7
|
-
define?: any;
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}
|
|
10
|
-
interface ControllerMetaData extends ServiceMetaData {
|
|
11
|
-
controller: string;
|
|
12
|
-
http?: {
|
|
13
|
-
type: BaseRequestType;
|
|
14
|
-
prefix: string;
|
|
15
|
-
route: string;
|
|
16
|
-
headers?: Record<string, string>;
|
|
17
|
-
};
|
|
18
|
-
rpc?: {
|
|
19
|
-
queue?: string;
|
|
20
|
-
isEvent?: boolean;
|
|
21
|
-
};
|
|
22
|
-
ctxs?: string[];
|
|
23
|
-
params: {
|
|
24
|
-
type: string;
|
|
25
|
-
index: number;
|
|
26
|
-
key: string;
|
|
27
|
-
pipe?: string;
|
|
28
|
-
define: Record<string, any>;
|
|
29
|
-
}[];
|
|
30
|
-
guards: string[];
|
|
31
|
-
pipe?: string;
|
|
32
|
-
filter?: string;
|
|
33
|
-
interceptors: string[];
|
|
34
|
-
plugins: string[];
|
|
35
|
-
}
|
|
36
|
-
type MetaData = ControllerMetaData | ServiceMetaData;
|
|
37
|
-
declare class Meta {
|
|
38
|
-
data: MetaData;
|
|
39
|
-
paramsType: any[];
|
|
40
|
-
constructor(data: MetaData, paramsType: any[]);
|
|
41
|
-
}
|
|
42
|
-
interface ControllerMeta extends Meta {
|
|
43
|
-
data: ControllerMetaData;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
3
|
declare const ERROR_SYMBOL = "__PS_ERROR__";
|
|
47
4
|
declare const IS_HMR: boolean;
|
|
48
5
|
declare const IS_ONLY_GENERATE: boolean;
|
|
@@ -104,4 +61,47 @@ declare class CustomResponse<Value> {
|
|
|
104
61
|
}
|
|
105
62
|
type ExtractResponse<Class extends CustomResponse<any>> = Class extends CustomResponse<infer Value> ? Value : never;
|
|
106
63
|
|
|
107
|
-
|
|
64
|
+
interface ServiceMetaData {
|
|
65
|
+
func: string;
|
|
66
|
+
name: string;
|
|
67
|
+
tag: string;
|
|
68
|
+
define?: any;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
interface ControllerMetaData extends ServiceMetaData {
|
|
72
|
+
controller: string;
|
|
73
|
+
http?: {
|
|
74
|
+
type: BaseRequestType;
|
|
75
|
+
prefix: string;
|
|
76
|
+
route: string;
|
|
77
|
+
headers?: Record<string, string>;
|
|
78
|
+
};
|
|
79
|
+
rpc?: {
|
|
80
|
+
queue?: string;
|
|
81
|
+
isEvent?: boolean;
|
|
82
|
+
};
|
|
83
|
+
ctxs?: string[];
|
|
84
|
+
params: {
|
|
85
|
+
type: string;
|
|
86
|
+
index: number;
|
|
87
|
+
key: string;
|
|
88
|
+
pipe?: string;
|
|
89
|
+
define: Record<string, any>;
|
|
90
|
+
}[];
|
|
91
|
+
guards: string[];
|
|
92
|
+
pipe?: string;
|
|
93
|
+
filter?: string;
|
|
94
|
+
interceptors: string[];
|
|
95
|
+
plugins: string[];
|
|
96
|
+
}
|
|
97
|
+
type MetaData = ControllerMetaData | ServiceMetaData;
|
|
98
|
+
declare class Meta {
|
|
99
|
+
data: MetaData;
|
|
100
|
+
paramsType: any[];
|
|
101
|
+
constructor(data: MetaData, paramsType: any[]);
|
|
102
|
+
}
|
|
103
|
+
interface ControllerMeta extends Meta {
|
|
104
|
+
data: ControllerMetaData;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { type BaseContext as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_HMR as I, LOG_LEVEL as L, Meta as M, type OmitFunction as O, type PickFunc as P, type ServiceMetaData as S, type ToClientMap as T, type ControllerMeta as a, type MetaData as b, type BaseError as c, type ToClientInstance as d, type ToClientFn as e, type BaseReturn as f, type BaseRequestType as g, CustomResponse as h, type ExtractResponse as i, ERROR_SYMBOL as j, IS_ONLY_GENERATE as k, IS_STRICT as l, PS_EXIT_CODE as m };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-P1CsH6jz.mjs';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-t9D1fU6G.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface BullmqCtx extends RpcContext {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../
|
|
2
|
+
import { F as Factory } from '../../core-BlN0Spy9.js';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-JVT0mgLD.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-KtfiBIde.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
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 _chunkDVTBLV6Ijs = require('../../chunk-DVTBLV6I.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTVT62GIXjs = require('../../chunk-TVT62GIX.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 = _chunkDVTBLV6Ijs.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
|
+
_chunkDVTBLV6Ijs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
guards: globalGuards,
|
|
30
30
|
interceptors: globalInterceptors
|
|
31
31
|
}, "rpc");
|
|
@@ -44,7 +44,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_chunkTVT62GIXjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
48
48
|
async function handleRequest(job) {
|
|
49
49
|
const { data } = job;
|
|
50
50
|
const { tag, func, args, id, queue: clientQueue, _ps } = data;
|
|
@@ -53,7 +53,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
53
53
|
const meta2 = metaMap.get(tag)[func];
|
|
54
54
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
55
55
|
if (!isEvent && !(clientQueue in queueMap)) queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
|
|
56
|
-
const context = new (0,
|
|
56
|
+
const context = new (0, _chunkDVTBLV6Ijs.Context)({
|
|
57
57
|
type: "bullmq",
|
|
58
58
|
moduleMap,
|
|
59
59
|
meta: meta2,
|
|
@@ -85,9 +85,9 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
_chunkTVT62GIXjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
89
89
|
subscribeQueues();
|
|
90
|
-
|
|
90
|
+
_chunkDVTBLV6Ijs.HMR.call(void 0, async () => {
|
|
91
91
|
for (const i in workerMap) await workerMap[i].close(true);
|
|
92
92
|
for (const i in queueMap) await queueMap[i].close();
|
|
93
93
|
await subscribeQueues();
|
|
@@ -97,7 +97,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
97
97
|
queueMap
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
_chunkTVT62GIXjs.__name.call(void 0, create, "create");
|
|
101
101
|
|
|
102
102
|
// src/rpc/bullmq/client.ts
|
|
103
103
|
var _events = require('events');
|
|
@@ -108,7 +108,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
108
108
|
const { max, workerOpts, queueOpts, timeout, key } = opts;
|
|
109
109
|
const ret = {};
|
|
110
110
|
const emitter = new (0, _events.EventEmitter)();
|
|
111
|
-
const clientQueue =
|
|
111
|
+
const clientQueue = _chunkDVTBLV6Ijs.genClientQueue.call(void 0, key);
|
|
112
112
|
const queueMap = {};
|
|
113
113
|
new (0, _bullmq.Worker)(clientQueue, async (job) => {
|
|
114
114
|
const { data, id, error } = job.data;
|
|
@@ -153,7 +153,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
153
153
|
if (error) reject(data);
|
|
154
154
|
else resolve(data);
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
_chunkTVT62GIXjs.__name.call(void 0, listener, "listener");
|
|
157
157
|
eventCount++;
|
|
158
158
|
emitter.once(id, listener);
|
|
159
159
|
});
|
|
@@ -163,7 +163,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
163
163
|
}
|
|
164
164
|
return ret;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
_chunkTVT62GIXjs.__name.call(void 0, createClient, "createClient");
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
|