phecda-server 8.5.0 → 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/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
- constructor(tag?: string);
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
- constructor(tag?: string);
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
- constructor(tag?: string);
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
- constructor(tag?: string);
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
- constructor(tag?: string);
354
+ protected init(): Promise<void>;
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
- constructor(tag?: string);
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
- constructor(tag?: string);
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
- constructor(tag?: string);
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
- constructor(tag?: string);
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
- constructor(tag?: string);
354
+ protected init(): Promise<void>;
355
355
  }
356
356
 
357
357
  declare const defaultFilter: FilterType;
package/dist/index.js CHANGED
@@ -135,9 +135,9 @@ var PFilter = class extends ServerBase {
135
135
  _chunkLLF55NZPjs.__name.call(void 0, this, "PFilter");
136
136
  }
137
137
 
138
- constructor(tag) {
139
- super();
140
- this.key = tag || _phecdacore.getTag.call(void 0, this);
138
+ async init() {
139
+ await super.init();
140
+ this.key = _phecdacore.getTag.call(void 0, this);
141
141
  _chunk76UDKZOJjs.addFilter.call(void 0, this.key, this.use.bind(this));
142
142
  this.onUnmount(() => {
143
143
  delete _chunk76UDKZOJjs.Context.filterRecord[this.key];
@@ -147,15 +147,15 @@ var PFilter = class extends ServerBase {
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
- constructor(tag) {
157
- super();_class2.prototype.__init2.call(this);;
158
- this.key = tag || _phecdacore.getTag.call(void 0, this);
156
+ async init() {
157
+ await super.init();
158
+ this.key = _phecdacore.getTag.call(void 0, this);
159
159
  _chunk76UDKZOJjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
160
160
  this.onUnmount(() => {
161
161
  delete _chunk76UDKZOJjs.Context.guardRecord[this.key];
@@ -170,9 +170,9 @@ var PPipe = class extends ServerBase {
170
170
  _chunkLLF55NZPjs.__name.call(void 0, this, "PPipe");
171
171
  }
172
172
 
173
- constructor(tag) {
174
- super();
175
- this.key = tag || _phecdacore.getTag.call(void 0, this);
173
+ async init() {
174
+ await super.init();
175
+ this.key = _phecdacore.getTag.call(void 0, this);
176
176
  _chunk76UDKZOJjs.addPipe.call(void 0, this.key, this.use.bind(this));
177
177
  this.onUnmount(() => {
178
178
  delete _chunk76UDKZOJjs.Context.pipeRecord[this.key];
@@ -182,15 +182,15 @@ var PPipe = class extends ServerBase {
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
- constructor(tag) {
192
- super();_class3.prototype.__init3.call(this);;
193
- this.key = tag || _phecdacore.getTag.call(void 0, this);
191
+ async init() {
192
+ await super.init();
193
+ this.key = _phecdacore.getTag.call(void 0, this);
194
194
  _chunk76UDKZOJjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
195
195
  this.onUnmount(() => {
196
196
  delete _chunk76UDKZOJjs.Context.addonRecord[this.key];
@@ -207,31 +207,31 @@ var PExtension = class extends ServerBase {
207
207
 
208
208
 
209
209
 
210
- constructor(tag) {
211
- super();
212
- const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
210
+ async init() {
211
+ await super.init();
212
+ this.key = _phecdacore.getTag.call(void 0, this);
213
213
  if (this.pipe) {
214
- _chunk76UDKZOJjs.addPipe.call(void 0, key, this.pipe.bind(this));
214
+ _chunk76UDKZOJjs.addPipe.call(void 0, this.key, this.pipe.bind(this));
215
215
  this.onUnmount(() => {
216
- delete _chunk76UDKZOJjs.Context.pipeRecord[key];
216
+ delete _chunk76UDKZOJjs.Context.pipeRecord[this.key];
217
217
  });
218
218
  }
219
219
  if (this.addon) {
220
- _chunk76UDKZOJjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
220
+ _chunk76UDKZOJjs.addAddon.call(void 0, this.key, this.addon.bind(this), this.addonPriority);
221
221
  this.onUnmount(() => {
222
- delete _chunk76UDKZOJjs.Context.addonRecord[key];
222
+ delete _chunk76UDKZOJjs.Context.addonRecord[this.key];
223
223
  });
224
224
  }
225
225
  if (this.guard) {
226
- _chunk76UDKZOJjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
226
+ _chunk76UDKZOJjs.addGuard.call(void 0, this.key, this.guard.bind(this), this.guardPriority);
227
227
  this.onUnmount(() => {
228
- delete _chunk76UDKZOJjs.Context.guardRecord[key];
228
+ delete _chunk76UDKZOJjs.Context.guardRecord[this.key];
229
229
  });
230
230
  }
231
231
  if (this.filter) {
232
- _chunk76UDKZOJjs.addFilter.call(void 0, key, this.filter.bind(this));
232
+ _chunk76UDKZOJjs.addFilter.call(void 0, this.key, this.filter.bind(this));
233
233
  this.onUnmount(() => {
234
- delete _chunk76UDKZOJjs.Context.filterRecord[key];
234
+ delete _chunk76UDKZOJjs.Context.filterRecord[this.key];
235
235
  });
236
236
  }
237
237
  }
@@ -257,7 +257,7 @@ var Generator = (_class4 = class {
257
257
  }, _class4);
258
258
 
259
259
  // src/generator/rpc.ts
260
- var RPCGenerator = (_class5 = class extends Generator {constructor(...args3) { super(...args3); _class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this); }
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
  }
@@ -293,7 +293,7 @@ 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(...args4) { super(...args4); _class6.prototype.__init7.call(this);_class6.prototype.__init8.call(this); }
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
  }
@@ -336,7 +336,7 @@ return ret
336
336
 
337
337
  // src/generator/openapi.ts
338
338
 
339
- var OpenAPIGenerator = (_class7 = class extends Generator {constructor(...args5) { super(...args5); _class7.prototype.__init9.call(this);_class7.prototype.__init10.call(this);_class7.prototype.__init11.call(this); }
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
  }
@@ -418,7 +418,7 @@ var DocGenerator = (_class8 = class extends Generator {
418
418
 
419
419
  // src/generator/graph.ts
420
420
 
421
- var GraphGenerator = (_class9 = class extends Generator {constructor(...args6) { super(...args6); _class9.prototype.__init14.call(this);_class9.prototype.__init15.call(this); }
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
  }
package/dist/index.mjs CHANGED
@@ -135,9 +135,9 @@ var PFilter = class extends ServerBase {
135
135
  __name(this, "PFilter");
136
136
  }
137
137
  key;
138
- constructor(tag) {
139
- super();
140
- this.key = tag || getTag(this);
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
- constructor(tag) {
157
- super();
158
- this.key = tag || getTag2(this);
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
- constructor(tag) {
174
- super();
175
- this.key = tag || getTag3(this);
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
- constructor(tag) {
192
- super();
193
- this.key = tag || getTag4(this);
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
- constructor(tag) {
211
- super();
212
- const key = this.key = tag || getTag5(this);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-server",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
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.1.1"
161
+ "phecda-core": "5.2.0"
162
162
  },
163
163
  "devDependencies": {
164
164
  "@koa/router": "^12.0.2",