phecda-server 8.4.1 → 8.5.1
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-RS6H6TEX.js → chunk-5ZZAOOKE.js} +26 -26
- package/dist/{chunk-R73A7HS3.js → chunk-76UDKZOJ.js} +53 -53
- package/dist/{chunk-OUQM7GZH.js → chunk-LLF55NZP.js} +14 -4
- package/dist/{chunk-3OKDXHO7.mjs → chunk-MUUKKO67.mjs} +1 -1
- package/dist/{chunk-SRPCXPAQ.js → chunk-SKGOTR4T.js} +20 -20
- package/dist/{chunk-JRNXLEAU.mjs → chunk-URKOYTBU.mjs} +14 -4
- package/dist/{chunk-US2DTB3Z.mjs → chunk-WST6E6MQ.mjs} +1 -1
- package/dist/{chunk-YDJAOLT2.mjs → chunk-ZHNYWZRL.mjs} +1 -1
- package/dist/helper.d.mts +2 -1
- package/dist/helper.d.ts +2 -1
- package/dist/helper.js +5 -3
- package/dist/helper.mjs +4 -2
- package/dist/http/elysia/index.js +45 -41
- package/dist/http/elysia/index.mjs +10 -6
- package/dist/http/express/index.js +38 -38
- package/dist/http/express/index.mjs +3 -3
- package/dist/http/fastify/index.js +39 -39
- package/dist/http/fastify/index.mjs +4 -4
- package/dist/http/h3/index.js +39 -39
- package/dist/http/h3/index.mjs +3 -3
- package/dist/http/hono/index.js +35 -35
- package/dist/http/hono/index.mjs +3 -3
- package/dist/http/hyper-express/index.js +36 -36
- package/dist/http/hyper-express/index.mjs +3 -3
- package/dist/http/koa/index.js +38 -38
- package/dist/http/koa/index.mjs +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +65 -65
- package/dist/index.mjs +27 -27
- package/dist/rpc/bullmq/index.js +11 -11
- package/dist/rpc/bullmq/index.mjs +2 -2
- package/dist/rpc/electron/index.js +8 -8
- package/dist/rpc/electron/index.mjs +2 -2
- package/dist/rpc/kafka/index.js +10 -10
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.js +11 -11
- package/dist/rpc/nats/index.mjs +2 -2
- package/dist/rpc/rabbitmq/index.js +12 -12
- package/dist/rpc/rabbitmq/index.mjs +2 -2
- package/dist/rpc/redis/index.js +10 -10
- package/dist/rpc/redis/index.mjs +2 -2
- package/dist/rpc/ws/index.js +7 -7
- package/dist/rpc/ws/index.mjs +2 -2
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -303,20 +303,20 @@ declare class RpcBase<Ctx extends RpcCtx = RpcCtx> extends ServerBase {
|
|
|
303
303
|
|
|
304
304
|
declare abstract class PFilter<Ctx extends BaseCtx = any, E extends Exception = Exception> extends ServerBase {
|
|
305
305
|
readonly key: PropertyKey;
|
|
306
|
-
|
|
306
|
+
init(): Promise<void>;
|
|
307
307
|
abstract use(error: Error | E, ctx?: Ctx): BaseError;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
declare abstract class PGuard<Ctx extends BaseCtx = any> extends ServerBase {
|
|
311
|
-
abstract use(ctx: Ctx, next: () => Promise<any>): any;
|
|
312
311
|
readonly key: PropertyKey;
|
|
313
312
|
priority: number;
|
|
314
|
-
|
|
313
|
+
init(): Promise<void>;
|
|
314
|
+
abstract use(ctx: Ctx, next: () => Promise<any>): any;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
declare abstract class PPipe<Ctx extends BaseCtx = any> extends ServerBase {
|
|
318
318
|
readonly key: PropertyKey;
|
|
319
|
-
|
|
319
|
+
init(): Promise<void>;
|
|
320
320
|
abstract use(param: {
|
|
321
321
|
arg: any;
|
|
322
322
|
option?: any;
|
|
@@ -330,7 +330,7 @@ declare abstract class PPipe<Ctx extends BaseCtx = any> extends ServerBase {
|
|
|
330
330
|
declare abstract class PAddon extends ServerBase {
|
|
331
331
|
readonly key: PropertyKey;
|
|
332
332
|
priority: number;
|
|
333
|
-
|
|
333
|
+
init(): Promise<void>;
|
|
334
334
|
abstract use(router: any, framework: string): undefined;
|
|
335
335
|
}
|
|
336
336
|
|
|
@@ -351,7 +351,7 @@ declare class PExtension extends ServerBase {
|
|
|
351
351
|
readonly key: PropertyKey;
|
|
352
352
|
guardPriority: number;
|
|
353
353
|
addonPriority: number;
|
|
354
|
-
|
|
354
|
+
protected init(): Promise<void>;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
declare const defaultFilter: FilterType;
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkSKGOTR4Tjs = require('./chunk-SKGOTR4T.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -33,7 +33,7 @@ var _chunkSRPCXPAQjs = require('./chunk-SRPCXPAQ.js');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunk5ZZAOOKEjs = require('./chunk-5ZZAOOKE.js');
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
@@ -60,7 +60,7 @@ var _chunkRS6H6TEXjs = require('./chunk-RS6H6TEX.js');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunk76UDKZOJjs = require('./chunk-76UDKZOJ.js');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -75,12 +75,12 @@ var _chunkR73A7HS3js = require('./chunk-R73A7HS3.js');
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
var
|
|
78
|
+
var _chunkLLF55NZPjs = require('./chunk-LLF55NZP.js');
|
|
79
79
|
|
|
80
80
|
// src/types.ts
|
|
81
81
|
var CustomResponse = class {
|
|
82
82
|
static {
|
|
83
|
-
|
|
83
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "CustomResponse");
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
};
|
|
@@ -93,38 +93,38 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
93
93
|
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;
|
|
94
94
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
|
|
97
97
|
function _ts_metadata(k, v) {
|
|
98
98
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
|
|
101
101
|
var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
|
|
102
102
|
static {
|
|
103
|
-
|
|
103
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "ServerBase");
|
|
104
104
|
}
|
|
105
|
-
__init() {this.emitter = exports.emitter =
|
|
105
|
+
__init() {this.emitter = exports.emitter = _chunkSKGOTR4Tjs.emitter}
|
|
106
106
|
log(msg, level = "log") {
|
|
107
|
-
|
|
107
|
+
_chunkLLF55NZPjs.log.call(void 0, msg, level, this.tag);
|
|
108
108
|
}
|
|
109
109
|
}, _class);
|
|
110
110
|
var HttpBase = class extends ServerBase {
|
|
111
111
|
static {
|
|
112
|
-
|
|
112
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "HttpBase");
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
};
|
|
116
116
|
_ts_decorate([
|
|
117
|
-
|
|
117
|
+
_chunk5ZZAOOKEjs.Ctx,
|
|
118
118
|
_ts_metadata("design:type", typeof Ctx === "undefined" ? Object : Ctx)
|
|
119
119
|
], HttpBase.prototype, "context", void 0);
|
|
120
120
|
var RpcBase = class extends ServerBase {
|
|
121
121
|
static {
|
|
122
|
-
|
|
122
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "RpcBase");
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
};
|
|
126
126
|
_ts_decorate([
|
|
127
|
-
|
|
127
|
+
_chunk5ZZAOOKEjs.Ctx,
|
|
128
128
|
_ts_metadata("design:type", typeof Ctx === "undefined" ? Object : Ctx)
|
|
129
129
|
], RpcBase.prototype, "context", void 0);
|
|
130
130
|
|
|
@@ -132,33 +132,33 @@ _ts_decorate([
|
|
|
132
132
|
|
|
133
133
|
var PFilter = class extends ServerBase {
|
|
134
134
|
static {
|
|
135
|
-
|
|
135
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "PFilter");
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
super();
|
|
140
|
-
this.key =
|
|
141
|
-
|
|
138
|
+
async init() {
|
|
139
|
+
await super.init();
|
|
140
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
141
|
+
_chunk76UDKZOJjs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
142
142
|
this.onUnmount(() => {
|
|
143
|
-
delete
|
|
143
|
+
delete _chunk76UDKZOJjs.Context.filterRecord[this.key];
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
// src/modules/guard.ts
|
|
149
149
|
|
|
150
|
-
var PGuard = (_class2 = class extends ServerBase {
|
|
150
|
+
var PGuard = (_class2 = class extends ServerBase {constructor(...args3) { super(...args3); _class2.prototype.__init2.call(this); }
|
|
151
151
|
static {
|
|
152
|
-
|
|
152
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "PGuard");
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
__init2() {this.priority = 0}
|
|
156
|
-
|
|
157
|
-
super();
|
|
158
|
-
this.key =
|
|
159
|
-
|
|
156
|
+
async init() {
|
|
157
|
+
await super.init();
|
|
158
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
159
|
+
_chunk76UDKZOJjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
160
160
|
this.onUnmount(() => {
|
|
161
|
-
delete
|
|
161
|
+
delete _chunk76UDKZOJjs.Context.guardRecord[this.key];
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
}, _class2);
|
|
@@ -167,33 +167,33 @@ var PGuard = (_class2 = class extends ServerBase {
|
|
|
167
167
|
|
|
168
168
|
var PPipe = class extends ServerBase {
|
|
169
169
|
static {
|
|
170
|
-
|
|
170
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "PPipe");
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
super();
|
|
175
|
-
this.key =
|
|
176
|
-
|
|
173
|
+
async init() {
|
|
174
|
+
await super.init();
|
|
175
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
176
|
+
_chunk76UDKZOJjs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
177
177
|
this.onUnmount(() => {
|
|
178
|
-
delete
|
|
178
|
+
delete _chunk76UDKZOJjs.Context.pipeRecord[this.key];
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
// src/modules/addon.ts
|
|
184
184
|
|
|
185
|
-
var PAddon = (_class3 = class extends ServerBase {
|
|
185
|
+
var PAddon = (_class3 = class extends ServerBase {constructor(...args4) { super(...args4); _class3.prototype.__init3.call(this); }
|
|
186
186
|
static {
|
|
187
|
-
|
|
187
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "PAddon");
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
__init3() {this.priority = 0}
|
|
191
|
-
|
|
192
|
-
super();
|
|
193
|
-
this.key =
|
|
194
|
-
|
|
191
|
+
async init() {
|
|
192
|
+
await super.init();
|
|
193
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
194
|
+
_chunk76UDKZOJjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
195
195
|
this.onUnmount(() => {
|
|
196
|
-
delete
|
|
196
|
+
delete _chunk76UDKZOJjs.Context.addonRecord[this.key];
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
}, _class3);
|
|
@@ -202,36 +202,36 @@ var PAddon = (_class3 = class extends ServerBase {
|
|
|
202
202
|
|
|
203
203
|
var PExtension = class extends ServerBase {
|
|
204
204
|
static {
|
|
205
|
-
|
|
205
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "PExtension");
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
super();
|
|
212
|
-
|
|
210
|
+
async init() {
|
|
211
|
+
await super.init();
|
|
212
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
213
213
|
if (this.pipe) {
|
|
214
|
-
|
|
214
|
+
_chunk76UDKZOJjs.addPipe.call(void 0, this.key, this.pipe.bind(this));
|
|
215
215
|
this.onUnmount(() => {
|
|
216
|
-
delete
|
|
216
|
+
delete _chunk76UDKZOJjs.Context.pipeRecord[this.key];
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
if (this.addon) {
|
|
220
|
-
|
|
220
|
+
_chunk76UDKZOJjs.addAddon.call(void 0, this.key, this.addon.bind(this), this.addonPriority);
|
|
221
221
|
this.onUnmount(() => {
|
|
222
|
-
delete
|
|
222
|
+
delete _chunk76UDKZOJjs.Context.addonRecord[this.key];
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
if (this.guard) {
|
|
226
|
-
|
|
226
|
+
_chunk76UDKZOJjs.addGuard.call(void 0, this.key, this.guard.bind(this), this.guardPriority);
|
|
227
227
|
this.onUnmount(() => {
|
|
228
|
-
delete
|
|
228
|
+
delete _chunk76UDKZOJjs.Context.guardRecord[this.key];
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
if (this.filter) {
|
|
232
|
-
|
|
232
|
+
_chunk76UDKZOJjs.addFilter.call(void 0, this.key, this.filter.bind(this));
|
|
233
233
|
this.onUnmount(() => {
|
|
234
|
-
delete
|
|
234
|
+
delete _chunk76UDKZOJjs.Context.filterRecord[this.key];
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
}
|
|
@@ -241,7 +241,7 @@ var PExtension = class extends ServerBase {
|
|
|
241
241
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
242
242
|
var Generator = (_class4 = class {
|
|
243
243
|
static {
|
|
244
|
-
|
|
244
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "Generator");
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
constructor(path) {;_class4.prototype.__init4.call(this);
|
|
@@ -257,9 +257,9 @@ var Generator = (_class4 = class {
|
|
|
257
257
|
}, _class4);
|
|
258
258
|
|
|
259
259
|
// src/generator/rpc.ts
|
|
260
|
-
var RPCGenerator = (_class5 = class extends Generator {constructor(...
|
|
260
|
+
var RPCGenerator = (_class5 = class extends Generator {constructor(...args5) { super(...args5); _class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this); }
|
|
261
261
|
static {
|
|
262
|
-
|
|
262
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "RPCGenerator");
|
|
263
263
|
}
|
|
264
264
|
__init5() {this.name = "RPC"}
|
|
265
265
|
__init6() {this.classMap = {}}
|
|
@@ -293,9 +293,9 @@ var RPCGenerator = (_class5 = class extends Generator {constructor(...args3) { s
|
|
|
293
293
|
}, _class5);
|
|
294
294
|
|
|
295
295
|
// src/generator/http.ts
|
|
296
|
-
var HTTPGenerator = (_class6 = class extends Generator {constructor(...
|
|
296
|
+
var HTTPGenerator = (_class6 = class extends Generator {constructor(...args6) { super(...args6); _class6.prototype.__init7.call(this);_class6.prototype.__init8.call(this); }
|
|
297
297
|
static {
|
|
298
|
-
|
|
298
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "HTTPGenerator");
|
|
299
299
|
}
|
|
300
300
|
__init7() {this.name = "HTTP"}
|
|
301
301
|
__init8() {this.classMap = {}}
|
|
@@ -312,7 +312,7 @@ var HTTPGenerator = (_class6 = class extends Generator {constructor(...args4) {
|
|
|
312
312
|
addMethod(args) {
|
|
313
313
|
const { http, name, method, params, tag } = args;
|
|
314
314
|
if (!_optionalChain([http, 'optionalAccess', _2 => _2.method])) return;
|
|
315
|
-
const url =
|
|
315
|
+
const url = _chunk76UDKZOJjs.joinUrl.call(void 0, http.prefix, http.route).replace(/\/\:([^\/]*)/g, (_, js) => `/{{${js}}}`);
|
|
316
316
|
if (!this.classMap[name]) this.classMap[name] = {};
|
|
317
317
|
this.classMap[name][method] = `
|
|
318
318
|
${method}(...args){
|
|
@@ -336,9 +336,9 @@ return ret
|
|
|
336
336
|
|
|
337
337
|
// src/generator/openapi.ts
|
|
338
338
|
|
|
339
|
-
var OpenAPIGenerator = (_class7 = class extends Generator {constructor(...
|
|
339
|
+
var OpenAPIGenerator = (_class7 = class extends Generator {constructor(...args7) { super(...args7); _class7.prototype.__init9.call(this);_class7.prototype.__init10.call(this);_class7.prototype.__init11.call(this); }
|
|
340
340
|
static {
|
|
341
|
-
|
|
341
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "OpenAPIGenerator");
|
|
342
342
|
}
|
|
343
343
|
__init9() {this.ext = ".json"}
|
|
344
344
|
__init10() {this.name = "OpenAPI"}
|
|
@@ -359,7 +359,7 @@ var OpenAPIGenerator = (_class7 = class extends Generator {constructor(...args5)
|
|
|
359
359
|
if (!_optionalChain([http, 'optionalAccess', _3 => _3.method])) return;
|
|
360
360
|
const config = _phecdacore.getMergedMeta.call(void 0, model, method).openapi;
|
|
361
361
|
if (!config) return;
|
|
362
|
-
const path =
|
|
362
|
+
const path = _chunk76UDKZOJjs.joinUrl.call(void 0, http.prefix, http.route);
|
|
363
363
|
if (!this.paths[path]) this.paths[path] = {};
|
|
364
364
|
this.paths[path][http.method] = {
|
|
365
365
|
summary: config.summary,
|
|
@@ -384,7 +384,7 @@ var OpenAPIGenerator = (_class7 = class extends Generator {constructor(...args5)
|
|
|
384
384
|
// src/generator/doc.ts
|
|
385
385
|
var DocGenerator = (_class8 = class extends Generator {
|
|
386
386
|
static {
|
|
387
|
-
|
|
387
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "DocGenerator");
|
|
388
388
|
}
|
|
389
389
|
__init12() {this.name = "DOC"}
|
|
390
390
|
__init13() {this.classMap = {}}
|
|
@@ -418,9 +418,9 @@ var DocGenerator = (_class8 = class extends Generator {
|
|
|
418
418
|
|
|
419
419
|
// src/generator/graph.ts
|
|
420
420
|
|
|
421
|
-
var GraphGenerator = (_class9 = class extends Generator {constructor(...
|
|
421
|
+
var GraphGenerator = (_class9 = class extends Generator {constructor(...args8) { super(...args8); _class9.prototype.__init14.call(this);_class9.prototype.__init15.call(this); }
|
|
422
422
|
static {
|
|
423
|
-
|
|
423
|
+
_chunkLLF55NZPjs.__name.call(void 0, this, "GraphGenerator");
|
|
424
424
|
}
|
|
425
425
|
__init14() {this.ext = ".mmd"}
|
|
426
426
|
__init15() {this.name = "Graph"}
|
|
@@ -538,4 +538,4 @@ var GraphGenerator = (_class9 = class extends Generator {constructor(...args6) {
|
|
|
538
538
|
|
|
539
539
|
|
|
540
540
|
|
|
541
|
-
exports.Addon =
|
|
541
|
+
exports.Addon = _chunk5ZZAOOKEjs.Addon; exports.ApiDoc = _chunk5ZZAOOKEjs.ApiDoc; exports.Arg = _chunk5ZZAOOKEjs.Arg; exports.BadGatewayException = _chunk76UDKZOJjs.BadGatewayException; exports.BadRequestException = _chunk76UDKZOJjs.BadRequestException; exports.BaseParam = _chunk5ZZAOOKEjs.BaseParam; exports.Body = _chunk5ZZAOOKEjs.Body; exports.ConflictException = _chunk76UDKZOJjs.ConflictException; exports.Context = _chunk76UDKZOJjs.Context; exports.Controller = _chunk5ZZAOOKEjs.Controller; exports.Ctx = _chunk5ZZAOOKEjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunk5ZZAOOKEjs.Define; exports.Delete = _chunk5ZZAOOKEjs.Delete; exports.DocGenerator = DocGenerator; exports.ERROR_SYMBOL = _chunkLLF55NZPjs.ERROR_SYMBOL; exports.Exception = _chunk76UDKZOJjs.Exception; exports.Factory = _chunkSKGOTR4Tjs.Factory; exports.Filter = _chunk5ZZAOOKEjs.Filter; exports.ForbiddenException = _chunk76UDKZOJjs.ForbiddenException; exports.FrameworkException = _chunk76UDKZOJjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunk5ZZAOOKEjs.Get; exports.GraphGenerator = GraphGenerator; exports.Guard = _chunk5ZZAOOKEjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunk5ZZAOOKEjs.Head; exports.Header = _chunk5ZZAOOKEjs.Header; exports.HttpBase = HttpBase; exports.IS_DEV = _chunkLLF55NZPjs.IS_DEV; exports.IS_ONLY_GENERATE = _chunkLLF55NZPjs.IS_ONLY_GENERATE; exports.IS_PURE = _chunkLLF55NZPjs.IS_PURE; exports.IS_STRICT = _chunkLLF55NZPjs.IS_STRICT; exports.InvalidInputException = _chunk76UDKZOJjs.InvalidInputException; exports.LOG_LEVEL = _chunkLLF55NZPjs.LOG_LEVEL; exports.Meta = _chunkSKGOTR4Tjs.Meta; exports.Mixin = _chunkLLF55NZPjs.Mixin; exports.NotFoundException = _chunk76UDKZOJjs.NotFoundException; exports.OpenAPIGenerator = OpenAPIGenerator; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkLLF55NZPjs.PS_EXIT_CODE; exports.Param = _chunk5ZZAOOKEjs.Param; exports.Patch = _chunk5ZZAOOKEjs.Patch; exports.PayloadLargeException = _chunk76UDKZOJjs.PayloadLargeException; exports.Pipe = _chunk5ZZAOOKEjs.Pipe; exports.Post = _chunk5ZZAOOKEjs.Post; exports.Put = _chunk5ZZAOOKEjs.Put; exports.Query = _chunk5ZZAOOKEjs.Query; exports.Queue = _chunk5ZZAOOKEjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunk5ZZAOOKEjs.Route; exports.Rpc = _chunk5ZZAOOKEjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunk5ZZAOOKEjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkSKGOTR4Tjs.ServerPhecda; exports.ServiceUnavailableException = _chunk76UDKZOJjs.ServiceUnavailableException; exports.TimeoutException = _chunk76UDKZOJjs.TimeoutException; exports.TimerException = _chunk76UDKZOJjs.TimerException; exports.UnauthorizedException = _chunk76UDKZOJjs.UnauthorizedException; exports.UndefinedException = _chunk76UDKZOJjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunk76UDKZOJjs.UnsupportedMediaTypeException; exports.UploadFile = _chunk5ZZAOOKEjs.UploadFile; exports.ValidateException = _chunk76UDKZOJjs.ValidateException; exports.WorkerException = _chunk76UDKZOJjs.WorkerException; exports.addAddon = _chunk76UDKZOJjs.addAddon; exports.addFilter = _chunk76UDKZOJjs.addFilter; exports.addGuard = _chunk76UDKZOJjs.addGuard; exports.addPipe = _chunk76UDKZOJjs.addPipe; exports.defaultFilter = _chunk76UDKZOJjs.defaultFilter; exports.defaultPipe = _chunk76UDKZOJjs.defaultPipe; exports.defaultServerInject = _chunkSKGOTR4Tjs.defaultServerInject; exports.emitter = _chunkSKGOTR4Tjs.emitter; exports.getLogger = _chunkLLF55NZPjs.getLogger; exports.log = _chunkLLF55NZPjs.log; exports.phecdaNamespace = _chunkSKGOTR4Tjs.phecdaNamespace; exports.runMiddleware = _chunkLLF55NZPjs.runMiddleware; exports.setLogger = _chunkLLF55NZPjs.setLogger; exports.useS = _chunkSKGOTR4Tjs.useS;
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
emitter,
|
|
7
7
|
phecdaNamespace,
|
|
8
8
|
useS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZHNYWZRL.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Addon,
|
|
12
12
|
ApiDoc,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
Rpc,
|
|
34
34
|
Search,
|
|
35
35
|
UploadFile
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-MUUKKO67.mjs";
|
|
37
37
|
import {
|
|
38
38
|
BadGatewayException,
|
|
39
39
|
BadRequestException,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
defaultFilter,
|
|
61
61
|
defaultPipe,
|
|
62
62
|
joinUrl
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-WST6E6MQ.mjs";
|
|
64
64
|
import {
|
|
65
65
|
ERROR_SYMBOL,
|
|
66
66
|
IS_DEV,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
log,
|
|
76
76
|
runMiddleware,
|
|
77
77
|
setLogger
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-URKOYTBU.mjs";
|
|
79
79
|
|
|
80
80
|
// src/types.ts
|
|
81
81
|
var CustomResponse = class {
|
|
@@ -135,9 +135,9 @@ var PFilter = class extends ServerBase {
|
|
|
135
135
|
__name(this, "PFilter");
|
|
136
136
|
}
|
|
137
137
|
key;
|
|
138
|
-
|
|
139
|
-
super();
|
|
140
|
-
this.key =
|
|
138
|
+
async init() {
|
|
139
|
+
await super.init();
|
|
140
|
+
this.key = getTag(this);
|
|
141
141
|
addFilter(this.key, this.use.bind(this));
|
|
142
142
|
this.onUnmount(() => {
|
|
143
143
|
delete Context.filterRecord[this.key];
|
|
@@ -153,9 +153,9 @@ var PGuard = class extends ServerBase {
|
|
|
153
153
|
}
|
|
154
154
|
key;
|
|
155
155
|
priority = 0;
|
|
156
|
-
|
|
157
|
-
super();
|
|
158
|
-
this.key =
|
|
156
|
+
async init() {
|
|
157
|
+
await super.init();
|
|
158
|
+
this.key = getTag2(this);
|
|
159
159
|
addGuard(this.key, this.use.bind(this), this.priority);
|
|
160
160
|
this.onUnmount(() => {
|
|
161
161
|
delete Context.guardRecord[this.key];
|
|
@@ -170,9 +170,9 @@ var PPipe = class extends ServerBase {
|
|
|
170
170
|
__name(this, "PPipe");
|
|
171
171
|
}
|
|
172
172
|
key;
|
|
173
|
-
|
|
174
|
-
super();
|
|
175
|
-
this.key =
|
|
173
|
+
async init() {
|
|
174
|
+
await super.init();
|
|
175
|
+
this.key = getTag3(this);
|
|
176
176
|
addPipe(this.key, this.use.bind(this));
|
|
177
177
|
this.onUnmount(() => {
|
|
178
178
|
delete Context.pipeRecord[this.key];
|
|
@@ -188,9 +188,9 @@ var PAddon = class extends ServerBase {
|
|
|
188
188
|
}
|
|
189
189
|
key;
|
|
190
190
|
priority = 0;
|
|
191
|
-
|
|
192
|
-
super();
|
|
193
|
-
this.key =
|
|
191
|
+
async init() {
|
|
192
|
+
await super.init();
|
|
193
|
+
this.key = getTag4(this);
|
|
194
194
|
addAddon(this.key, this.use.bind(this), this.priority);
|
|
195
195
|
this.onUnmount(() => {
|
|
196
196
|
delete Context.addonRecord[this.key];
|
|
@@ -207,31 +207,31 @@ var PExtension = class extends ServerBase {
|
|
|
207
207
|
key;
|
|
208
208
|
guardPriority;
|
|
209
209
|
addonPriority;
|
|
210
|
-
|
|
211
|
-
super();
|
|
212
|
-
|
|
210
|
+
async init() {
|
|
211
|
+
await super.init();
|
|
212
|
+
this.key = getTag5(this);
|
|
213
213
|
if (this.pipe) {
|
|
214
|
-
addPipe(key, this.pipe.bind(this));
|
|
214
|
+
addPipe(this.key, this.pipe.bind(this));
|
|
215
215
|
this.onUnmount(() => {
|
|
216
|
-
delete Context.pipeRecord[key];
|
|
216
|
+
delete Context.pipeRecord[this.key];
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
if (this.addon) {
|
|
220
|
-
addAddon(key, this.addon.bind(this), this.addonPriority);
|
|
220
|
+
addAddon(this.key, this.addon.bind(this), this.addonPriority);
|
|
221
221
|
this.onUnmount(() => {
|
|
222
|
-
delete Context.addonRecord[key];
|
|
222
|
+
delete Context.addonRecord[this.key];
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
if (this.guard) {
|
|
226
|
-
addGuard(key, this.guard.bind(this), this.guardPriority);
|
|
226
|
+
addGuard(this.key, this.guard.bind(this), this.guardPriority);
|
|
227
227
|
this.onUnmount(() => {
|
|
228
|
-
delete Context.guardRecord[key];
|
|
228
|
+
delete Context.guardRecord[this.key];
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
if (this.filter) {
|
|
232
|
-
addFilter(key, this.filter.bind(this));
|
|
232
|
+
addFilter(this.key, this.filter.bind(this));
|
|
233
233
|
this.onUnmount(() => {
|
|
234
|
-
delete Context.filterRecord[key];
|
|
234
|
+
delete Context.filterRecord[this.key];
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
}
|
package/dist/rpc/bullmq/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk76UDKZOJjs = require('../../chunk-76UDKZOJ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
|
|
10
10
|
|
|
11
11
|
// src/rpc/bullmq/create.ts
|
|
12
12
|
var _bullmq = require('bullmq');
|
|
@@ -17,14 +17,14 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
17
17
|
const workerMap = {};
|
|
18
18
|
const queueMap = {};
|
|
19
19
|
const existQueue = /* @__PURE__ */ new Set();
|
|
20
|
-
const metaMap =
|
|
20
|
+
const metaMap = _chunk76UDKZOJjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
21
21
|
const { controller, rpc, method, tag } = meta2.data;
|
|
22
22
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
23
23
|
debug(`register method "${method}" in module "${tag}"`);
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
_chunk76UDKZOJjs.detectAopDep.call(void 0, meta, {
|
|
28
28
|
guards: globalGuards
|
|
29
29
|
}, "rpc");
|
|
30
30
|
async function subscribeQueues() {
|
|
@@ -38,12 +38,12 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
38
38
|
if (existQueue.has(queue)) continue;
|
|
39
39
|
existQueue.add(queue);
|
|
40
40
|
workerMap[queue] = new (0, _bullmq.Worker)(queue, handleRequest, workerOpts);
|
|
41
|
-
|
|
41
|
+
_chunk76UDKZOJjs.Context.applyAddons(addons, workerMap[queue], "bullmq");
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
_chunkLLF55NZPjs.__name.call(void 0, subscribeQueues, "subscribeQueues");
|
|
47
47
|
async function handleRequest(job) {
|
|
48
48
|
const { data } = job;
|
|
49
49
|
const { tag, method, args, id, queue: clientQueue, _ps } = data;
|
|
@@ -52,12 +52,12 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
52
52
|
const meta2 = metaMap.get(tag)[method];
|
|
53
53
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
54
54
|
if (!isEvent && !(clientQueue in queueMap)) queueMap[clientQueue] = new (0, _bullmq.Queue)(clientQueue, queueOpts);
|
|
55
|
-
const aop =
|
|
55
|
+
const aop = _chunk76UDKZOJjs.Context.getAop(meta2, {
|
|
56
56
|
globalFilter,
|
|
57
57
|
globalGuards,
|
|
58
58
|
globalPipe
|
|
59
59
|
});
|
|
60
|
-
const context = new (0,
|
|
60
|
+
const context = new (0, _chunk76UDKZOJjs.Context)({
|
|
61
61
|
type: "bullmq",
|
|
62
62
|
category: "rpc",
|
|
63
63
|
moduleMap,
|
|
@@ -85,9 +85,9 @@ async function create({ moduleMap, meta }, opts = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
_chunkLLF55NZPjs.__name.call(void 0, handleRequest, "handleRequest");
|
|
89
89
|
subscribeQueues();
|
|
90
|
-
|
|
90
|
+
_chunkLLF55NZPjs.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
|
+
_chunkLLF55NZPjs.__name.call(void 0, create, "create");
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
exports.create = create;
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Context,
|
|
3
3
|
createControllerMetaMap,
|
|
4
4
|
detectAopDep
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-WST6E6MQ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
HMR,
|
|
8
8
|
__name
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-URKOYTBU.mjs";
|
|
10
10
|
|
|
11
11
|
// src/rpc/bullmq/create.ts
|
|
12
12
|
import { Queue, Worker } from "bullmq";
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk76UDKZOJjs = require('../../chunk-76UDKZOJ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkLLF55NZPjs = require('../../chunk-LLF55NZP.js');
|
|
9
9
|
|
|
10
10
|
// src/rpc/electron/bind.ts
|
|
11
11
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
12
12
|
var debug = _debug2.default.call(void 0, "phecda-server/electron");
|
|
13
13
|
function bind(IPC, { moduleMap, meta }, opts = {}) {
|
|
14
14
|
const { globalGuards, globalFilter, globalPipe, globalAddons = [] } = opts;
|
|
15
|
-
const metaMap =
|
|
15
|
+
const metaMap = _chunk76UDKZOJjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
|
|
16
16
|
const { controller, rpc, method, tag } = meta2.data;
|
|
17
17
|
if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
|
|
18
18
|
debug(`register method "${method}" in module "${tag}"`);
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
_chunk76UDKZOJjs.detectAopDep.call(void 0, meta, {
|
|
23
23
|
guards: globalGuards,
|
|
24
24
|
addons: globalAddons
|
|
25
25
|
}, "rpc");
|
|
@@ -31,12 +31,12 @@ function bind(IPC, { moduleMap, meta }, opts = {}) {
|
|
|
31
31
|
if (_ps !== 1) return;
|
|
32
32
|
const meta2 = metaMap.get(tag)[method];
|
|
33
33
|
const { data: { rpc: { isEvent } = {} } } = meta2;
|
|
34
|
-
const aop =
|
|
34
|
+
const aop = _chunk76UDKZOJjs.Context.getAop(meta2, {
|
|
35
35
|
globalFilter,
|
|
36
36
|
globalGuards,
|
|
37
37
|
globalPipe
|
|
38
38
|
});
|
|
39
|
-
const context = new (0,
|
|
39
|
+
const context = new (0, _chunk76UDKZOJjs.Context)({
|
|
40
40
|
type: "electron",
|
|
41
41
|
category: "rpc",
|
|
42
42
|
moduleMap,
|
|
@@ -64,9 +64,9 @@ function bind(IPC, { moduleMap, meta }, opts = {}) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
_chunkLLF55NZPjs.__name.call(void 0, callback, "callback");
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
_chunkLLF55NZPjs.__name.call(void 0, bind, "bind");
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
exports.bind = bind;
|