koatty 3.10.3 → 3.10.4-0

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,13 @@
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-0](https://github.com/thinkkoa/koatty/compare/v3.10.3...v3.10.4-0) (2023-12-09)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * 合并payload ([6d98ffb](https://github.com/thinkkoa/koatty/commit/6d98ffb94ba313b16ac4438bace3eb84680c42f2))
11
+
5
12
  ### [3.10.3](https://github.com/thinkkoa/koatty/compare/v3.10.3-0...v3.10.3) (2023-12-06)
6
13
 
7
14
  ### [3.10.3-0](https://github.com/thinkkoa/koatty/compare/v3.10.2...v3.10.3-0) (2023-12-06)
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-12-07 00:36:06
3
+ * @Date: 2023-12-09 23:43:01
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-07 00:35:50
3
+ * @Date: 2023-12-09 23:42:54
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -17,7 +17,6 @@ var koatty_logger = require('koatty_logger');
17
17
  var koatty_exception = require('koatty_exception');
18
18
  var koatty_container = require('koatty_container');
19
19
  var koatty_trace = require('koatty_trace');
20
- var koatty_payload = require('koatty_payload');
21
20
  var koatty_serve = require('koatty_serve');
22
21
 
23
22
  function _interopNamespaceDefault(e) {
@@ -39,11 +38,14 @@ function _interopNamespaceDefault(e) {
39
38
 
40
39
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
41
40
 
42
- /**
43
- * @ author: richen
44
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
45
- * @ license: BSD (3-Clause)
46
- * @ version: 2020-05-10 11:49:15
41
+ /*
42
+ * @Description: framework logger
43
+ * @Usage:
44
+ * @Author: richen
45
+ * @Date: 2023-12-09 21:56:32
46
+ * @LastEditTime: 2023-12-09 23:02:27
47
+ * @License: BSD (3-Clause)
48
+ * @Copyright (c): <richenlin(at)gmail.com>
47
49
  */
48
50
  // Logger
49
51
  const Logger = koatty_logger.DefaultLogger;
@@ -71,11 +73,14 @@ function SetLogger(app, config) {
71
73
  }
72
74
  }
73
75
 
74
- /**
75
- * @ author: richen
76
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
77
- * @ license: BSD (3-Clause)
78
- * @ version: 2020-05-10 11:49:15
76
+ /*
77
+ * @Description: framework helper
78
+ * @Usage:
79
+ * @Author: richen
80
+ * @Date: 2023-12-09 21:56:32
81
+ * @LastEditTime: 2023-12-09 23:01:56
82
+ * @License: BSD (3-Clause)
83
+ * @Copyright (c): <richenlin(at)gmail.com>
79
84
  */
80
85
  /**
81
86
  * Check class file
@@ -144,11 +149,14 @@ function formatApiData(msg, data, defaultCode) {
144
149
  return obj;
145
150
  }
146
151
 
147
- /**
148
- * @ author: richen
149
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
150
- * @ license: BSD (3-Clause)
151
- * @ version: 2020-05-10 11:49:15
152
+ /*
153
+ * @Description: framework constants
154
+ * @Usage:
155
+ * @Author: richen
156
+ * @Date: 2023-12-09 21:56:32
157
+ * @LastEditTime: 2023-12-09 23:00:13
158
+ * @License: BSD (3-Clause)
159
+ * @Copyright (c): <richenlin(at)gmail.com>
152
160
  */
153
161
  const COMPONENT_SCAN = 'COMPONENT_SCAN';
154
162
  const CONFIGURATION_SCAN = 'CONFIGURATION_SCAN';
@@ -162,6 +170,15 @@ const LOGO = `
162
170
  https://github.com/koatty
163
171
  `;
164
172
 
173
+ /*
174
+ * @Description: base controller
175
+ * @Usage:
176
+ * @Author: richen
177
+ * @Date: 2023-12-09 21:56:32
178
+ * @LastEditTime: 2023-12-09 23:03:09
179
+ * @License: BSD (3-Clause)
180
+ * @Copyright (c): <richenlin(at)gmail.com>
181
+ */
165
182
  /**
166
183
  * Base controller
167
184
  *
@@ -239,23 +256,29 @@ class BaseController {
239
256
  // }
240
257
  // });
241
258
 
259
+ /*
260
+ * @Description: trace & catcher middleware
261
+ * @Usage:
262
+ * @Author: richen
263
+ * @Date: 2023-12-09 22:55:54
264
+ * @LastEditTime: 2023-12-09 23:00:44
265
+ * @License: BSD (3-Clause)
266
+ * @Copyright (c): <richenlin(at)gmail.com>
267
+ */
242
268
  class TraceMiddleware {
243
269
  run(options, app) {
244
270
  return koatty_trace.Trace(options, app);
245
271
  }
246
272
  }
247
273
 
248
- class PayloadMiddleware {
249
- run(options, app) {
250
- return koatty_payload.Payload(options, app);
251
- }
252
- }
253
-
254
- /**
255
- * @ author: richen
256
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
257
- * @ license: BSD (3-Clause)
258
- * @ version: 2020-07-06 11:18:01
274
+ /*
275
+ * @Description: framework loader
276
+ * @Usage:
277
+ * @Author: richen
278
+ * @Date: 2023-12-09 22:55:49
279
+ * @LastEditTime: 2023-12-09 23:00:37
280
+ * @License: BSD (3-Clause)
281
+ * @Copyright (c): <richenlin(at)gmail.com>
259
282
  */
260
283
  /**
261
284
  *
@@ -493,7 +516,6 @@ class Loader {
493
516
  // const middleware: any = {};
494
517
  const appMiddleware = koatty_container.IOCContainer.listClass("MIDDLEWARE") ?? [];
495
518
  appMiddleware.push({ id: "TraceMiddleware", target: TraceMiddleware });
496
- appMiddleware.push({ id: "PayloadMiddleware", target: PayloadMiddleware });
497
519
  appMiddleware.forEach((item) => {
498
520
  item.id = (item.id ?? "").replace("MIDDLEWARE:", "");
499
521
  if (item.id && koatty_lib.Helper.isClass(item.target)) {
@@ -501,13 +523,11 @@ class Loader {
501
523
  }
502
524
  });
503
525
  const middlewareConfList = middlewareConf.list;
504
- const defaultList = ["TraceMiddleware", "PayloadMiddleware"];
526
+ const defaultList = ["TraceMiddleware"];
505
527
  //de-duplication
506
528
  const appMList = new Set(defaultList);
507
529
  middlewareConfList.forEach((item) => {
508
- if (!defaultList.includes(item)) {
509
- appMList.add(item);
510
- }
530
+ appMList.add(item);
511
531
  });
512
532
  //Automatically call middleware
513
533
  for (const key of appMList) {
@@ -650,16 +670,19 @@ class Loader {
650
670
  }
651
671
  }
652
672
 
653
- var version = "3.10.3";
673
+ var version = "3.10.4-0";
654
674
  var engines = {
655
675
  node: ">12.0.0"
656
676
  };
657
677
 
658
- /**
659
- * @ author: richen
660
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
661
- * @ license: BSD (3-Clause)
662
- * @ version: 2020-05-10 11:49:15
678
+ /*
679
+ * @Description: framework runtime checker
680
+ * @Usage:
681
+ * @Author: richen
682
+ * @Date: 2023-12-09 21:56:32
683
+ * @LastEditTime: 2023-12-09 23:01:22
684
+ * @License: BSD (3-Clause)
685
+ * @Copyright (c): <richenlin(at)gmail.com>
663
686
  */
664
687
  const KOATTY_VERSION = version;
665
688
  const ENGINES_VERSION = engines.node.slice(1) || '12.0.0';
@@ -695,11 +718,14 @@ const checkUTRuntime = () => {
695
718
  return isUTRuntime;
696
719
  };
697
720
 
698
- /**
699
- * @ author: richen
700
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
701
- * @ license: BSD (3-Clause)
702
- * @ version: 2020-07-06 11:22:58
721
+ /*
722
+ * @Description: framework bootstrap
723
+ * @Usage:
724
+ * @Author: richen
725
+ * @Date: 2023-12-09 21:56:32
726
+ * @LastEditTime: 2023-12-09 22:59:19
727
+ * @License: BSD (3-Clause)
728
+ * @Copyright (c): <richenlin(at)gmail.com>
703
729
  */
704
730
  /**
705
731
  * execute bootstrap
@@ -906,11 +932,14 @@ function BindEventHook(eventName, eventFunc, target) {
906
932
  koatty_container.IOCContainer.attachClassMetadata(koatty_container.TAGGED_CLS, eventName, eventFunc, target);
907
933
  }
908
934
 
909
- /**
910
- * @ author: richen
911
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
912
- * @ license: BSD (3-Clause)
913
- * @ version: 2020-05-10 11:32:45
935
+ /*
936
+ * @Description: component interface
937
+ * @Usage:
938
+ * @Author: richen
939
+ * @Date: 2023-12-09 21:56:32
940
+ * @LastEditTime: 2023-12-09 23:03:33
941
+ * @License: BSD (3-Clause)
942
+ * @Copyright (c): <richenlin(at)gmail.com>
914
943
  */
915
944
  /**
916
945
  * Indicates that an decorated class is a "component".
@@ -983,6 +1012,15 @@ function Plugin(identifier) {
983
1012
  };
984
1013
  }
985
1014
 
1015
+ /*
1016
+ * @Description: base service
1017
+ * @Usage:
1018
+ * @Author: richen
1019
+ * @Date: 2023-12-09 21:56:32
1020
+ * @LastEditTime: 2023-12-09 23:03:23
1021
+ * @License: BSD (3-Clause)
1022
+ * @Copyright (c): <richenlin(at)gmail.com>
1023
+ */
986
1024
  /**
987
1025
  * Base service
988
1026
  *
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-12-07 00:35:50
3
+ * @Date: 2023-12-09 23:42:54
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -21,15 +21,17 @@ import { IOCContainer, TAGGED_CLS } from 'koatty_container';
21
21
  export * from 'koatty_container';
22
22
  import { Trace } from 'koatty_trace';
23
23
  export * from 'koatty_trace';
24
- import { Payload } from 'koatty_payload';
25
24
  import { NewServe, NewRouter, BindProcessEvent, CONTROLLER_ROUTER } from 'koatty_serve';
26
25
  export * from 'koatty_serve';
27
26
 
28
- /**
29
- * @ author: richen
30
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
31
- * @ license: BSD (3-Clause)
32
- * @ version: 2020-05-10 11:49:15
27
+ /*
28
+ * @Description: framework logger
29
+ * @Usage:
30
+ * @Author: richen
31
+ * @Date: 2023-12-09 21:56:32
32
+ * @LastEditTime: 2023-12-09 23:02:27
33
+ * @License: BSD (3-Clause)
34
+ * @Copyright (c): <richenlin(at)gmail.com>
33
35
  */
34
36
  // Logger
35
37
  const Logger = DefaultLogger;
@@ -57,11 +59,14 @@ function SetLogger(app, config) {
57
59
  }
58
60
  }
59
61
 
60
- /**
61
- * @ author: richen
62
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
63
- * @ license: BSD (3-Clause)
64
- * @ version: 2020-05-10 11:49:15
62
+ /*
63
+ * @Description: framework helper
64
+ * @Usage:
65
+ * @Author: richen
66
+ * @Date: 2023-12-09 21:56:32
67
+ * @LastEditTime: 2023-12-09 23:01:56
68
+ * @License: BSD (3-Clause)
69
+ * @Copyright (c): <richenlin(at)gmail.com>
65
70
  */
66
71
  /**
67
72
  * Check class file
@@ -130,11 +135,14 @@ function formatApiData(msg, data, defaultCode) {
130
135
  return obj;
131
136
  }
132
137
 
133
- /**
134
- * @ author: richen
135
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
136
- * @ license: BSD (3-Clause)
137
- * @ version: 2020-05-10 11:49:15
138
+ /*
139
+ * @Description: framework constants
140
+ * @Usage:
141
+ * @Author: richen
142
+ * @Date: 2023-12-09 21:56:32
143
+ * @LastEditTime: 2023-12-09 23:00:13
144
+ * @License: BSD (3-Clause)
145
+ * @Copyright (c): <richenlin(at)gmail.com>
138
146
  */
139
147
  const COMPONENT_SCAN = 'COMPONENT_SCAN';
140
148
  const CONFIGURATION_SCAN = 'CONFIGURATION_SCAN';
@@ -148,6 +156,15 @@ const LOGO = `
148
156
  https://github.com/koatty
149
157
  `;
150
158
 
159
+ /*
160
+ * @Description: base controller
161
+ * @Usage:
162
+ * @Author: richen
163
+ * @Date: 2023-12-09 21:56:32
164
+ * @LastEditTime: 2023-12-09 23:03:09
165
+ * @License: BSD (3-Clause)
166
+ * @Copyright (c): <richenlin(at)gmail.com>
167
+ */
151
168
  /**
152
169
  * Base controller
153
170
  *
@@ -225,23 +242,29 @@ class BaseController {
225
242
  // }
226
243
  // });
227
244
 
245
+ /*
246
+ * @Description: trace & catcher middleware
247
+ * @Usage:
248
+ * @Author: richen
249
+ * @Date: 2023-12-09 22:55:54
250
+ * @LastEditTime: 2023-12-09 23:00:44
251
+ * @License: BSD (3-Clause)
252
+ * @Copyright (c): <richenlin(at)gmail.com>
253
+ */
228
254
  class TraceMiddleware {
229
255
  run(options, app) {
230
256
  return Trace(options, app);
231
257
  }
232
258
  }
233
259
 
234
- class PayloadMiddleware {
235
- run(options, app) {
236
- return Payload(options, app);
237
- }
238
- }
239
-
240
- /**
241
- * @ author: richen
242
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
243
- * @ license: BSD (3-Clause)
244
- * @ version: 2020-07-06 11:18:01
260
+ /*
261
+ * @Description: framework loader
262
+ * @Usage:
263
+ * @Author: richen
264
+ * @Date: 2023-12-09 22:55:49
265
+ * @LastEditTime: 2023-12-09 23:00:37
266
+ * @License: BSD (3-Clause)
267
+ * @Copyright (c): <richenlin(at)gmail.com>
245
268
  */
246
269
  /**
247
270
  *
@@ -479,7 +502,6 @@ class Loader {
479
502
  // const middleware: any = {};
480
503
  const appMiddleware = IOCContainer.listClass("MIDDLEWARE") ?? [];
481
504
  appMiddleware.push({ id: "TraceMiddleware", target: TraceMiddleware });
482
- appMiddleware.push({ id: "PayloadMiddleware", target: PayloadMiddleware });
483
505
  appMiddleware.forEach((item) => {
484
506
  item.id = (item.id ?? "").replace("MIDDLEWARE:", "");
485
507
  if (item.id && Helper.isClass(item.target)) {
@@ -487,13 +509,11 @@ class Loader {
487
509
  }
488
510
  });
489
511
  const middlewareConfList = middlewareConf.list;
490
- const defaultList = ["TraceMiddleware", "PayloadMiddleware"];
512
+ const defaultList = ["TraceMiddleware"];
491
513
  //de-duplication
492
514
  const appMList = new Set(defaultList);
493
515
  middlewareConfList.forEach((item) => {
494
- if (!defaultList.includes(item)) {
495
- appMList.add(item);
496
- }
516
+ appMList.add(item);
497
517
  });
498
518
  //Automatically call middleware
499
519
  for (const key of appMList) {
@@ -636,16 +656,19 @@ class Loader {
636
656
  }
637
657
  }
638
658
 
639
- var version = "3.10.3";
659
+ var version = "3.10.4-0";
640
660
  var engines = {
641
661
  node: ">12.0.0"
642
662
  };
643
663
 
644
- /**
645
- * @ author: richen
646
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
647
- * @ license: BSD (3-Clause)
648
- * @ version: 2020-05-10 11:49:15
664
+ /*
665
+ * @Description: framework runtime checker
666
+ * @Usage:
667
+ * @Author: richen
668
+ * @Date: 2023-12-09 21:56:32
669
+ * @LastEditTime: 2023-12-09 23:01:22
670
+ * @License: BSD (3-Clause)
671
+ * @Copyright (c): <richenlin(at)gmail.com>
649
672
  */
650
673
  const KOATTY_VERSION = version;
651
674
  const ENGINES_VERSION = engines.node.slice(1) || '12.0.0';
@@ -681,11 +704,14 @@ const checkUTRuntime = () => {
681
704
  return isUTRuntime;
682
705
  };
683
706
 
684
- /**
685
- * @ author: richen
686
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
687
- * @ license: BSD (3-Clause)
688
- * @ version: 2020-07-06 11:22:58
707
+ /*
708
+ * @Description: framework bootstrap
709
+ * @Usage:
710
+ * @Author: richen
711
+ * @Date: 2023-12-09 21:56:32
712
+ * @LastEditTime: 2023-12-09 22:59:19
713
+ * @License: BSD (3-Clause)
714
+ * @Copyright (c): <richenlin(at)gmail.com>
689
715
  */
690
716
  /**
691
717
  * execute bootstrap
@@ -892,11 +918,14 @@ function BindEventHook(eventName, eventFunc, target) {
892
918
  IOCContainer.attachClassMetadata(TAGGED_CLS, eventName, eventFunc, target);
893
919
  }
894
920
 
895
- /**
896
- * @ author: richen
897
- * @ copyright: Copyright (c) - <richenlin(at)gmail.com>
898
- * @ license: BSD (3-Clause)
899
- * @ version: 2020-05-10 11:32:45
921
+ /*
922
+ * @Description: component interface
923
+ * @Usage:
924
+ * @Author: richen
925
+ * @Date: 2023-12-09 21:56:32
926
+ * @LastEditTime: 2023-12-09 23:03:33
927
+ * @License: BSD (3-Clause)
928
+ * @Copyright (c): <richenlin(at)gmail.com>
900
929
  */
901
930
  /**
902
931
  * Indicates that an decorated class is a "component".
@@ -969,6 +998,15 @@ function Plugin(identifier) {
969
998
  };
970
999
  }
971
1000
 
1001
+ /*
1002
+ * @Description: base service
1003
+ * @Usage:
1004
+ * @Author: richen
1005
+ * @Date: 2023-12-09 21:56:32
1006
+ * @LastEditTime: 2023-12-09 23:03:23
1007
+ * @License: BSD (3-Clause)
1008
+ * @Copyright (c): <richenlin(at)gmail.com>
1009
+ */
972
1010
  /**
973
1011
  * Base service
974
1012
  *
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.10.3",
3
+ "version": "3.10.4-0",
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",
@@ -55,6 +55,7 @@
55
55
  "@microsoft/api-documenter": "^7.x.x",
56
56
  "@microsoft/api-extractor": "^7.x.x",
57
57
  "@rollup/plugin-json": "^6.x.x",
58
+ "@types/formidable": "^3.x.x",
58
59
  "@types/jest": "^29.x.x",
59
60
  "@types/koa": "^2.x.x",
60
61
  "@types/koa__router": "^12.x.x",
@@ -86,9 +87,8 @@
86
87
  "koatty_lib": "^1.3.4",
87
88
  "koatty_loader": "^1.1.0",
88
89
  "koatty_logger": "^2.1.2",
89
- "koatty_payload": "^1.4.6",
90
90
  "koatty_proto": "^1.1.12",
91
- "koatty_serve": "^2.0.4",
91
+ "koatty_serve": "^2.1.0-0",
92
92
  "koatty_trace": "^1.10.2"
93
93
  }
94
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty",
3
- "version": "3.10.3",
3
+ "version": "3.10.4-0",
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",
@@ -55,6 +55,7 @@
55
55
  "@microsoft/api-documenter": "^7.x.x",
56
56
  "@microsoft/api-extractor": "^7.x.x",
57
57
  "@rollup/plugin-json": "^6.x.x",
58
+ "@types/formidable": "^3.x.x",
58
59
  "@types/jest": "^29.x.x",
59
60
  "@types/koa": "^2.x.x",
60
61
  "@types/koa__router": "^12.x.x",
@@ -86,9 +87,8 @@
86
87
  "koatty_lib": "^1.3.4",
87
88
  "koatty_loader": "^1.1.0",
88
89
  "koatty_logger": "^2.1.2",
89
- "koatty_payload": "^1.4.6",
90
90
  "koatty_proto": "^1.1.12",
91
- "koatty_serve": "^2.0.4",
91
+ "koatty_serve": "^2.1.0-0",
92
92
  "koatty_trace": "^1.10.2"
93
93
  }
94
94
  }
@@ -1,5 +0,0 @@
1
- {
2
- "DevChat.DevChatPath": "/Users/richen/.chat/mamba/envs/devchat/bin/devchat",
3
- "devchat.defaultModel": "gpt-4",
4
- "editor.inlineSuggest.showToolbar": "onHover"
5
- }