koatty 3.11.2-8 → 3.11.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,21 @@
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.11.3](https://github.com/thinkkoa/koatty/compare/v3.11.2...v3.11.3) (2024-03-15)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * output迁移到exception库 ([e59428e](https://github.com/thinkkoa/koatty/commit/e59428e11687c0388089b82e80d6dece17fe7b07))
11
+
12
+ ### [3.11.2](https://github.com/thinkkoa/koatty/compare/v3.11.2-8...v3.11.2) (2024-02-02)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * 增加router配置 ([974a181](https://github.com/thinkkoa/koatty/commit/974a1812e3a65721623957ee2c3a907dcc203193))
18
+ * 自定义exception适配新版 ([b5822e2](https://github.com/thinkkoa/koatty/commit/b5822e2959f4ba70945e640a9c0c03f38660aca9))
19
+
5
20
  ### [3.11.2-8](https://github.com/thinkkoa/koatty/compare/v3.11.2-7...v3.11.2-8) (2024-01-16)
6
21
 
7
22
  ### [3.11.2-7](https://github.com/thinkkoa/koatty/compare/v3.11.2-6...v3.11.2-7) (2024-01-15)
package/README.md CHANGED
@@ -66,6 +66,7 @@ import { App } from "../App";
66
66
  @Controller()
67
67
  export class IndexController {
68
68
  app: App;
69
+ ctx: KoattyContext;
69
70
 
70
71
  @Autowired()
71
72
  private testService: TestService;
@@ -161,7 +162,7 @@ Select `TS Program` to debug run. Try to call `http://localhost:3000/` .
161
162
 
162
163
  Check out the [quick start example][quick-example].
163
164
 
164
- [quick-example]: https://github.com/thinkkoa/koatty_demo/
165
+ [quick-example]: https://github.com/Koatty/koatty_template
165
166
 
166
167
 
167
168
 
package/dist/README.md CHANGED
@@ -66,6 +66,7 @@ import { App } from "../App";
66
66
  @Controller()
67
67
  export class IndexController {
68
68
  app: App;
69
+ ctx: KoattyContext;
69
70
 
70
71
  @Autowired()
71
72
  private testService: TestService;
@@ -161,7 +162,7 @@ Select `TS Program` to debug run. Try to call `http://localhost:3000/` .
161
162
 
162
163
  Check out the [quick start example][quick-example].
163
164
 
164
- [quick-example]: https://github.com/thinkkoa/koatty_demo/
165
+ [quick-example]: https://github.com/Koatty/koatty_template
165
166
 
166
167
 
167
168
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-01-16 08:38:27
3
+ * @Date: 2024-03-15 10:55:35
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -17,24 +17,6 @@ import { Middleware as Middleware_2 } from 'koa';
17
17
  import { Next } from 'koa';
18
18
  import { Value } from 'koatty_config';
19
19
 
20
- /**
21
- * Interface for Api input
22
- */
23
- declare interface ApiInput {
24
- code?: number;
25
- message?: string;
26
- data?: any;
27
- }
28
-
29
- /**
30
- * Interface for Api output
31
- */
32
- declare interface ApiOutput {
33
- code: number;
34
- message: string;
35
- data: any;
36
- }
37
-
38
20
  /**
39
21
  * @description: bind App event hook func
40
22
  * example:
@@ -192,31 +174,6 @@ export declare const Logger: Logger_2;
192
174
  */
193
175
  export declare function Middleware(identifier?: string): ClassDecorator;
194
176
 
195
- export declare class Output {
196
- /**
197
- * Response to normalize json format content for success
198
- *
199
- * @param {KoattyContext} ctx
200
- * @param {(string | ApiInput)} msg 待处理的message消息
201
- * @param {*} [data] 待处理的数据
202
- * @param {number} [code=200] 错误码,默认0
203
- * @returns {*}
204
- * @memberof BaseController
205
- */
206
- static ok(ctx: KoattyContext, msg: string | ApiInput, data?: any, code?: number): Promise<ApiOutput>;
207
- /**
208
- * Response to normalize json format content for fail
209
- *
210
- * @param {KoattyContext} ctx
211
- * @param {(string | ApiInput)} msg
212
- * @param {*} [data]
213
- * @param {number} [code=1]
214
- * @returns {*}
215
- * @memberof BaseController
216
- */
217
- static fail(ctx: KoattyContext, msg: Error | string | ApiInput, data?: any, code?: number): void;
218
- }
219
-
220
177
  /**
221
178
  * Indicates that an decorated class is a "plugin".
222
179
  *
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-01-16 08:38:15
3
+ * @Date: 2024-03-15 10:55:22
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -142,7 +142,7 @@ function SetLogger(app, config) {
142
142
  * @Usage:
143
143
  * @Author: richen
144
144
  * @Date: 2023-12-09 21:56:32
145
- * @LastEditTime: 2024-01-16 01:17:46
145
+ * @LastEditTime: 2024-01-19 08:36:27
146
146
  * @License: BSD (3-Clause)
147
147
  * @Copyright (c): <richenlin(at)gmail.com>
148
148
  */
@@ -284,7 +284,7 @@ https://github.com/koatty
284
284
  * @Usage:
285
285
  * @Author: richen
286
286
  * @Date: 2023-12-09 22:55:49
287
- * @LastEditTime: 2024-01-04 05:52:31
287
+ * @LastEditTime: 2024-01-24 11:54:29
288
288
  * @License: BSD (3-Clause)
289
289
  * @Copyright (c): <richenlin(at)gmail.com>
290
290
  */
@@ -614,24 +614,6 @@ class Loader {
614
614
  }
615
615
  });
616
616
  }
617
- /**
618
- * Load components
619
- *
620
- * @static
621
- * @param {*} app
622
- * @memberof Loader
623
- */
624
- // public static LoadComponents(app: Koatty) {
625
- // const componentList = IOCContainer.listClass("COMPONENT");
626
- // componentList.forEach((item: ComponentItem) => {
627
- // item.id = (item.id ?? "").replace("COMPONENT:", "");
628
- // if (item.id && !(item.id).endsWith("Plugin") && Helper.isClass(item.target)) {
629
- // Logger.Debug(`Load component: ${item.id}`);
630
- // // registering to IOC
631
- // IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "COMPONENT", args: [] });
632
- // }
633
- // });
634
- // }
635
617
  /**
636
618
  * Load components
637
619
  *
@@ -687,7 +669,7 @@ class Loader {
687
669
  }
688
670
  }
689
671
 
690
- var version = "3.11.2-8";
672
+ var version = "3.11.3";
691
673
  var engines = {
692
674
  node: ">12.0.0"
693
675
  };
@@ -949,77 +931,6 @@ function BindEventHook(eventName, eventFunc, target) {
949
931
  koatty_container.IOCContainer.attachClassMetadata(koatty_container.TAGGED_CLS, eventName, eventFunc, target);
950
932
  }
951
933
 
952
- /*
953
- * @Description: output data
954
- * @Usage:
955
- * @Author: richen
956
- * @Date: 2024-01-03 22:03:34
957
- * @LastEditTime: 2024-01-16 01:20:36
958
- * @License: BSD (3-Clause)
959
- * @Copyright (c): <richenlin(at)gmail.com>
960
- */
961
- class Output {
962
- /**
963
- * Response to normalize json format content for success
964
- *
965
- * @param {KoattyContext} ctx
966
- * @param {(string | ApiInput)} msg 待处理的message消息
967
- * @param {*} [data] 待处理的数据
968
- * @param {number} [code=200] 错误码,默认0
969
- * @returns {*}
970
- * @memberof BaseController
971
- */
972
- static ok(ctx, msg, data, code = 0) {
973
- const obj = formatApiData(msg, data, code);
974
- return Promise.resolve(obj);
975
- }
976
- /**
977
- * Response to normalize json format content for fail
978
- *
979
- * @param {KoattyContext} ctx
980
- * @param {(string | ApiInput)} msg
981
- * @param {*} [data]
982
- * @param {number} [code=1]
983
- * @returns {*}
984
- * @memberof BaseController
985
- */
986
- static fail(ctx, msg, data, code = 1) {
987
- const obj = formatApiData(msg, data, code);
988
- ctx.body = obj.data;
989
- ctx.throw(obj.message, obj.code, 200);
990
- }
991
- }
992
- /**
993
- * Format api interface data format
994
- *
995
- * @private
996
- * @param {Error | string | ApiInput} msg 待处理的接口数据信息|接口msg
997
- * @param {*} data 待返回的数据
998
- * @param {number} defaultCode 默认错误码
999
- * @returns {ApiOutput} 格式化之后的接口数据
1000
- * @memberof BaseController
1001
- */
1002
- function formatApiData(msg, data, defaultCode) {
1003
- let obj = {
1004
- code: defaultCode,
1005
- message: '',
1006
- data: null,
1007
- };
1008
- if (koatty_lib.Helper.isError(msg)) {
1009
- const { code, message } = msg;
1010
- obj.code = code || defaultCode;
1011
- obj.message = message;
1012
- }
1013
- else if (koatty_lib.Helper.isObject(msg)) {
1014
- obj = { ...obj, ...msg };
1015
- }
1016
- else {
1017
- obj.message = msg;
1018
- obj.data = data;
1019
- }
1020
- return obj;
1021
- }
1022
-
1023
934
  Object.defineProperty(exports, 'Config', {
1024
935
  enumerable: true,
1025
936
  get: function () { return koatty_config.Config; }
@@ -1041,7 +952,6 @@ exports.Controller = Controller;
1041
952
  exports.ExecBootStrap = ExecBootStrap;
1042
953
  exports.Logger = Logger;
1043
954
  exports.Middleware = Middleware;
1044
- exports.Output = Output;
1045
955
  exports.Plugin = Plugin;
1046
956
  exports.Service = Service;
1047
957
  exports.implementsAspectInterface = implementsAspectInterface;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2024-01-16 08:38:15
3
+ * @Date: 2024-03-15 10:55:22
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -128,7 +128,7 @@ function SetLogger(app, config) {
128
128
  * @Usage:
129
129
  * @Author: richen
130
130
  * @Date: 2023-12-09 21:56:32
131
- * @LastEditTime: 2024-01-16 01:17:46
131
+ * @LastEditTime: 2024-01-19 08:36:27
132
132
  * @License: BSD (3-Clause)
133
133
  * @Copyright (c): <richenlin(at)gmail.com>
134
134
  */
@@ -270,7 +270,7 @@ https://github.com/koatty
270
270
  * @Usage:
271
271
  * @Author: richen
272
272
  * @Date: 2023-12-09 22:55:49
273
- * @LastEditTime: 2024-01-04 05:52:31
273
+ * @LastEditTime: 2024-01-24 11:54:29
274
274
  * @License: BSD (3-Clause)
275
275
  * @Copyright (c): <richenlin(at)gmail.com>
276
276
  */
@@ -600,24 +600,6 @@ class Loader {
600
600
  }
601
601
  });
602
602
  }
603
- /**
604
- * Load components
605
- *
606
- * @static
607
- * @param {*} app
608
- * @memberof Loader
609
- */
610
- // public static LoadComponents(app: Koatty) {
611
- // const componentList = IOCContainer.listClass("COMPONENT");
612
- // componentList.forEach((item: ComponentItem) => {
613
- // item.id = (item.id ?? "").replace("COMPONENT:", "");
614
- // if (item.id && !(item.id).endsWith("Plugin") && Helper.isClass(item.target)) {
615
- // Logger.Debug(`Load component: ${item.id}`);
616
- // // registering to IOC
617
- // IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "COMPONENT", args: [] });
618
- // }
619
- // });
620
- // }
621
603
  /**
622
604
  * Load components
623
605
  *
@@ -673,7 +655,7 @@ class Loader {
673
655
  }
674
656
  }
675
657
 
676
- var version = "3.11.2-8";
658
+ var version = "3.11.3";
677
659
  var engines = {
678
660
  node: ">12.0.0"
679
661
  };
@@ -935,75 +917,4 @@ function BindEventHook(eventName, eventFunc, target) {
935
917
  IOCContainer.attachClassMetadata(TAGGED_CLS, eventName, eventFunc, target);
936
918
  }
937
919
 
938
- /*
939
- * @Description: output data
940
- * @Usage:
941
- * @Author: richen
942
- * @Date: 2024-01-03 22:03:34
943
- * @LastEditTime: 2024-01-16 01:20:36
944
- * @License: BSD (3-Clause)
945
- * @Copyright (c): <richenlin(at)gmail.com>
946
- */
947
- class Output {
948
- /**
949
- * Response to normalize json format content for success
950
- *
951
- * @param {KoattyContext} ctx
952
- * @param {(string | ApiInput)} msg 待处理的message消息
953
- * @param {*} [data] 待处理的数据
954
- * @param {number} [code=200] 错误码,默认0
955
- * @returns {*}
956
- * @memberof BaseController
957
- */
958
- static ok(ctx, msg, data, code = 0) {
959
- const obj = formatApiData(msg, data, code);
960
- return Promise.resolve(obj);
961
- }
962
- /**
963
- * Response to normalize json format content for fail
964
- *
965
- * @param {KoattyContext} ctx
966
- * @param {(string | ApiInput)} msg
967
- * @param {*} [data]
968
- * @param {number} [code=1]
969
- * @returns {*}
970
- * @memberof BaseController
971
- */
972
- static fail(ctx, msg, data, code = 1) {
973
- const obj = formatApiData(msg, data, code);
974
- ctx.body = obj.data;
975
- ctx.throw(obj.message, obj.code, 200);
976
- }
977
- }
978
- /**
979
- * Format api interface data format
980
- *
981
- * @private
982
- * @param {Error | string | ApiInput} msg 待处理的接口数据信息|接口msg
983
- * @param {*} data 待返回的数据
984
- * @param {number} defaultCode 默认错误码
985
- * @returns {ApiOutput} 格式化之后的接口数据
986
- * @memberof BaseController
987
- */
988
- function formatApiData(msg, data, defaultCode) {
989
- let obj = {
990
- code: defaultCode,
991
- message: '',
992
- data: null,
993
- };
994
- if (Helper.isError(msg)) {
995
- const { code, message } = msg;
996
- obj.code = code || defaultCode;
997
- obj.message = message;
998
- }
999
- else if (Helper.isObject(msg)) {
1000
- obj = { ...obj, ...msg };
1001
- }
1002
- else {
1003
- obj.message = msg;
1004
- obj.data = data;
1005
- }
1006
- return obj;
1007
- }
1008
-
1009
- export { BindEventHook, Bootstrap, Component, ComponentScan, ConfigurationScan, Controller, ExecBootStrap, Logger, Middleware, Output, Plugin, Service, implementsAspectInterface, implementsControllerInterface, implementsMiddlewareInterface, implementsPluginInterface, implementsServiceInterface };
920
+ export { BindEventHook, Bootstrap, Component, ComponentScan, ConfigurationScan, Controller, ExecBootStrap, Logger, Middleware, Plugin, Service, implementsAspectInterface, implementsControllerInterface, implementsMiddlewareInterface, implementsPluginInterface, implementsServiceInterface };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.11.2-8",
3
+ "version": "3.11.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",
@@ -86,14 +86,14 @@
86
86
  "koatty_config": "~1.1.6",
87
87
  "koatty_container": "~1.8.10",
88
88
  "koatty_core": "~1.9.0",
89
- "koatty_exception": "~1.2.8",
89
+ "koatty_exception": "~1.4.2",
90
90
  "koatty_lib": "~1.3.4",
91
91
  "koatty_loader": "~1.1.0",
92
92
  "koatty_logger": "~2.1.4",
93
93
  "koatty_proto": "~1.1.12",
94
- "koatty_router": "~1.9.0",
94
+ "koatty_router": "~1.9.1",
95
95
  "koatty_serve": "~2.1.2",
96
- "koatty_trace": "~1.11.2",
96
+ "koatty_trace": "~1.12.3",
97
97
  "koatty_validation": "~1.3.2"
98
98
  }
99
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.11.2-8",
3
+ "version": "3.11.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",
@@ -86,14 +86,14 @@
86
86
  "koatty_config": "~1.1.6",
87
87
  "koatty_container": "~1.8.10",
88
88
  "koatty_core": "~1.9.0",
89
- "koatty_exception": "~1.2.8",
89
+ "koatty_exception": "~1.4.2",
90
90
  "koatty_lib": "~1.3.4",
91
91
  "koatty_loader": "~1.1.0",
92
92
  "koatty_logger": "~2.1.4",
93
93
  "koatty_proto": "~1.1.12",
94
- "koatty_router": "~1.9.0",
94
+ "koatty_router": "~1.9.1",
95
95
  "koatty_serve": "~2.1.2",
96
- "koatty_trace": "~1.11.2",
96
+ "koatty_trace": "~1.12.3",
97
97
  "koatty_validation": "~1.3.2"
98
98
  }
99
99
  }