koatty 3.10.4-2 → 3.10.4-3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.10.4-3](https://github.com/thinkkoa/koatty/compare/v3.10.4-2...v3.10.4-3) (2023-12-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * async tracer ([098bf04](https://github.com/thinkkoa/koatty/commit/098bf040dc44cb1294cf3726acab65a2856f0548))
11
+ * 集成tracer ([7f1ed23](https://github.com/thinkkoa/koatty/commit/7f1ed232e4aa1224132ce74d6a6f4b92aa884973))
12
+
5
13
  ### [3.10.4-2](https://github.com/thinkkoa/koatty/compare/v3.10.4-1...v3.10.4-2) (2023-12-14)
6
14
 
7
15
  ### [3.10.4-1](https://github.com/thinkkoa/koatty/compare/v3.10.4-0...v3.10.4-1) (2023-12-10)
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-12-15 00:19:05
3
+ * @Date: 2023-12-16 14:47:58
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-12-15 00:18:46
3
+ * @Date: 2023-12-16 14:47:37
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -256,7 +256,7 @@ class BaseController {
256
256
  // }
257
257
  // });
258
258
 
259
- function TraceHandler(app) {
259
+ async function TraceHandler(app) {
260
260
  const timeout = (app.config('http_timeout') || 10) * 1000;
261
261
  const encoding = app.config('encoding') || 'utf-8';
262
262
  const openTrace = app.config("open_trace") || false;
@@ -264,13 +264,13 @@ function TraceHandler(app) {
264
264
  const options = {
265
265
  RequestIdHeaderName: app.config('trace_header') || 'X-Request-Id',
266
266
  RequestIdName: app.config('trace_id') || "requestId",
267
- IdFactory: undefined,
267
+ // IdFactory: undefined,
268
268
  Timeout: timeout,
269
269
  Encoding: encoding,
270
270
  OpenTrace: openTrace,
271
271
  AsyncHooks: asyncHooks,
272
272
  };
273
- app.use(koatty_trace.Trace(options, app));
273
+ app.use(await koatty_trace.Trace(options, app));
274
274
  }
275
275
 
276
276
  /*
@@ -278,7 +278,7 @@ function TraceHandler(app) {
278
278
  * @Usage:
279
279
  * @Author: richen
280
280
  * @Date: 2023-12-09 22:55:49
281
- * @LastEditTime: 2023-12-14 23:10:33
281
+ * @LastEditTime: 2023-12-16 14:46:25
282
282
  * @License: BSD (3-Clause)
283
283
  * @Copyright (c): <richenlin(at)gmail.com>
284
284
  */
@@ -508,8 +508,8 @@ class Loader {
508
508
  * @memberof Loader
509
509
  */
510
510
  static async LoadMiddlewares(app, loadPath) {
511
- // Error handling middleware
512
- TraceHandler(app);
511
+ // Error tracing middleware
512
+ await TraceHandler(app);
513
513
  let middlewareConf = app.config(undefined, "middleware");
514
514
  if (koatty_lib.Helper.isEmpty(middlewareConf)) {
515
515
  middlewareConf = { config: {}, list: [] };
@@ -535,12 +535,10 @@ class Loader {
535
535
  for (const key of appMList) {
536
536
  const handle = koatty_container.IOCContainer.get(key, "MIDDLEWARE");
537
537
  if (!handle) {
538
- Logger.Error(`Middleware ${key} load error.`);
539
- continue;
538
+ throw Error(`Middleware ${key} load error.`);
540
539
  }
541
540
  if (!koatty_lib.Helper.isFunction(handle.run)) {
542
- Logger.Error(`The middleware ${key} must implements interface 'IMiddleware'.`);
543
- continue;
541
+ throw Error(`The middleware ${key} must implements interface 'IMiddleware'.`);
544
542
  }
545
543
  if (middlewareConf.config[key] === false) {
546
544
  Logger.Warn(`The middleware ${key} has been loaded but not executed.`);
@@ -576,7 +574,7 @@ class Loader {
576
574
  koatty_container.IOCContainer.reg(item.id, item.target, { scope: "Prototype", type: "CONTROLLER", args: [] });
577
575
  const ctl = koatty_container.IOCContainer.getInsByClass(item.target);
578
576
  if (!(ctl instanceof BaseController)) {
579
- throw new Error(`class ${item.id} does not inherit from BaseController`);
577
+ throw Error(`Controller class ${item.id} does not inherit from BaseController`);
580
578
  }
581
579
  controllers.push(item.id);
582
580
  }
@@ -649,12 +647,10 @@ class Loader {
649
647
  for (const key of pluginConfList) {
650
648
  const handle = koatty_container.IOCContainer.get(key, "COMPONENT");
651
649
  if (!handle) {
652
- Logger.Error(`Plugin ${key} load error.`);
653
- continue;
650
+ throw Error(`Plugin ${key} load error.`);
654
651
  }
655
652
  if (!koatty_lib.Helper.isFunction(handle.run)) {
656
- Logger.Error(`Plugin ${key} must be implements method 'run'.`);
657
- continue;
653
+ throw Error(`Plugin ${key} must implements interface 'IPlugin'.`);
658
654
  }
659
655
  if (pluginsConf.config[key] === false) {
660
656
  Logger.Warn(`Plugin ${key} already loaded but not effective.`);
@@ -666,7 +662,7 @@ class Loader {
666
662
  }
667
663
  }
668
664
 
669
- var version = "3.10.4-2";
665
+ var version = "3.10.4-3";
670
666
  var engines = {
671
667
  node: ">12.0.0"
672
668
  };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-12-15 00:18:46
3
+ * @Date: 2023-12-16 14:47:37
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -242,7 +242,7 @@ class BaseController {
242
242
  // }
243
243
  // });
244
244
 
245
- function TraceHandler(app) {
245
+ async function TraceHandler(app) {
246
246
  const timeout = (app.config('http_timeout') || 10) * 1000;
247
247
  const encoding = app.config('encoding') || 'utf-8';
248
248
  const openTrace = app.config("open_trace") || false;
@@ -250,13 +250,13 @@ function TraceHandler(app) {
250
250
  const options = {
251
251
  RequestIdHeaderName: app.config('trace_header') || 'X-Request-Id',
252
252
  RequestIdName: app.config('trace_id') || "requestId",
253
- IdFactory: undefined,
253
+ // IdFactory: undefined,
254
254
  Timeout: timeout,
255
255
  Encoding: encoding,
256
256
  OpenTrace: openTrace,
257
257
  AsyncHooks: asyncHooks,
258
258
  };
259
- app.use(Trace(options, app));
259
+ app.use(await Trace(options, app));
260
260
  }
261
261
 
262
262
  /*
@@ -264,7 +264,7 @@ function TraceHandler(app) {
264
264
  * @Usage:
265
265
  * @Author: richen
266
266
  * @Date: 2023-12-09 22:55:49
267
- * @LastEditTime: 2023-12-14 23:10:33
267
+ * @LastEditTime: 2023-12-16 14:46:25
268
268
  * @License: BSD (3-Clause)
269
269
  * @Copyright (c): <richenlin(at)gmail.com>
270
270
  */
@@ -494,8 +494,8 @@ class Loader {
494
494
  * @memberof Loader
495
495
  */
496
496
  static async LoadMiddlewares(app, loadPath) {
497
- // Error handling middleware
498
- TraceHandler(app);
497
+ // Error tracing middleware
498
+ await TraceHandler(app);
499
499
  let middlewareConf = app.config(undefined, "middleware");
500
500
  if (Helper.isEmpty(middlewareConf)) {
501
501
  middlewareConf = { config: {}, list: [] };
@@ -521,12 +521,10 @@ class Loader {
521
521
  for (const key of appMList) {
522
522
  const handle = IOCContainer.get(key, "MIDDLEWARE");
523
523
  if (!handle) {
524
- Logger.Error(`Middleware ${key} load error.`);
525
- continue;
524
+ throw Error(`Middleware ${key} load error.`);
526
525
  }
527
526
  if (!Helper.isFunction(handle.run)) {
528
- Logger.Error(`The middleware ${key} must implements interface 'IMiddleware'.`);
529
- continue;
527
+ throw Error(`The middleware ${key} must implements interface 'IMiddleware'.`);
530
528
  }
531
529
  if (middlewareConf.config[key] === false) {
532
530
  Logger.Warn(`The middleware ${key} has been loaded but not executed.`);
@@ -562,7 +560,7 @@ class Loader {
562
560
  IOCContainer.reg(item.id, item.target, { scope: "Prototype", type: "CONTROLLER", args: [] });
563
561
  const ctl = IOCContainer.getInsByClass(item.target);
564
562
  if (!(ctl instanceof BaseController)) {
565
- throw new Error(`class ${item.id} does not inherit from BaseController`);
563
+ throw Error(`Controller class ${item.id} does not inherit from BaseController`);
566
564
  }
567
565
  controllers.push(item.id);
568
566
  }
@@ -635,12 +633,10 @@ class Loader {
635
633
  for (const key of pluginConfList) {
636
634
  const handle = IOCContainer.get(key, "COMPONENT");
637
635
  if (!handle) {
638
- Logger.Error(`Plugin ${key} load error.`);
639
- continue;
636
+ throw Error(`Plugin ${key} load error.`);
640
637
  }
641
638
  if (!Helper.isFunction(handle.run)) {
642
- Logger.Error(`Plugin ${key} must be implements method 'run'.`);
643
- continue;
639
+ throw Error(`Plugin ${key} must implements interface 'IPlugin'.`);
644
640
  }
645
641
  if (pluginsConf.config[key] === false) {
646
642
  Logger.Warn(`Plugin ${key} already loaded but not effective.`);
@@ -652,7 +648,7 @@ class Loader {
652
648
  }
653
649
  }
654
650
 
655
- var version = "3.10.4-2";
651
+ var version = "3.10.4-3";
656
652
  var engines = {
657
653
  node: ">12.0.0"
658
654
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.10.4-2",
3
+ "version": "3.10.4-3",
4
4
  "description": "Koa2 + Typescript = koatty. Use Typescript's decorator implement auto injection.",
5
5
  "scripts": {
6
6
  "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
@@ -93,6 +93,6 @@
93
93
  "koatty_proto": "^1.1.12",
94
94
  "koatty_serve": "2.1.0",
95
95
  "koatty_trace": "^1.10.4",
96
- "koatty_validation": "^1.2.9"
96
+ "koatty_validation": "^1.2.10"
97
97
  }
98
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.10.4-2",
3
+ "version": "3.10.4-3",
4
4
  "description": "Koa2 + Typescript = koatty. Use Typescript's decorator implement auto injection.",
5
5
  "scripts": {
6
6
  "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
@@ -93,6 +93,6 @@
93
93
  "koatty_proto": "^1.1.12",
94
94
  "koatty_serve": "2.1.0",
95
95
  "koatty_trace": "^1.10.4",
96
- "koatty_validation": "^1.2.9"
96
+ "koatty_validation": "^1.2.10"
97
97
  }
98
98
  }