phecda-server 8.5.0 → 8.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +109 -29
- package/dist/index.mjs +108 -28
- package/package.json +2 -2
package/dist/index.d.mts
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
declare const defaultFilter: FilterType;
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
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
|
+
private _init;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
declare const defaultFilter: FilterType;
|
package/dist/index.js
CHANGED
|
@@ -130,76 +130,151 @@ _ts_decorate([
|
|
|
130
130
|
|
|
131
131
|
// src/modules/filter.ts
|
|
132
132
|
|
|
133
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
134
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
135
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
136
|
+
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;
|
|
137
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
138
|
+
}
|
|
139
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_decorate2, "_ts_decorate");
|
|
140
|
+
function _ts_metadata2(k, v) {
|
|
141
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
142
|
+
}
|
|
143
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_metadata2, "_ts_metadata");
|
|
133
144
|
var PFilter = class extends ServerBase {
|
|
134
145
|
static {
|
|
135
146
|
_chunkLLF55NZPjs.__name.call(void 0, this, "PFilter");
|
|
136
147
|
}
|
|
137
148
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
149
|
+
_init() {
|
|
150
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
141
151
|
_chunk76UDKZOJjs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
142
152
|
this.onUnmount(() => {
|
|
143
153
|
delete _chunk76UDKZOJjs.Context.filterRecord[this.key];
|
|
144
154
|
});
|
|
145
155
|
}
|
|
146
156
|
};
|
|
157
|
+
_ts_decorate2([
|
|
158
|
+
_phecdacore.Init,
|
|
159
|
+
_ts_metadata2("design:type", Function),
|
|
160
|
+
_ts_metadata2("design:paramtypes", []),
|
|
161
|
+
_ts_metadata2("design:returntype", void 0)
|
|
162
|
+
], PFilter.prototype, "_init", null);
|
|
147
163
|
|
|
148
164
|
// src/modules/guard.ts
|
|
149
165
|
|
|
150
|
-
|
|
166
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
167
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
168
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
169
|
+
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;
|
|
170
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
171
|
+
}
|
|
172
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_decorate3, "_ts_decorate");
|
|
173
|
+
function _ts_metadata3(k, v) {
|
|
174
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
175
|
+
}
|
|
176
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_metadata3, "_ts_metadata");
|
|
177
|
+
var PGuard = (_class2 = class extends ServerBase {constructor(...args3) { super(...args3); _class2.prototype.__init2.call(this); }
|
|
151
178
|
static {
|
|
152
179
|
_chunkLLF55NZPjs.__name.call(void 0, this, "PGuard");
|
|
153
180
|
}
|
|
154
181
|
|
|
155
182
|
__init2() {this.priority = 0}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
183
|
+
_init() {
|
|
184
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
159
185
|
_chunk76UDKZOJjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
160
186
|
this.onUnmount(() => {
|
|
161
187
|
delete _chunk76UDKZOJjs.Context.guardRecord[this.key];
|
|
162
188
|
});
|
|
163
189
|
}
|
|
164
190
|
}, _class2);
|
|
191
|
+
_ts_decorate3([
|
|
192
|
+
_phecdacore.Init,
|
|
193
|
+
_ts_metadata3("design:type", Function),
|
|
194
|
+
_ts_metadata3("design:paramtypes", []),
|
|
195
|
+
_ts_metadata3("design:returntype", void 0)
|
|
196
|
+
], PGuard.prototype, "_init", null);
|
|
165
197
|
|
|
166
198
|
// src/modules/pipe.ts
|
|
167
199
|
|
|
200
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
201
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
202
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
203
|
+
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;
|
|
204
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
205
|
+
}
|
|
206
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_decorate4, "_ts_decorate");
|
|
207
|
+
function _ts_metadata4(k, v) {
|
|
208
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
209
|
+
}
|
|
210
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_metadata4, "_ts_metadata");
|
|
168
211
|
var PPipe = class extends ServerBase {
|
|
169
212
|
static {
|
|
170
213
|
_chunkLLF55NZPjs.__name.call(void 0, this, "PPipe");
|
|
171
214
|
}
|
|
172
215
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
216
|
+
_init() {
|
|
217
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
176
218
|
_chunk76UDKZOJjs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
177
219
|
this.onUnmount(() => {
|
|
178
220
|
delete _chunk76UDKZOJjs.Context.pipeRecord[this.key];
|
|
179
221
|
});
|
|
180
222
|
}
|
|
181
223
|
};
|
|
224
|
+
_ts_decorate4([
|
|
225
|
+
_phecdacore.Init,
|
|
226
|
+
_ts_metadata4("design:type", Function),
|
|
227
|
+
_ts_metadata4("design:paramtypes", []),
|
|
228
|
+
_ts_metadata4("design:returntype", void 0)
|
|
229
|
+
], PPipe.prototype, "_init", null);
|
|
182
230
|
|
|
183
231
|
// src/modules/addon.ts
|
|
184
232
|
|
|
185
|
-
|
|
233
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
234
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
235
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
236
|
+
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;
|
|
237
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
238
|
+
}
|
|
239
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_decorate5, "_ts_decorate");
|
|
240
|
+
function _ts_metadata5(k, v) {
|
|
241
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
242
|
+
}
|
|
243
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_metadata5, "_ts_metadata");
|
|
244
|
+
var PAddon = (_class3 = class extends ServerBase {constructor(...args4) { super(...args4); _class3.prototype.__init3.call(this); }
|
|
186
245
|
static {
|
|
187
246
|
_chunkLLF55NZPjs.__name.call(void 0, this, "PAddon");
|
|
188
247
|
}
|
|
189
248
|
|
|
190
249
|
__init3() {this.priority = 0}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
250
|
+
_init() {
|
|
251
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
194
252
|
_chunk76UDKZOJjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
195
253
|
this.onUnmount(() => {
|
|
196
254
|
delete _chunk76UDKZOJjs.Context.addonRecord[this.key];
|
|
197
255
|
});
|
|
198
256
|
}
|
|
199
257
|
}, _class3);
|
|
258
|
+
_ts_decorate5([
|
|
259
|
+
_phecdacore.Init,
|
|
260
|
+
_ts_metadata5("design:type", Function),
|
|
261
|
+
_ts_metadata5("design:paramtypes", []),
|
|
262
|
+
_ts_metadata5("design:returntype", void 0)
|
|
263
|
+
], PAddon.prototype, "_init", null);
|
|
200
264
|
|
|
201
265
|
// src/modules/extension.ts
|
|
202
266
|
|
|
267
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
268
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
269
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
270
|
+
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;
|
|
271
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
272
|
+
}
|
|
273
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_decorate6, "_ts_decorate");
|
|
274
|
+
function _ts_metadata6(k, v) {
|
|
275
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
276
|
+
}
|
|
277
|
+
_chunkLLF55NZPjs.__name.call(void 0, _ts_metadata6, "_ts_metadata");
|
|
203
278
|
var PExtension = class extends ServerBase {
|
|
204
279
|
static {
|
|
205
280
|
_chunkLLF55NZPjs.__name.call(void 0, this, "PExtension");
|
|
@@ -207,35 +282,40 @@ var PExtension = class extends ServerBase {
|
|
|
207
282
|
|
|
208
283
|
|
|
209
284
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
285
|
+
_init() {
|
|
286
|
+
this.key = _phecdacore.getTag.call(void 0, this);
|
|
213
287
|
if (this.pipe) {
|
|
214
|
-
_chunk76UDKZOJjs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
288
|
+
_chunk76UDKZOJjs.addPipe.call(void 0, this.key, this.pipe.bind(this));
|
|
215
289
|
this.onUnmount(() => {
|
|
216
|
-
delete _chunk76UDKZOJjs.Context.pipeRecord[key];
|
|
290
|
+
delete _chunk76UDKZOJjs.Context.pipeRecord[this.key];
|
|
217
291
|
});
|
|
218
292
|
}
|
|
219
293
|
if (this.addon) {
|
|
220
|
-
_chunk76UDKZOJjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
|
|
294
|
+
_chunk76UDKZOJjs.addAddon.call(void 0, this.key, this.addon.bind(this), this.addonPriority);
|
|
221
295
|
this.onUnmount(() => {
|
|
222
|
-
delete _chunk76UDKZOJjs.Context.addonRecord[key];
|
|
296
|
+
delete _chunk76UDKZOJjs.Context.addonRecord[this.key];
|
|
223
297
|
});
|
|
224
298
|
}
|
|
225
299
|
if (this.guard) {
|
|
226
|
-
_chunk76UDKZOJjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
|
|
300
|
+
_chunk76UDKZOJjs.addGuard.call(void 0, this.key, this.guard.bind(this), this.guardPriority);
|
|
227
301
|
this.onUnmount(() => {
|
|
228
|
-
delete _chunk76UDKZOJjs.Context.guardRecord[key];
|
|
302
|
+
delete _chunk76UDKZOJjs.Context.guardRecord[this.key];
|
|
229
303
|
});
|
|
230
304
|
}
|
|
231
305
|
if (this.filter) {
|
|
232
|
-
_chunk76UDKZOJjs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
306
|
+
_chunk76UDKZOJjs.addFilter.call(void 0, this.key, this.filter.bind(this));
|
|
233
307
|
this.onUnmount(() => {
|
|
234
|
-
delete _chunk76UDKZOJjs.Context.filterRecord[key];
|
|
308
|
+
delete _chunk76UDKZOJjs.Context.filterRecord[this.key];
|
|
235
309
|
});
|
|
236
310
|
}
|
|
237
311
|
}
|
|
238
312
|
};
|
|
313
|
+
_ts_decorate6([
|
|
314
|
+
_phecdacore.Init,
|
|
315
|
+
_ts_metadata6("design:type", Function),
|
|
316
|
+
_ts_metadata6("design:paramtypes", []),
|
|
317
|
+
_ts_metadata6("design:returntype", void 0)
|
|
318
|
+
], PExtension.prototype, "_init", null);
|
|
239
319
|
|
|
240
320
|
// src/generator/utils.ts
|
|
241
321
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
@@ -257,7 +337,7 @@ var Generator = (_class4 = class {
|
|
|
257
337
|
}, _class4);
|
|
258
338
|
|
|
259
339
|
// src/generator/rpc.ts
|
|
260
|
-
var RPCGenerator = (_class5 = class extends Generator {constructor(...
|
|
340
|
+
var RPCGenerator = (_class5 = class extends Generator {constructor(...args5) { super(...args5); _class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this); }
|
|
261
341
|
static {
|
|
262
342
|
_chunkLLF55NZPjs.__name.call(void 0, this, "RPCGenerator");
|
|
263
343
|
}
|
|
@@ -293,7 +373,7 @@ var RPCGenerator = (_class5 = class extends Generator {constructor(...args3) { s
|
|
|
293
373
|
}, _class5);
|
|
294
374
|
|
|
295
375
|
// src/generator/http.ts
|
|
296
|
-
var HTTPGenerator = (_class6 = class extends Generator {constructor(...
|
|
376
|
+
var HTTPGenerator = (_class6 = class extends Generator {constructor(...args6) { super(...args6); _class6.prototype.__init7.call(this);_class6.prototype.__init8.call(this); }
|
|
297
377
|
static {
|
|
298
378
|
_chunkLLF55NZPjs.__name.call(void 0, this, "HTTPGenerator");
|
|
299
379
|
}
|
|
@@ -336,7 +416,7 @@ return ret
|
|
|
336
416
|
|
|
337
417
|
// src/generator/openapi.ts
|
|
338
418
|
|
|
339
|
-
var OpenAPIGenerator = (_class7 = class extends Generator {constructor(...
|
|
419
|
+
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
420
|
static {
|
|
341
421
|
_chunkLLF55NZPjs.__name.call(void 0, this, "OpenAPIGenerator");
|
|
342
422
|
}
|
|
@@ -418,7 +498,7 @@ var DocGenerator = (_class8 = class extends Generator {
|
|
|
418
498
|
|
|
419
499
|
// src/generator/graph.ts
|
|
420
500
|
|
|
421
|
-
var GraphGenerator = (_class9 = class extends Generator {constructor(...
|
|
501
|
+
var GraphGenerator = (_class9 = class extends Generator {constructor(...args8) { super(...args8); _class9.prototype.__init14.call(this);_class9.prototype.__init15.call(this); }
|
|
422
502
|
static {
|
|
423
503
|
_chunkLLF55NZPjs.__name.call(void 0, this, "GraphGenerator");
|
|
424
504
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -129,77 +129,152 @@ _ts_decorate([
|
|
|
129
129
|
], RpcBase.prototype, "context", void 0);
|
|
130
130
|
|
|
131
131
|
// src/modules/filter.ts
|
|
132
|
-
import { getTag } from "phecda-core";
|
|
132
|
+
import { getTag, Init } from "phecda-core";
|
|
133
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
134
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
135
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
136
|
+
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;
|
|
137
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
138
|
+
}
|
|
139
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
140
|
+
function _ts_metadata2(k, v) {
|
|
141
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
142
|
+
}
|
|
143
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
133
144
|
var PFilter = class extends ServerBase {
|
|
134
145
|
static {
|
|
135
146
|
__name(this, "PFilter");
|
|
136
147
|
}
|
|
137
148
|
key;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
this.key = tag || getTag(this);
|
|
149
|
+
_init() {
|
|
150
|
+
this.key = getTag(this);
|
|
141
151
|
addFilter(this.key, this.use.bind(this));
|
|
142
152
|
this.onUnmount(() => {
|
|
143
153
|
delete Context.filterRecord[this.key];
|
|
144
154
|
});
|
|
145
155
|
}
|
|
146
156
|
};
|
|
157
|
+
_ts_decorate2([
|
|
158
|
+
Init,
|
|
159
|
+
_ts_metadata2("design:type", Function),
|
|
160
|
+
_ts_metadata2("design:paramtypes", []),
|
|
161
|
+
_ts_metadata2("design:returntype", void 0)
|
|
162
|
+
], PFilter.prototype, "_init", null);
|
|
147
163
|
|
|
148
164
|
// src/modules/guard.ts
|
|
149
|
-
import { getTag as getTag2 } from "phecda-core";
|
|
165
|
+
import { getTag as getTag2, Init as Init2 } from "phecda-core";
|
|
166
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
167
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
168
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
169
|
+
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;
|
|
170
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
171
|
+
}
|
|
172
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
173
|
+
function _ts_metadata3(k, v) {
|
|
174
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
175
|
+
}
|
|
176
|
+
__name(_ts_metadata3, "_ts_metadata");
|
|
150
177
|
var PGuard = class extends ServerBase {
|
|
151
178
|
static {
|
|
152
179
|
__name(this, "PGuard");
|
|
153
180
|
}
|
|
154
181
|
key;
|
|
155
182
|
priority = 0;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.key = tag || getTag2(this);
|
|
183
|
+
_init() {
|
|
184
|
+
this.key = getTag2(this);
|
|
159
185
|
addGuard(this.key, this.use.bind(this), this.priority);
|
|
160
186
|
this.onUnmount(() => {
|
|
161
187
|
delete Context.guardRecord[this.key];
|
|
162
188
|
});
|
|
163
189
|
}
|
|
164
190
|
};
|
|
191
|
+
_ts_decorate3([
|
|
192
|
+
Init2,
|
|
193
|
+
_ts_metadata3("design:type", Function),
|
|
194
|
+
_ts_metadata3("design:paramtypes", []),
|
|
195
|
+
_ts_metadata3("design:returntype", void 0)
|
|
196
|
+
], PGuard.prototype, "_init", null);
|
|
165
197
|
|
|
166
198
|
// src/modules/pipe.ts
|
|
167
|
-
import { getTag as getTag3 } from "phecda-core";
|
|
199
|
+
import { getTag as getTag3, Init as Init3 } from "phecda-core";
|
|
200
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
201
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
202
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
203
|
+
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;
|
|
204
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
205
|
+
}
|
|
206
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
207
|
+
function _ts_metadata4(k, v) {
|
|
208
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
209
|
+
}
|
|
210
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
168
211
|
var PPipe = class extends ServerBase {
|
|
169
212
|
static {
|
|
170
213
|
__name(this, "PPipe");
|
|
171
214
|
}
|
|
172
215
|
key;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.key = tag || getTag3(this);
|
|
216
|
+
_init() {
|
|
217
|
+
this.key = getTag3(this);
|
|
176
218
|
addPipe(this.key, this.use.bind(this));
|
|
177
219
|
this.onUnmount(() => {
|
|
178
220
|
delete Context.pipeRecord[this.key];
|
|
179
221
|
});
|
|
180
222
|
}
|
|
181
223
|
};
|
|
224
|
+
_ts_decorate4([
|
|
225
|
+
Init3,
|
|
226
|
+
_ts_metadata4("design:type", Function),
|
|
227
|
+
_ts_metadata4("design:paramtypes", []),
|
|
228
|
+
_ts_metadata4("design:returntype", void 0)
|
|
229
|
+
], PPipe.prototype, "_init", null);
|
|
182
230
|
|
|
183
231
|
// src/modules/addon.ts
|
|
184
|
-
import { getTag as getTag4 } from "phecda-core";
|
|
232
|
+
import { getTag as getTag4, Init as Init4 } from "phecda-core";
|
|
233
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
234
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
235
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
236
|
+
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;
|
|
237
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
238
|
+
}
|
|
239
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
240
|
+
function _ts_metadata5(k, v) {
|
|
241
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
242
|
+
}
|
|
243
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
185
244
|
var PAddon = class extends ServerBase {
|
|
186
245
|
static {
|
|
187
246
|
__name(this, "PAddon");
|
|
188
247
|
}
|
|
189
248
|
key;
|
|
190
249
|
priority = 0;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.key = tag || getTag4(this);
|
|
250
|
+
_init() {
|
|
251
|
+
this.key = getTag4(this);
|
|
194
252
|
addAddon(this.key, this.use.bind(this), this.priority);
|
|
195
253
|
this.onUnmount(() => {
|
|
196
254
|
delete Context.addonRecord[this.key];
|
|
197
255
|
});
|
|
198
256
|
}
|
|
199
257
|
};
|
|
258
|
+
_ts_decorate5([
|
|
259
|
+
Init4,
|
|
260
|
+
_ts_metadata5("design:type", Function),
|
|
261
|
+
_ts_metadata5("design:paramtypes", []),
|
|
262
|
+
_ts_metadata5("design:returntype", void 0)
|
|
263
|
+
], PAddon.prototype, "_init", null);
|
|
200
264
|
|
|
201
265
|
// src/modules/extension.ts
|
|
202
|
-
import { getTag as getTag5 } from "phecda-core";
|
|
266
|
+
import { getTag as getTag5, Init as Init5 } from "phecda-core";
|
|
267
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
268
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
269
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
270
|
+
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;
|
|
271
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
272
|
+
}
|
|
273
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
274
|
+
function _ts_metadata6(k, v) {
|
|
275
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
276
|
+
}
|
|
277
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
203
278
|
var PExtension = class extends ServerBase {
|
|
204
279
|
static {
|
|
205
280
|
__name(this, "PExtension");
|
|
@@ -207,35 +282,40 @@ var PExtension = class extends ServerBase {
|
|
|
207
282
|
key;
|
|
208
283
|
guardPriority;
|
|
209
284
|
addonPriority;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const key = this.key = tag || getTag5(this);
|
|
285
|
+
_init() {
|
|
286
|
+
this.key = getTag5(this);
|
|
213
287
|
if (this.pipe) {
|
|
214
|
-
addPipe(key, this.pipe.bind(this));
|
|
288
|
+
addPipe(this.key, this.pipe.bind(this));
|
|
215
289
|
this.onUnmount(() => {
|
|
216
|
-
delete Context.pipeRecord[key];
|
|
290
|
+
delete Context.pipeRecord[this.key];
|
|
217
291
|
});
|
|
218
292
|
}
|
|
219
293
|
if (this.addon) {
|
|
220
|
-
addAddon(key, this.addon.bind(this), this.addonPriority);
|
|
294
|
+
addAddon(this.key, this.addon.bind(this), this.addonPriority);
|
|
221
295
|
this.onUnmount(() => {
|
|
222
|
-
delete Context.addonRecord[key];
|
|
296
|
+
delete Context.addonRecord[this.key];
|
|
223
297
|
});
|
|
224
298
|
}
|
|
225
299
|
if (this.guard) {
|
|
226
|
-
addGuard(key, this.guard.bind(this), this.guardPriority);
|
|
300
|
+
addGuard(this.key, this.guard.bind(this), this.guardPriority);
|
|
227
301
|
this.onUnmount(() => {
|
|
228
|
-
delete Context.guardRecord[key];
|
|
302
|
+
delete Context.guardRecord[this.key];
|
|
229
303
|
});
|
|
230
304
|
}
|
|
231
305
|
if (this.filter) {
|
|
232
|
-
addFilter(key, this.filter.bind(this));
|
|
306
|
+
addFilter(this.key, this.filter.bind(this));
|
|
233
307
|
this.onUnmount(() => {
|
|
234
|
-
delete Context.filterRecord[key];
|
|
308
|
+
delete Context.filterRecord[this.key];
|
|
235
309
|
});
|
|
236
310
|
}
|
|
237
311
|
}
|
|
238
312
|
};
|
|
313
|
+
_ts_decorate6([
|
|
314
|
+
Init5,
|
|
315
|
+
_ts_metadata6("design:type", Function),
|
|
316
|
+
_ts_metadata6("design:paramtypes", []),
|
|
317
|
+
_ts_metadata6("design:returntype", void 0)
|
|
318
|
+
], PExtension.prototype, "_init", null);
|
|
239
319
|
|
|
240
320
|
// src/generator/utils.ts
|
|
241
321
|
import fse from "fs-extra";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-server",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.2",
|
|
4
4
|
"description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
|
|
5
5
|
"author": "fgsreally",
|
|
6
6
|
"license": "MIT",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"fs-extra": "^11.3.2",
|
|
159
159
|
"picocolors": "^1.1.1",
|
|
160
160
|
"ts-mixer": "^6.0.4",
|
|
161
|
-
"phecda-core": "5.
|
|
161
|
+
"phecda-core": "5.2.1"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
164
|
"@koa/router": "^12.0.2",
|