phecda-server 7.0.0-alpha.7 → 7.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +10 -1
- package/dist/{chunk-MENRZSGW.js → chunk-7EMAZGYO.js} +86 -56
- package/dist/{chunk-JPSXNDXP.mjs → chunk-7NWDKK7D.mjs} +1 -1
- package/dist/{chunk-RGSKKTHD.mjs → chunk-B45BN7LY.mjs} +4 -4
- package/dist/{chunk-VYMSCWXC.js → chunk-BBNJVYVX.js} +24 -24
- package/dist/{chunk-XSMUJ77A.js → chunk-QJIAXSLZ.js} +19 -19
- package/dist/{chunk-IRXNF6ZE.mjs → chunk-SGMQZRP6.mjs} +39 -9
- package/dist/{chunk-M5HGFUCV.js → chunk-VSGYTGHY.js} +2 -2
- package/dist/{chunk-C5BVKEGW.mjs → chunk-YKP4ODZA.mjs} +2 -2
- package/dist/{core-CzElxZoF.d.ts → core-BGEsBtTG.d.ts} +1 -1
- package/dist/{core-DU7gQKSk.d.mts → core-BcKywWLd.d.mts} +1 -1
- package/dist/helper.d.mts +3 -2
- package/dist/helper.d.ts +3 -2
- package/dist/helper.js +5 -3
- package/dist/helper.mjs +4 -2
- package/dist/http/elysia/index.d.mts +4 -4
- package/dist/http/elysia/index.d.ts +4 -4
- package/dist/http/elysia/index.js +42 -41
- package/dist/http/elysia/index.mjs +6 -5
- package/dist/http/express/index.d.mts +4 -4
- package/dist/http/express/index.d.ts +4 -4
- package/dist/http/express/index.js +39 -38
- package/dist/http/express/index.mjs +5 -4
- package/dist/http/fastify/index.d.mts +4 -4
- package/dist/http/fastify/index.d.ts +4 -4
- package/dist/http/fastify/index.js +40 -39
- package/dist/http/fastify/index.mjs +6 -5
- package/dist/http/h3/index.d.mts +4 -4
- package/dist/http/h3/index.d.ts +4 -4
- package/dist/http/h3/index.js +40 -39
- package/dist/http/h3/index.mjs +6 -5
- package/dist/http/hono/index.d.mts +4 -4
- package/dist/http/hono/index.d.ts +4 -4
- package/dist/http/hono/index.js +35 -35
- package/dist/http/hono/index.mjs +2 -2
- package/dist/http/hyper-express/index.d.mts +4 -4
- package/dist/http/hyper-express/index.d.ts +4 -4
- package/dist/http/hyper-express/index.js +37 -36
- package/dist/http/hyper-express/index.mjs +5 -4
- package/dist/http/koa/index.d.mts +4 -4
- package/dist/http/koa/index.d.ts +4 -4
- package/dist/http/koa/index.js +39 -38
- package/dist/http/koa/index.mjs +5 -4
- package/dist/index.d.mts +35 -33
- package/dist/index.d.ts +35 -33
- package/dist/index.js +43 -42
- package/dist/index.mjs +15 -14
- package/dist/{meta-BTnLXuCa.d.ts → meta-B_HW7cWh.d.mts} +3 -3
- package/dist/{meta-BTnLXuCa.d.mts → meta-B_HW7cWh.d.ts} +3 -3
- package/dist/rpc/bullmq/index.d.mts +4 -4
- package/dist/rpc/bullmq/index.d.ts +4 -4
- package/dist/rpc/bullmq/index.js +14 -14
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/kafka/index.d.mts +4 -4
- package/dist/rpc/kafka/index.d.ts +4 -4
- package/dist/rpc/kafka/index.js +14 -14
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.d.mts +4 -4
- package/dist/rpc/nats/index.d.ts +4 -4
- package/dist/rpc/nats/index.js +13 -13
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.d.mts +4 -4
- package/dist/rpc/rabbitmq/index.d.ts +4 -4
- package/dist/rpc/rabbitmq/index.js +15 -15
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.d.mts +4 -4
- package/dist/rpc/redis/index.d.ts +4 -4
- package/dist/rpc/redis/index.js +13 -13
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/test.d.mts +2 -2
- package/dist/test.d.ts +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types--E-OCZhC.d.ts → types-C2SQ9U9V.d.mts} +3 -3
- package/dist/{types-CbfaGkPA.d.ts → types-CYF0vha6.d.ts} +3 -3
- package/dist/{types-BYqBeqrs.d.mts → types-DEQb_e59.d.mts} +3 -3
- package/dist/{types-BxlzVoRv.d.mts → types-PFPIQWVF.d.ts} +3 -3
- package/package.json +3 -2
- package/register/loader.mjs +2 -2
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQJIAXSLZjs = require('./chunk-QJIAXSLZ.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ var _chunkXSMUJ77Ajs = require('./chunk-XSMUJ77A.js');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkBBNJVYVXjs = require('./chunk-BBNJVYVX.js');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -56,8 +56,8 @@ var _chunkVYMSCWXCjs = require('./chunk-VYMSCWXC.js');
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
var _chunkMENRZSGWjs = require('./chunk-MENRZSGW.js');
|
|
60
59
|
|
|
60
|
+
var _chunk7EMAZGYOjs = require('./chunk-7EMAZGYO.js');
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
@@ -71,13 +71,14 @@ var _chunkMENRZSGWjs = require('./chunk-MENRZSGW.js');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
var _chunkVSGYTGHYjs = require('./chunk-VSGYTGHY.js');
|
|
75
76
|
|
|
76
77
|
// src/types.ts
|
|
77
78
|
var ResponseSymbol = Symbol("response");
|
|
78
79
|
var CustomResponse = class {
|
|
79
80
|
static {
|
|
80
|
-
|
|
81
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "CustomResponse");
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
};
|
|
@@ -90,54 +91,54 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
90
91
|
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;
|
|
91
92
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
+
_chunkVSGYTGHYjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
|
|
94
95
|
function _ts_metadata(k, v) {
|
|
95
96
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
_chunkVSGYTGHYjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
|
|
98
99
|
var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
|
|
99
100
|
static {
|
|
100
|
-
|
|
101
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "ServerBase");
|
|
101
102
|
}
|
|
102
|
-
__init() {this.emitter = exports.emitter =
|
|
103
|
+
__init() {this.emitter = exports.emitter = _chunkQJIAXSLZjs.emitter}
|
|
103
104
|
log(msg, level = "log") {
|
|
104
|
-
|
|
105
|
+
_chunkVSGYTGHYjs.log.call(void 0, msg, level, this.tag);
|
|
105
106
|
}
|
|
106
107
|
}, _class);
|
|
107
108
|
var HttpBase = class extends ServerBase {
|
|
108
109
|
static {
|
|
109
|
-
|
|
110
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "HttpBase");
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
};
|
|
113
114
|
_ts_decorate([
|
|
114
|
-
|
|
115
|
-
_ts_metadata("design:type", typeof
|
|
115
|
+
_chunkBBNJVYVXjs.Ctx,
|
|
116
|
+
_ts_metadata("design:type", typeof Ctx === "undefined" ? Object : Ctx)
|
|
116
117
|
], HttpBase.prototype, "context", void 0);
|
|
117
118
|
var RpcBase = class extends ServerBase {
|
|
118
119
|
static {
|
|
119
|
-
|
|
120
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "RpcBase");
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
};
|
|
123
124
|
_ts_decorate([
|
|
124
|
-
|
|
125
|
-
_ts_metadata("design:type", typeof
|
|
125
|
+
_chunkBBNJVYVXjs.Ctx,
|
|
126
|
+
_ts_metadata("design:type", typeof Ctx === "undefined" ? Object : Ctx)
|
|
126
127
|
], RpcBase.prototype, "context", void 0);
|
|
127
128
|
|
|
128
129
|
// src/modules/filter.ts
|
|
129
130
|
|
|
130
131
|
var PFilter = class extends ServerBase {
|
|
131
132
|
static {
|
|
132
|
-
|
|
133
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "PFilter");
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
constructor(tag) {
|
|
136
137
|
super();
|
|
137
138
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
138
|
-
|
|
139
|
+
_chunk7EMAZGYOjs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
139
140
|
this.onUnmount(() => {
|
|
140
|
-
delete
|
|
141
|
+
delete _chunk7EMAZGYOjs.Context.filterRecord[this.key];
|
|
141
142
|
});
|
|
142
143
|
}
|
|
143
144
|
};
|
|
@@ -146,16 +147,16 @@ var PFilter = class extends ServerBase {
|
|
|
146
147
|
|
|
147
148
|
var PGuard = (_class2 = class extends ServerBase {
|
|
148
149
|
static {
|
|
149
|
-
|
|
150
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "PGuard");
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
__init2() {this.priority = 0}
|
|
153
154
|
constructor(tag) {
|
|
154
155
|
super();_class2.prototype.__init2.call(this);;
|
|
155
156
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
156
|
-
|
|
157
|
+
_chunk7EMAZGYOjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
157
158
|
this.onUnmount(() => {
|
|
158
|
-
delete
|
|
159
|
+
delete _chunk7EMAZGYOjs.Context.guardRecord[this.key];
|
|
159
160
|
});
|
|
160
161
|
}
|
|
161
162
|
}, _class2);
|
|
@@ -164,15 +165,15 @@ var PGuard = (_class2 = class extends ServerBase {
|
|
|
164
165
|
|
|
165
166
|
var PPipe = class extends ServerBase {
|
|
166
167
|
static {
|
|
167
|
-
|
|
168
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "PPipe");
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
constructor(tag) {
|
|
171
172
|
super();
|
|
172
173
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
173
|
-
|
|
174
|
+
_chunk7EMAZGYOjs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
174
175
|
this.onUnmount(() => {
|
|
175
|
-
delete
|
|
176
|
+
delete _chunk7EMAZGYOjs.Context.pipeRecord[this.key];
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
};
|
|
@@ -181,16 +182,16 @@ var PPipe = class extends ServerBase {
|
|
|
181
182
|
|
|
182
183
|
var PAddon = (_class3 = class extends ServerBase {
|
|
183
184
|
static {
|
|
184
|
-
|
|
185
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "PAddon");
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
__init3() {this.priority = 0}
|
|
188
189
|
constructor(tag) {
|
|
189
190
|
super();_class3.prototype.__init3.call(this);;
|
|
190
191
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
191
|
-
|
|
192
|
+
_chunk7EMAZGYOjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
192
193
|
this.onUnmount(() => {
|
|
193
|
-
delete
|
|
194
|
+
delete _chunk7EMAZGYOjs.Context.addonRecord[this.key];
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
197
|
}, _class3);
|
|
@@ -199,7 +200,7 @@ var PAddon = (_class3 = class extends ServerBase {
|
|
|
199
200
|
|
|
200
201
|
var PExtension = class extends ServerBase {
|
|
201
202
|
static {
|
|
202
|
-
|
|
203
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "PExtension");
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
|
|
@@ -208,27 +209,27 @@ var PExtension = class extends ServerBase {
|
|
|
208
209
|
super();
|
|
209
210
|
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
210
211
|
if (this.pipe) {
|
|
211
|
-
|
|
212
|
+
_chunk7EMAZGYOjs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
212
213
|
this.onUnmount(() => {
|
|
213
|
-
delete
|
|
214
|
+
delete _chunk7EMAZGYOjs.Context.pipeRecord[key];
|
|
214
215
|
});
|
|
215
216
|
}
|
|
216
217
|
if (this.addon) {
|
|
217
|
-
|
|
218
|
+
_chunk7EMAZGYOjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
|
|
218
219
|
this.onUnmount(() => {
|
|
219
|
-
delete
|
|
220
|
+
delete _chunk7EMAZGYOjs.Context.addonRecord[key];
|
|
220
221
|
});
|
|
221
222
|
}
|
|
222
223
|
if (this.guard) {
|
|
223
|
-
|
|
224
|
+
_chunk7EMAZGYOjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
|
|
224
225
|
this.onUnmount(() => {
|
|
225
|
-
delete
|
|
226
|
+
delete _chunk7EMAZGYOjs.Context.guardRecord[key];
|
|
226
227
|
});
|
|
227
228
|
}
|
|
228
229
|
if (this.filter) {
|
|
229
|
-
|
|
230
|
+
_chunk7EMAZGYOjs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
230
231
|
this.onUnmount(() => {
|
|
231
|
-
delete
|
|
232
|
+
delete _chunk7EMAZGYOjs.Context.filterRecord[key];
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
235
|
}
|
|
@@ -238,7 +239,7 @@ var PExtension = class extends ServerBase {
|
|
|
238
239
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
239
240
|
var Generator = class {
|
|
240
241
|
static {
|
|
241
|
-
|
|
242
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "Generator");
|
|
242
243
|
}
|
|
243
244
|
|
|
244
245
|
constructor(path) {
|
|
@@ -255,7 +256,7 @@ var Generator = class {
|
|
|
255
256
|
// src/generator/rpc.ts
|
|
256
257
|
var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { super(...args3); _class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this); }
|
|
257
258
|
static {
|
|
258
|
-
|
|
259
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "RPCGenerator");
|
|
259
260
|
}
|
|
260
261
|
__init4() {this.name = "RPC"}
|
|
261
262
|
__init5() {this.classMap = {}}
|
|
@@ -291,7 +292,7 @@ var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { s
|
|
|
291
292
|
// src/generator/http.ts
|
|
292
293
|
var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) { super(...args4); _class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this); }
|
|
293
294
|
static {
|
|
294
|
-
|
|
295
|
+
_chunkVSGYTGHYjs.__name.call(void 0, this, "HTTPGenerator");
|
|
295
296
|
}
|
|
296
297
|
__init6() {this.name = "HTTP"}
|
|
297
298
|
__init7() {this.classMap = {}}
|
|
@@ -308,7 +309,7 @@ var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) {
|
|
|
308
309
|
addMethod(args) {
|
|
309
310
|
const { http, name, func, params, tag } = args;
|
|
310
311
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.type])) return;
|
|
311
|
-
const url = http.prefix
|
|
312
|
+
const url = _chunk7EMAZGYOjs.joinUrl.call(void 0, http.prefix, http.route).replace(/\/\:([^\/]*)/g, (_, js) => `/{{${js}}}`);
|
|
312
313
|
if (!this.classMap[name]) this.classMap[name] = {};
|
|
313
314
|
this.classMap[name][func] = `
|
|
314
315
|
${func}(...args){
|
|
@@ -409,4 +410,4 @@ return ret
|
|
|
409
410
|
|
|
410
411
|
|
|
411
412
|
|
|
412
|
-
exports.Addon =
|
|
413
|
+
exports.Addon = _chunkBBNJVYVXjs.Addon; exports.Arg = _chunkBBNJVYVXjs.Arg; exports.BadGatewayException = _chunk7EMAZGYOjs.BadGatewayException; exports.BadRequestException = _chunk7EMAZGYOjs.BadRequestException; exports.BaseParam = _chunkBBNJVYVXjs.BaseParam; exports.Body = _chunkBBNJVYVXjs.Body; exports.ConflictException = _chunk7EMAZGYOjs.ConflictException; exports.Context = _chunk7EMAZGYOjs.Context; exports.Controller = _chunkBBNJVYVXjs.Controller; exports.Ctx = _chunkBBNJVYVXjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkBBNJVYVXjs.Define; exports.Delete = _chunkBBNJVYVXjs.Delete; exports.ERROR_SYMBOL = _chunkVSGYTGHYjs.ERROR_SYMBOL; exports.Exception = _chunk7EMAZGYOjs.Exception; exports.Factory = _chunkQJIAXSLZjs.Factory; exports.Filter = _chunkBBNJVYVXjs.Filter; exports.ForbiddenException = _chunk7EMAZGYOjs.ForbiddenException; exports.FrameworkException = _chunk7EMAZGYOjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkBBNJVYVXjs.Get; exports.Guard = _chunkBBNJVYVXjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkBBNJVYVXjs.Head; exports.Header = _chunkBBNJVYVXjs.Header; exports.HttpBase = HttpBase; exports.IS_DEV = _chunkVSGYTGHYjs.IS_DEV; exports.IS_ONLY_GENERATE = _chunkVSGYTGHYjs.IS_ONLY_GENERATE; exports.IS_READY = _chunkVSGYTGHYjs.IS_READY; exports.IS_STRICT = _chunkVSGYTGHYjs.IS_STRICT; exports.InvalidInputException = _chunk7EMAZGYOjs.InvalidInputException; exports.LOG_LEVEL = _chunkVSGYTGHYjs.LOG_LEVEL; exports.Meta = _chunkQJIAXSLZjs.Meta; exports.Mixin = _chunkVSGYTGHYjs.Mixin; exports.NotFoundException = _chunk7EMAZGYOjs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkVSGYTGHYjs.PS_EXIT_CODE; exports.Param = _chunkBBNJVYVXjs.Param; exports.Patch = _chunkBBNJVYVXjs.Patch; exports.PayloadLargeException = _chunk7EMAZGYOjs.PayloadLargeException; exports.Pipe = _chunkBBNJVYVXjs.Pipe; exports.Post = _chunkBBNJVYVXjs.Post; exports.Put = _chunkBBNJVYVXjs.Put; exports.Query = _chunkBBNJVYVXjs.Query; exports.Queue = _chunkBBNJVYVXjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkBBNJVYVXjs.Route; exports.Rpc = _chunkBBNJVYVXjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkBBNJVYVXjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkQJIAXSLZjs.ServerPhecda; exports.ServiceUnavailableException = _chunk7EMAZGYOjs.ServiceUnavailableException; exports.TimeoutException = _chunk7EMAZGYOjs.TimeoutException; exports.TimerException = _chunk7EMAZGYOjs.TimerException; exports.UnauthorizedException = _chunk7EMAZGYOjs.UnauthorizedException; exports.UndefinedException = _chunk7EMAZGYOjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunk7EMAZGYOjs.UnsupportedMediaTypeException; exports.ValidateException = _chunk7EMAZGYOjs.ValidateException; exports.WorkerException = _chunk7EMAZGYOjs.WorkerException; exports.addAddon = _chunk7EMAZGYOjs.addAddon; exports.addFilter = _chunk7EMAZGYOjs.addFilter; exports.addGuard = _chunk7EMAZGYOjs.addGuard; exports.addPipe = _chunk7EMAZGYOjs.addPipe; exports.defaultPipe = _chunk7EMAZGYOjs.defaultPipe; exports.defaultServerInject = _chunkQJIAXSLZjs.defaultServerInject; exports.emitter = _chunkQJIAXSLZjs.emitter; exports.getLogger = _chunkVSGYTGHYjs.getLogger; exports.log = _chunkVSGYTGHYjs.log; exports.phecdaNamespace = _chunkQJIAXSLZjs.phecdaNamespace; exports.runMiddleware = _chunkVSGYTGHYjs.runMiddleware; exports.setLogger = _chunkVSGYTGHYjs.setLogger; exports.useS = _chunkQJIAXSLZjs.useS;
|
package/dist/index.mjs
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
emitter,
|
|
7
7
|
phecdaNamespace,
|
|
8
8
|
useS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-B45BN7LY.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Addon,
|
|
12
12
|
Arg,
|
|
13
13
|
BaseParam,
|
|
14
14
|
Body,
|
|
15
15
|
Controller,
|
|
16
|
-
Ctx,
|
|
16
|
+
Ctx as Ctx2,
|
|
17
17
|
Define,
|
|
18
18
|
Delete,
|
|
19
19
|
Filter,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
Route,
|
|
32
32
|
Rpc,
|
|
33
33
|
Search
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7NWDKK7D.mjs";
|
|
35
35
|
import {
|
|
36
36
|
BadGatewayException,
|
|
37
37
|
BadRequestException,
|
|
@@ -55,11 +55,12 @@ import {
|
|
|
55
55
|
addFilter,
|
|
56
56
|
addGuard,
|
|
57
57
|
addPipe,
|
|
58
|
-
defaultPipe
|
|
59
|
-
|
|
58
|
+
defaultPipe,
|
|
59
|
+
joinUrl
|
|
60
|
+
} from "./chunk-SGMQZRP6.mjs";
|
|
60
61
|
import {
|
|
61
62
|
ERROR_SYMBOL,
|
|
62
|
-
|
|
63
|
+
IS_DEV,
|
|
63
64
|
IS_ONLY_GENERATE,
|
|
64
65
|
IS_READY,
|
|
65
66
|
IS_STRICT,
|
|
@@ -71,7 +72,7 @@ import {
|
|
|
71
72
|
log,
|
|
72
73
|
runMiddleware,
|
|
73
74
|
setLogger
|
|
74
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-YKP4ODZA.mjs";
|
|
75
76
|
|
|
76
77
|
// src/types.ts
|
|
77
78
|
var ResponseSymbol = Symbol("response");
|
|
@@ -111,8 +112,8 @@ var HttpBase = class extends ServerBase {
|
|
|
111
112
|
context;
|
|
112
113
|
};
|
|
113
114
|
_ts_decorate([
|
|
114
|
-
|
|
115
|
-
_ts_metadata("design:type", typeof
|
|
115
|
+
Ctx2,
|
|
116
|
+
_ts_metadata("design:type", typeof Ctx === "undefined" ? Object : Ctx)
|
|
116
117
|
], HttpBase.prototype, "context", void 0);
|
|
117
118
|
var RpcBase = class extends ServerBase {
|
|
118
119
|
static {
|
|
@@ -121,8 +122,8 @@ var RpcBase = class extends ServerBase {
|
|
|
121
122
|
context;
|
|
122
123
|
};
|
|
123
124
|
_ts_decorate([
|
|
124
|
-
|
|
125
|
-
_ts_metadata("design:type", typeof
|
|
125
|
+
Ctx2,
|
|
126
|
+
_ts_metadata("design:type", typeof Ctx === "undefined" ? Object : Ctx)
|
|
126
127
|
], RpcBase.prototype, "context", void 0);
|
|
127
128
|
|
|
128
129
|
// src/modules/filter.ts
|
|
@@ -308,7 +309,7 @@ var HTTPGenerator = class extends Generator {
|
|
|
308
309
|
addMethod(args) {
|
|
309
310
|
const { http, name, func, params, tag } = args;
|
|
310
311
|
if (!http?.type) return;
|
|
311
|
-
const url = http.prefix
|
|
312
|
+
const url = joinUrl(http.prefix, http.route).replace(/\/\:([^\/]*)/g, (_, js) => `/{{${js}}}`);
|
|
312
313
|
if (!this.classMap[name]) this.classMap[name] = {};
|
|
313
314
|
this.classMap[name][func] = `
|
|
314
315
|
${func}(...args){
|
|
@@ -341,7 +342,7 @@ export {
|
|
|
341
342
|
ConflictException,
|
|
342
343
|
Context,
|
|
343
344
|
Controller,
|
|
344
|
-
Ctx,
|
|
345
|
+
Ctx2 as Ctx,
|
|
345
346
|
CustomResponse,
|
|
346
347
|
Define,
|
|
347
348
|
Delete,
|
|
@@ -358,7 +359,7 @@ export {
|
|
|
358
359
|
Head,
|
|
359
360
|
Header,
|
|
360
361
|
HttpBase,
|
|
361
|
-
|
|
362
|
+
IS_DEV,
|
|
362
363
|
IS_ONLY_GENERATE,
|
|
363
364
|
IS_READY,
|
|
364
365
|
IS_STRICT,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Events, Construct } from 'phecda-core';
|
|
2
2
|
|
|
3
3
|
declare const ERROR_SYMBOL = "__PS_ERROR__";
|
|
4
|
-
declare const
|
|
4
|
+
declare const IS_DEV: boolean;
|
|
5
5
|
declare const IS_ONLY_GENERATE: boolean;
|
|
6
6
|
declare const IS_STRICT: boolean;
|
|
7
7
|
declare const LOG_LEVEL: number;
|
|
@@ -32,7 +32,7 @@ type ToClientInstance<Instance extends Record<string, any>> = ParseInstance<Pick
|
|
|
32
32
|
type ToClientFn<Func extends AnyFunction> = (...p: Parameters<Func>) => Promise<BaseReturn<ReturnType<Func>>>;
|
|
33
33
|
type PickFunc<Instance> = Pick<Instance, PickFuncKeys<Instance>>;
|
|
34
34
|
type OmitFunction<Instance> = Omit<Instance, PickFuncKeys<Instance>>;
|
|
35
|
-
interface
|
|
35
|
+
interface BaseCtx {
|
|
36
36
|
meta: ControllerMeta;
|
|
37
37
|
moduleMap: Record<string, any>;
|
|
38
38
|
type: string;
|
|
@@ -105,4 +105,4 @@ interface ControllerMeta extends Meta {
|
|
|
105
105
|
data: ControllerMetaData;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export { type
|
|
108
|
+
export { type BaseCtx as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_DEV 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, IS_READY as m, PS_EXIT_CODE as n };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Events, Construct } from 'phecda-core';
|
|
2
2
|
|
|
3
3
|
declare const ERROR_SYMBOL = "__PS_ERROR__";
|
|
4
|
-
declare const
|
|
4
|
+
declare const IS_DEV: boolean;
|
|
5
5
|
declare const IS_ONLY_GENERATE: boolean;
|
|
6
6
|
declare const IS_STRICT: boolean;
|
|
7
7
|
declare const LOG_LEVEL: number;
|
|
@@ -32,7 +32,7 @@ type ToClientInstance<Instance extends Record<string, any>> = ParseInstance<Pick
|
|
|
32
32
|
type ToClientFn<Func extends AnyFunction> = (...p: Parameters<Func>) => Promise<BaseReturn<ReturnType<Func>>>;
|
|
33
33
|
type PickFunc<Instance> = Pick<Instance, PickFuncKeys<Instance>>;
|
|
34
34
|
type OmitFunction<Instance> = Omit<Instance, PickFuncKeys<Instance>>;
|
|
35
|
-
interface
|
|
35
|
+
interface BaseCtx {
|
|
36
36
|
meta: ControllerMeta;
|
|
37
37
|
moduleMap: Record<string, any>;
|
|
38
38
|
type: string;
|
|
@@ -105,4 +105,4 @@ interface ControllerMeta extends Meta {
|
|
|
105
105
|
data: ControllerMetaData;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export { type
|
|
108
|
+
export { type BaseCtx as B, type ControllerMetaData as C, type DefaultOptions as D, type Emitter as E, IS_DEV 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, IS_READY as m, PS_EXIT_CODE as n };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as
|
|
4
|
-
import { T as ToClientMap } from '../../meta-
|
|
2
|
+
import { F as Factory } from '../../core-BcKywWLd.mjs';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions, b as RpcClientOptions } from '../../types-DEQb_e59.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-B_HW7cWh.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
|
-
interface BullmqCtx extends
|
|
7
|
+
interface BullmqCtx extends RpcCtx {
|
|
8
8
|
type: 'bullmq';
|
|
9
9
|
}
|
|
10
10
|
type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as
|
|
4
|
-
import { T as ToClientMap } from '../../meta-
|
|
2
|
+
import { F as Factory } from '../../core-BGEsBtTG.js';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions, b as RpcClientOptions } from '../../types-CYF0vha6.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-B_HW7cWh.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
|
-
interface BullmqCtx extends
|
|
7
|
+
interface BullmqCtx extends RpcCtx {
|
|
8
8
|
type: 'bullmq';
|
|
9
9
|
}
|
|
10
10
|
type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
|
package/dist/rpc/bullmq/index.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk7EMAZGYOjs = require('../../chunk-7EMAZGYO.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkVSGYTGHYjs = require('../../chunk-VSGYTGHY.js');
|
|
11
11
|
|
|
12
12
|
// src/rpc/bullmq/create.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 = _chunk7EMAZGYOjs.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
|
+
_chunk7EMAZGYOjs.detectAopDep.call(void 0, meta, {
|
|
29
29
|
guards: globalGuards
|
|
30
30
|
}, "rpc");
|
|
31
31
|
async function subscribeQueues() {
|
|
@@ -39,12 +39,12 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
39
39
|
if (existQueue.has(queue)) continue;
|
|
40
40
|
existQueue.add(queue);
|
|
41
41
|
workerMap[queue] = new (0, _bullmq.Worker)(queue, handleRequest, workerOpts);
|
|
42
|
-
|
|
42
|
+
_chunk7EMAZGYOjs.Context.applyAddons(addons, workerMap[queue], "bullmq");
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_chunkVSGYTGHYjs.__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,12 +53,12 @@ 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 aop =
|
|
56
|
+
const aop = _chunk7EMAZGYOjs.Context.getAop(meta2, {
|
|
57
57
|
globalFilter,
|
|
58
58
|
globalGuards,
|
|
59
59
|
globalPipe
|
|
60
60
|
});
|
|
61
|
-
const context = new (0,
|
|
61
|
+
const context = new (0, _chunk7EMAZGYOjs.Context)({
|
|
62
62
|
type: "bullmq",
|
|
63
63
|
category: "rpc",
|
|
64
64
|
moduleMap,
|
|
@@ -86,9 +86,9 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
_chunkVSGYTGHYjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
90
90
|
subscribeQueues();
|
|
91
|
-
|
|
91
|
+
_chunk7EMAZGYOjs.HMR.call(void 0, async () => {
|
|
92
92
|
for (const i in workerMap) await workerMap[i].close(true);
|
|
93
93
|
for (const i in queueMap) await queueMap[i].close();
|
|
94
94
|
await subscribeQueues();
|
|
@@ -98,7 +98,7 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
98
98
|
queueMap
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
_chunkVSGYTGHYjs.__name.call(void 0, create, "create");
|
|
102
102
|
|
|
103
103
|
// src/rpc/bullmq/client.ts
|
|
104
104
|
var _events = require('events');
|
|
@@ -109,7 +109,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
109
109
|
const { max, workerOpts, queueOpts, timeout, key } = opts;
|
|
110
110
|
const ret = {};
|
|
111
111
|
const emitter = new (0, _events.EventEmitter)();
|
|
112
|
-
const clientQueue =
|
|
112
|
+
const clientQueue = _chunk7EMAZGYOjs.genClientQueue.call(void 0, key);
|
|
113
113
|
const queueMap = {};
|
|
114
114
|
new (0, _bullmq.Worker)(clientQueue, async (job) => {
|
|
115
115
|
const { data, id, error } = job.data;
|
|
@@ -154,7 +154,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
154
154
|
if (error) reject(data);
|
|
155
155
|
else resolve(data);
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
_chunkVSGYTGHYjs.__name.call(void 0, listener, "listener");
|
|
158
158
|
eventCount++;
|
|
159
159
|
emitter.once(id, listener);
|
|
160
160
|
});
|
|
@@ -164,7 +164,7 @@ async function createClient(controllers, opts = {}) {
|
|
|
164
164
|
}
|
|
165
165
|
return ret;
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
_chunkVSGYTGHYjs.__name.call(void 0, createClient, "createClient");
|
|
168
168
|
|
|
169
169
|
|
|
170
170
|
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createControllerMetaMap,
|
|
5
5
|
detectAopDep,
|
|
6
6
|
genClientQueue
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-SGMQZRP6.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-YKP4ODZA.mjs";
|
|
11
11
|
|
|
12
12
|
// src/rpc/bullmq/create.ts
|
|
13
13
|
import { Queue, Worker } from "bullmq";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Consumer, Producer } from 'kafkajs';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as
|
|
4
|
-
import { T as ToClientMap } from '../../meta-
|
|
2
|
+
import { F as Factory } from '../../core-BcKywWLd.mjs';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions, b as RpcClientOptions } from '../../types-DEQb_e59.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-B_HW7cWh.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
|
-
interface KafkaCtx extends
|
|
7
|
+
interface KafkaCtx extends RpcCtx {
|
|
8
8
|
type: 'kafka';
|
|
9
9
|
topic: string;
|
|
10
10
|
partition: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Consumer, Producer } from 'kafkajs';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as
|
|
4
|
-
import { T as ToClientMap } from '../../meta-
|
|
2
|
+
import { F as Factory } from '../../core-BGEsBtTG.js';
|
|
3
|
+
import { R as RpcCtx, a as RpcServerOptions, b as RpcClientOptions } from '../../types-CYF0vha6.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-B_HW7cWh.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
|
-
interface KafkaCtx extends
|
|
7
|
+
interface KafkaCtx extends RpcCtx {
|
|
8
8
|
type: 'kafka';
|
|
9
9
|
topic: string;
|
|
10
10
|
partition: number;
|