koatty 3.5.12 → 3.5.14
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 +2 -0
- package/dist/index.d.ts +10 -11
- package/dist/index.js +33 -43
- package/dist/index.mjs +33 -43
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,8 @@
|
|
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.5.14](https://github.com/thinkkoa/koatty/compare/v3.5.12...v3.5.14) (2022-01-17)
|
6
|
+
|
5
7
|
### [3.5.12](https://github.com/thinkkoa/koatty/compare/v3.5.12-3...v3.5.12) (2021-12-23)
|
6
8
|
|
7
9
|
### [3.5.12-3](https://github.com/thinkkoa/koatty/compare/v3.5.12-2...v3.5.12-3) (2021-12-23)
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* @Author: richen
|
3
|
-
* @Date:
|
3
|
+
* @Date: 2022-01-17 10:38:50
|
4
4
|
* @License: BSD (3-Clause)
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
6
6
|
* @HomePage: https://koatty.org/
|
@@ -10,7 +10,6 @@ import { Koatty } from 'koatty_core';
|
|
10
10
|
import { KoattyContext } from 'koatty_core';
|
11
11
|
import { KoattyNext } from 'koatty_core';
|
12
12
|
import { Logger as Logger_2 } from 'koatty_logger';
|
13
|
-
import { ObjectDefinitionOptions } from 'koatty_container';
|
14
13
|
|
15
14
|
/**
|
16
15
|
* Interface for Api input
|
@@ -40,7 +39,7 @@ export declare type AppReadyHookFunc = (app: Koatty) => Promise<any>;
|
|
40
39
|
* @implements {IController}
|
41
40
|
*/
|
42
41
|
export declare class BaseController implements IController {
|
43
|
-
app: Koatty;
|
42
|
+
readonly app: Koatty;
|
44
43
|
readonly ctx: KoattyContext;
|
45
44
|
/**
|
46
45
|
* instance of BaseController.
|
@@ -83,18 +82,18 @@ export declare class BaseController implements IController {
|
|
83
82
|
* @class Base
|
84
83
|
*/
|
85
84
|
export declare class BaseService implements IService {
|
86
|
-
app: Koatty;
|
85
|
+
readonly app: Koatty;
|
87
86
|
/**
|
88
|
-
* instance of
|
89
|
-
* @param {
|
90
|
-
* @
|
87
|
+
* instance of BaseController.
|
88
|
+
* @param {Koatty} app
|
89
|
+
* @param {KoattyContext} ctx
|
90
|
+
* @memberof BaseController
|
91
91
|
*/
|
92
92
|
/**
|
93
93
|
* init
|
94
94
|
*
|
95
95
|
* @protected
|
96
|
-
* @
|
97
|
-
* @memberof Base
|
96
|
+
* @memberof BaseController
|
98
97
|
*/
|
99
98
|
}
|
100
99
|
|
@@ -294,7 +293,7 @@ export declare class HttpController extends BaseController {
|
|
294
293
|
* Interface for Controller
|
295
294
|
*/
|
296
295
|
export declare interface IController {
|
297
|
-
app: Koatty;
|
296
|
+
readonly app: Koatty;
|
298
297
|
readonly ctx: KoattyContext;
|
299
298
|
__befor?: () => Promise<any>;
|
300
299
|
__after?: () => Promise<any>;
|
@@ -320,7 +319,7 @@ export declare interface IPlugin {
|
|
320
319
|
* Interface for Service
|
321
320
|
*/
|
322
321
|
export declare interface IService {
|
323
|
-
app: Koatty;
|
322
|
+
readonly app: Koatty;
|
324
323
|
}
|
325
324
|
|
326
325
|
/**
|
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* @Author: richen
|
3
|
-
* @Date:
|
3
|
+
* @Date: 2022-01-17 10:38:33
|
4
4
|
* @License: BSD (3-Clause)
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
6
6
|
* @HomePage: https://koatty.org/
|
@@ -136,9 +136,9 @@ class BaseController {
|
|
136
136
|
* @param {KoattyContext} ctx
|
137
137
|
* @memberof BaseController
|
138
138
|
*/
|
139
|
-
constructor(ctx) {
|
139
|
+
constructor(ctx, ...arg) {
|
140
140
|
this.ctx = ctx;
|
141
|
-
this.init();
|
141
|
+
this.init(arg);
|
142
142
|
}
|
143
143
|
/**
|
144
144
|
* init
|
@@ -146,10 +146,10 @@ class BaseController {
|
|
146
146
|
* @protected
|
147
147
|
* @memberof BaseController
|
148
148
|
*/
|
149
|
-
init() {
|
149
|
+
init(...arg) {
|
150
150
|
}
|
151
151
|
// /**
|
152
|
-
// * Class pre-execution method
|
152
|
+
// * Class pre-execution method (except constructor, init, __after).
|
153
153
|
// *
|
154
154
|
// * @returns {Promise<any>}
|
155
155
|
// * @memberof BaseController
|
@@ -158,7 +158,7 @@ class BaseController {
|
|
158
158
|
// return Promise.resolve();
|
159
159
|
// }
|
160
160
|
// /**
|
161
|
-
// * Class after-execution method
|
161
|
+
// * Class after-execution method (except constructor, init, __before).
|
162
162
|
// *
|
163
163
|
// * @public
|
164
164
|
// * @returns {*}
|
@@ -462,34 +462,6 @@ function SetLogger(config) {
|
|
462
462
|
}
|
463
463
|
}
|
464
464
|
|
465
|
-
/**
|
466
|
-
* Base class
|
467
|
-
*
|
468
|
-
* @export
|
469
|
-
* @class Base
|
470
|
-
*/
|
471
|
-
class BaseService {
|
472
|
-
/**
|
473
|
-
* instance of Base.
|
474
|
-
* @param {...any[]} arg
|
475
|
-
* @memberof Base
|
476
|
-
*/
|
477
|
-
constructor(...arg) {
|
478
|
-
this.init(arg);
|
479
|
-
}
|
480
|
-
/**
|
481
|
-
* init
|
482
|
-
*
|
483
|
-
* @protected
|
484
|
-
* @param {...any[]} arg
|
485
|
-
* @memberof Base
|
486
|
-
*/
|
487
|
-
init(...arg) {
|
488
|
-
// todo
|
489
|
-
// Logger.Debug(arg)
|
490
|
-
}
|
491
|
-
}
|
492
|
-
|
493
465
|
/**
|
494
466
|
* @ author: richen
|
495
467
|
* @ copyright: Copyright (c) - <richenlin(at)gmail.com>
|
@@ -830,10 +802,6 @@ class Loader {
|
|
830
802
|
Logger.Debug(`Load service: ${item.id}`);
|
831
803
|
// registering to IOC
|
832
804
|
koatty_container.IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "SERVICE", args: [] });
|
833
|
-
const ctl = koatty_container.IOCContainer.getInsByClass(item.target);
|
834
|
-
if (!(ctl instanceof BaseService)) {
|
835
|
-
throw new Error(`class ${item.id} does not inherit from BaseService`);
|
836
|
-
}
|
837
805
|
}
|
838
806
|
});
|
839
807
|
}
|
@@ -851,8 +819,6 @@ class Loader {
|
|
851
819
|
item.id = ((_a = item.id) !== null && _a !== void 0 ? _a : "").replace("COMPONENT:", "");
|
852
820
|
if (item.id && !(item.id).endsWith("Plugin") && koatty_lib.Helper.isClass(item.target)) {
|
853
821
|
Logger.Debug(`Load component: ${item.id}`);
|
854
|
-
// inject schedule
|
855
|
-
// injectSchedule(item.target, item.target.prototype, IOCContainer);
|
856
822
|
// registering to IOC
|
857
823
|
koatty_container.IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "COMPONENT", args: [] });
|
858
824
|
}
|
@@ -877,7 +843,6 @@ class Loader {
|
|
877
843
|
var _a;
|
878
844
|
item.id = ((_a = item.id) !== null && _a !== void 0 ? _a : "").replace("COMPONENT:", "");
|
879
845
|
if (item.id && (item.id).endsWith("Plugin") && koatty_lib.Helper.isClass(item.target)) {
|
880
|
-
// Logger.Debug(`Load plugin: ${item.id}`);
|
881
846
|
// registering to IOC
|
882
847
|
koatty_container.IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "COMPONENT", args: [] });
|
883
848
|
pluginList.push(item.id);
|
@@ -896,14 +861,13 @@ class Loader {
|
|
896
861
|
if (pluginsConf.config[key] === false) {
|
897
862
|
continue;
|
898
863
|
}
|
899
|
-
// Logger.Debug(`Execute plugin: ${key}`);
|
900
864
|
// sync exec
|
901
865
|
await handle.run((_a = pluginsConf.config[key]) !== null && _a !== void 0 ? _a : {}, app);
|
902
866
|
}
|
903
867
|
}
|
904
868
|
}
|
905
869
|
|
906
|
-
var version = "3.5.
|
870
|
+
var version = "3.5.14";
|
907
871
|
var engines = {
|
908
872
|
node: ">12.0.0"
|
909
873
|
};
|
@@ -1211,6 +1175,32 @@ function Plugin(identifier) {
|
|
1211
1175
|
};
|
1212
1176
|
}
|
1213
1177
|
|
1178
|
+
/**
|
1179
|
+
* Base class
|
1180
|
+
*
|
1181
|
+
* @export
|
1182
|
+
* @class Base
|
1183
|
+
*/
|
1184
|
+
class BaseService {
|
1185
|
+
/**
|
1186
|
+
* instance of BaseController.
|
1187
|
+
* @param {Koatty} app
|
1188
|
+
* @param {KoattyContext} ctx
|
1189
|
+
* @memberof BaseController
|
1190
|
+
*/
|
1191
|
+
constructor(...arg) {
|
1192
|
+
this.init(arg);
|
1193
|
+
}
|
1194
|
+
/**
|
1195
|
+
* init
|
1196
|
+
*
|
1197
|
+
* @protected
|
1198
|
+
* @memberof BaseController
|
1199
|
+
*/
|
1200
|
+
init(...arg) {
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
|
1214
1204
|
Object.defineProperty(exports, 'Helper', {
|
1215
1205
|
enumerable: true,
|
1216
1206
|
get: function () { return koatty_lib.Helper; }
|
package/dist/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* @Author: richen
|
3
|
-
* @Date:
|
3
|
+
* @Date: 2022-01-17 10:38:33
|
4
4
|
* @License: BSD (3-Clause)
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
6
6
|
* @HomePage: https://koatty.org/
|
@@ -119,9 +119,9 @@ class BaseController {
|
|
119
119
|
* @param {KoattyContext} ctx
|
120
120
|
* @memberof BaseController
|
121
121
|
*/
|
122
|
-
constructor(ctx) {
|
122
|
+
constructor(ctx, ...arg) {
|
123
123
|
this.ctx = ctx;
|
124
|
-
this.init();
|
124
|
+
this.init(arg);
|
125
125
|
}
|
126
126
|
/**
|
127
127
|
* init
|
@@ -129,10 +129,10 @@ class BaseController {
|
|
129
129
|
* @protected
|
130
130
|
* @memberof BaseController
|
131
131
|
*/
|
132
|
-
init() {
|
132
|
+
init(...arg) {
|
133
133
|
}
|
134
134
|
// /**
|
135
|
-
// * Class pre-execution method
|
135
|
+
// * Class pre-execution method (except constructor, init, __after).
|
136
136
|
// *
|
137
137
|
// * @returns {Promise<any>}
|
138
138
|
// * @memberof BaseController
|
@@ -141,7 +141,7 @@ class BaseController {
|
|
141
141
|
// return Promise.resolve();
|
142
142
|
// }
|
143
143
|
// /**
|
144
|
-
// * Class after-execution method
|
144
|
+
// * Class after-execution method (except constructor, init, __before).
|
145
145
|
// *
|
146
146
|
// * @public
|
147
147
|
// * @returns {*}
|
@@ -445,34 +445,6 @@ function SetLogger(config) {
|
|
445
445
|
}
|
446
446
|
}
|
447
447
|
|
448
|
-
/**
|
449
|
-
* Base class
|
450
|
-
*
|
451
|
-
* @export
|
452
|
-
* @class Base
|
453
|
-
*/
|
454
|
-
class BaseService {
|
455
|
-
/**
|
456
|
-
* instance of Base.
|
457
|
-
* @param {...any[]} arg
|
458
|
-
* @memberof Base
|
459
|
-
*/
|
460
|
-
constructor(...arg) {
|
461
|
-
this.init(arg);
|
462
|
-
}
|
463
|
-
/**
|
464
|
-
* init
|
465
|
-
*
|
466
|
-
* @protected
|
467
|
-
* @param {...any[]} arg
|
468
|
-
* @memberof Base
|
469
|
-
*/
|
470
|
-
init(...arg) {
|
471
|
-
// todo
|
472
|
-
// Logger.Debug(arg)
|
473
|
-
}
|
474
|
-
}
|
475
|
-
|
476
448
|
/**
|
477
449
|
* @ author: richen
|
478
450
|
* @ copyright: Copyright (c) - <richenlin(at)gmail.com>
|
@@ -813,10 +785,6 @@ class Loader {
|
|
813
785
|
Logger.Debug(`Load service: ${item.id}`);
|
814
786
|
// registering to IOC
|
815
787
|
IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "SERVICE", args: [] });
|
816
|
-
const ctl = IOCContainer.getInsByClass(item.target);
|
817
|
-
if (!(ctl instanceof BaseService)) {
|
818
|
-
throw new Error(`class ${item.id} does not inherit from BaseService`);
|
819
|
-
}
|
820
788
|
}
|
821
789
|
});
|
822
790
|
}
|
@@ -834,8 +802,6 @@ class Loader {
|
|
834
802
|
item.id = ((_a = item.id) !== null && _a !== void 0 ? _a : "").replace("COMPONENT:", "");
|
835
803
|
if (item.id && !(item.id).endsWith("Plugin") && Helper.isClass(item.target)) {
|
836
804
|
Logger.Debug(`Load component: ${item.id}`);
|
837
|
-
// inject schedule
|
838
|
-
// injectSchedule(item.target, item.target.prototype, IOCContainer);
|
839
805
|
// registering to IOC
|
840
806
|
IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "COMPONENT", args: [] });
|
841
807
|
}
|
@@ -860,7 +826,6 @@ class Loader {
|
|
860
826
|
var _a;
|
861
827
|
item.id = ((_a = item.id) !== null && _a !== void 0 ? _a : "").replace("COMPONENT:", "");
|
862
828
|
if (item.id && (item.id).endsWith("Plugin") && Helper.isClass(item.target)) {
|
863
|
-
// Logger.Debug(`Load plugin: ${item.id}`);
|
864
829
|
// registering to IOC
|
865
830
|
IOCContainer.reg(item.id, item.target, { scope: "Singleton", type: "COMPONENT", args: [] });
|
866
831
|
pluginList.push(item.id);
|
@@ -879,14 +844,13 @@ class Loader {
|
|
879
844
|
if (pluginsConf.config[key] === false) {
|
880
845
|
continue;
|
881
846
|
}
|
882
|
-
// Logger.Debug(`Execute plugin: ${key}`);
|
883
847
|
// sync exec
|
884
848
|
await handle.run((_a = pluginsConf.config[key]) !== null && _a !== void 0 ? _a : {}, app);
|
885
849
|
}
|
886
850
|
}
|
887
851
|
}
|
888
852
|
|
889
|
-
var version = "3.5.
|
853
|
+
var version = "3.5.14";
|
890
854
|
var engines = {
|
891
855
|
node: ">12.0.0"
|
892
856
|
};
|
@@ -1194,4 +1158,30 @@ function Plugin(identifier) {
|
|
1194
1158
|
};
|
1195
1159
|
}
|
1196
1160
|
|
1161
|
+
/**
|
1162
|
+
* Base class
|
1163
|
+
*
|
1164
|
+
* @export
|
1165
|
+
* @class Base
|
1166
|
+
*/
|
1167
|
+
class BaseService {
|
1168
|
+
/**
|
1169
|
+
* instance of BaseController.
|
1170
|
+
* @param {Koatty} app
|
1171
|
+
* @param {KoattyContext} ctx
|
1172
|
+
* @memberof BaseController
|
1173
|
+
*/
|
1174
|
+
constructor(...arg) {
|
1175
|
+
this.init(arg);
|
1176
|
+
}
|
1177
|
+
/**
|
1178
|
+
* init
|
1179
|
+
*
|
1180
|
+
* @protected
|
1181
|
+
* @memberof BaseController
|
1182
|
+
*/
|
1183
|
+
init(...arg) {
|
1184
|
+
}
|
1185
|
+
}
|
1186
|
+
|
1197
1187
|
export { BaseController, BaseService, BindAppReadyHook, Bootstrap, Component, ComponentScan, ConfigurationScan, Controller, HttpController, Logger, Middleware, Plugin, Service };
|
package/dist/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "koatty",
|
3
|
-
"version": "3.5.
|
3
|
+
"version": "3.5.14",
|
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",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "koatty",
|
3
|
-
"version": "3.5.
|
3
|
+
"version": "3.5.14",
|
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",
|