@midwayjs/decorator 3.0.0-alpha.6 → 3.0.0-beta.4
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 +43 -0
- package/dist/constant.d.ts +7 -5
- package/dist/constant.js +18 -9
- package/dist/{annotation → decorator/common}/aspect.d.ts +0 -0
- package/dist/{annotation → decorator/common}/aspect.js +5 -4
- package/dist/{annotation → decorator/common}/autoload.d.ts +0 -0
- package/dist/decorator/common/autoload.js +13 -0
- package/dist/{annotation → decorator/common}/configuration.d.ts +0 -0
- package/dist/{annotation → decorator/common}/configuration.js +2 -2
- package/dist/{annotation → decorator/common}/decide.d.ts +0 -0
- package/dist/{annotation → decorator/common}/decide.js +0 -0
- package/dist/decorator/common/filter.d.ts +4 -0
- package/dist/decorator/common/filter.js +30 -0
- package/dist/decorator/common/framework.d.ts +2 -0
- package/dist/decorator/common/framework.js +13 -0
- package/dist/{annotation → decorator/common}/index.d.ts +6 -8
- package/dist/{annotation → decorator/common}/index.js +6 -10
- package/dist/decorator/common/inject.d.ts +3 -0
- package/dist/decorator/common/inject.js +11 -0
- package/dist/decorator/common/middleware.d.ts +2 -0
- package/dist/decorator/common/middleware.js +12 -0
- package/dist/decorator/common/objectDef.d.ts +5 -0
- package/dist/decorator/common/objectDef.js +25 -0
- package/dist/decorator/common/pipeline.d.ts +3 -0
- package/dist/decorator/common/pipeline.js +11 -0
- package/dist/decorator/common/provide.d.ts +3 -0
- package/dist/{annotation → decorator/common}/provide.js +2 -2
- package/dist/{faas/fun.d.ts → decorator/faas/serverlessTrigger.d.ts} +2 -14
- package/dist/decorator/faas/serverlessTrigger.js +29 -0
- package/dist/decorator/framework/index.d.ts +7 -0
- package/dist/decorator/framework/index.js +33 -0
- package/dist/{annotation → decorator/framework}/schedule.d.ts +0 -0
- package/dist/decorator/framework/schedule.js +15 -0
- package/dist/decorator/index.d.ts +18 -0
- package/dist/decorator/index.js +38 -0
- package/dist/{microservice → decorator/microservice}/consumer.d.ts +1 -1
- package/dist/decorator/microservice/consumer.js +17 -0
- package/dist/{microservice → decorator/microservice}/provider.d.ts +1 -1
- package/dist/{microservice → decorator/microservice}/provider.js +9 -8
- package/dist/{microservice → decorator/microservice}/rabbitmqListener.d.ts +0 -0
- package/dist/{microservice → decorator/microservice}/rabbitmqListener.js +2 -2
- package/dist/{rpc → decorator/rpc}/hsf.d.ts +0 -0
- package/dist/decorator/rpc/hsf.js +19 -0
- package/dist/decorator/task/queue.d.ts +2 -0
- package/dist/decorator/task/queue.js +17 -0
- package/dist/{annotation → decorator/task}/task.d.ts +0 -0
- package/dist/{annotation → decorator/task}/task.js +4 -4
- package/dist/{annotation → decorator/task}/taskLocal.d.ts +0 -0
- package/dist/{annotation → decorator/task}/taskLocal.js +4 -4
- package/dist/{web → decorator/web}/controller.d.ts +3 -1
- package/dist/{web → decorator/web}/controller.js +6 -5
- package/dist/{web → decorator/web}/paramMapping.d.ts +10 -10
- package/dist/{web → decorator/web}/paramMapping.js +4 -8
- package/dist/{web → decorator/web}/requestMapping.d.ts +34 -1
- package/dist/{web → decorator/web}/requestMapping.js +5 -3
- package/dist/{web → decorator/web}/response.d.ts +0 -0
- package/dist/{web → decorator/web}/response.js +6 -6
- package/dist/{ws → decorator/ws}/webSocketController.d.ts +1 -1
- package/dist/decorator/ws/webSocketController.js +18 -0
- package/dist/{ws → decorator/ws}/webSocketEvent.d.ts +1 -1
- package/dist/{ws → decorator/ws}/webSocketEvent.js +7 -7
- package/dist/decoratorManager.d.ts +288 -0
- package/dist/{common/decoratorManager.js → decoratorManager.js} +248 -288
- package/dist/index.d.ts +2 -21
- package/dist/index.js +2 -21
- package/dist/interface.d.ts +40 -23
- package/dist/interface.js +31 -17
- package/dist/util/index.d.ts +5 -0
- package/dist/util/index.js +27 -1
- package/package.json +3 -6
- package/dist/annotation/autoload.js +0 -11
- package/dist/annotation/inject.d.ts +0 -3
- package/dist/annotation/inject.js +0 -16
- package/dist/annotation/objectDef.d.ts +0 -7
- package/dist/annotation/objectDef.js +0 -43
- package/dist/annotation/pipeline.d.ts +0 -3
- package/dist/annotation/pipeline.js +0 -27
- package/dist/annotation/priority.d.ts +0 -2
- package/dist/annotation/priority.js +0 -11
- package/dist/annotation/provide.d.ts +0 -3
- package/dist/annotation/queue.d.ts +0 -2
- package/dist/annotation/queue.js +0 -16
- package/dist/annotation/rule.d.ts +0 -1
- package/dist/annotation/rule.js +0 -50
- package/dist/annotation/schedule.js +0 -14
- package/dist/annotation/validate.d.ts +0 -1
- package/dist/annotation/validate.js +0 -36
- package/dist/common/decoratorManager.d.ts +0 -317
- package/dist/common/errMsg.d.ts +0 -4
- package/dist/common/errMsg.js +0 -8
- package/dist/common/metadata.d.ts +0 -9
- package/dist/common/metadata.js +0 -20
- package/dist/common/scopeEnum.d.ts +0 -6
- package/dist/common/scopeEnum.js +0 -10
- package/dist/faas/fun.js +0 -62
- package/dist/faas/handler.d.ts +0 -3
- package/dist/faas/handler.js +0 -21
- package/dist/framework/app.d.ts +0 -3
- package/dist/framework/app.js +0 -22
- package/dist/framework/config.d.ts +0 -2
- package/dist/framework/config.js +0 -25
- package/dist/framework/logger.d.ts +0 -2
- package/dist/framework/logger.js +0 -22
- package/dist/framework/plugin.d.ts +0 -2
- package/dist/framework/plugin.js +0 -22
- package/dist/microservice/consumer.js +0 -17
- package/dist/rpc/hsf.js +0 -18
- package/dist/ws/webSocketController.js +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
+
export * from './decorator';
|
|
1
2
|
export * from './interface';
|
|
2
|
-
export * from './annotation';
|
|
3
3
|
export * from './constant';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './common/errMsg';
|
|
6
|
-
export * from './common/metadata';
|
|
7
|
-
export * from './common/scopeEnum';
|
|
8
|
-
export * from './faas/fun';
|
|
9
|
-
export * from './faas/handler';
|
|
10
|
-
export * from './web/requestMapping';
|
|
11
|
-
export * from './web/paramMapping';
|
|
12
|
-
export * from './web/controller';
|
|
13
|
-
export * from './web/response';
|
|
14
|
-
export * from './rpc/hsf';
|
|
15
|
-
export * from './framework/config';
|
|
16
|
-
export * from './framework/logger';
|
|
17
|
-
export * from './framework/plugin';
|
|
18
|
-
export * from './framework/app';
|
|
19
|
-
export * from './ws/webSocketController';
|
|
20
|
-
export * from './ws/webSocketEvent';
|
|
21
|
-
export * from './microservice/provider';
|
|
22
|
-
export * from './microservice/consumer';
|
|
23
|
-
export * from './microservice/rabbitmqListener';
|
|
4
|
+
export * from './decoratorManager';
|
|
24
5
|
export * from './util/index';
|
|
25
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -10,28 +10,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./decorator"), exports);
|
|
13
14
|
__exportStar(require("./interface"), exports);
|
|
14
|
-
__exportStar(require("./annotation"), exports);
|
|
15
15
|
__exportStar(require("./constant"), exports);
|
|
16
|
-
__exportStar(require("./
|
|
17
|
-
__exportStar(require("./common/errMsg"), exports);
|
|
18
|
-
__exportStar(require("./common/metadata"), exports);
|
|
19
|
-
__exportStar(require("./common/scopeEnum"), exports);
|
|
20
|
-
__exportStar(require("./faas/fun"), exports);
|
|
21
|
-
__exportStar(require("./faas/handler"), exports);
|
|
22
|
-
__exportStar(require("./web/requestMapping"), exports);
|
|
23
|
-
__exportStar(require("./web/paramMapping"), exports);
|
|
24
|
-
__exportStar(require("./web/controller"), exports);
|
|
25
|
-
__exportStar(require("./web/response"), exports);
|
|
26
|
-
__exportStar(require("./rpc/hsf"), exports);
|
|
27
|
-
__exportStar(require("./framework/config"), exports);
|
|
28
|
-
__exportStar(require("./framework/logger"), exports);
|
|
29
|
-
__exportStar(require("./framework/plugin"), exports);
|
|
30
|
-
__exportStar(require("./framework/app"), exports);
|
|
31
|
-
__exportStar(require("./ws/webSocketController"), exports);
|
|
32
|
-
__exportStar(require("./ws/webSocketEvent"), exports);
|
|
33
|
-
__exportStar(require("./microservice/provider"), exports);
|
|
34
|
-
__exportStar(require("./microservice/consumer"), exports);
|
|
35
|
-
__exportStar(require("./microservice/rabbitmqListener"), exports);
|
|
16
|
+
__exportStar(require("./decoratorManager"), exports);
|
|
36
17
|
__exportStar(require("./util/index"), exports);
|
|
37
18
|
//# sourceMappingURL=index.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
|
|
1
|
+
export declare type MiddlewareParamArray = Array<string | any>;
|
|
2
|
+
export declare type ObjectIdentifier = string | Symbol;
|
|
3
|
+
export declare type GroupModeType = 'one' | 'multi';
|
|
4
|
+
export declare enum ScopeEnum {
|
|
5
|
+
Singleton = "Singleton",
|
|
6
|
+
Request = "Request",
|
|
7
|
+
Prototype = "Prototype"
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* 内部管理的属性、json、ref等解析实例存储
|
|
8
11
|
*/
|
|
@@ -16,8 +19,7 @@ export interface ObjectDefinitionOptions {
|
|
|
16
19
|
initMethod?: string;
|
|
17
20
|
destroyMethod?: string;
|
|
18
21
|
scope?: ScopeEnum;
|
|
19
|
-
constructorArgs?:
|
|
20
|
-
isAutowire?: boolean;
|
|
22
|
+
constructorArgs?: any[];
|
|
21
23
|
namespace?: string;
|
|
22
24
|
srcPath?: string;
|
|
23
25
|
}
|
|
@@ -29,9 +31,11 @@ export interface TagPropsMetadata {
|
|
|
29
31
|
export interface TagClsMetadata {
|
|
30
32
|
id: string;
|
|
31
33
|
originName: string;
|
|
34
|
+
uuid: string;
|
|
35
|
+
name: string;
|
|
32
36
|
}
|
|
33
37
|
export interface ReflectResult {
|
|
34
|
-
[key: string]:
|
|
38
|
+
[key: string]: any[];
|
|
35
39
|
}
|
|
36
40
|
export declare enum MSProviderType {
|
|
37
41
|
DUBBO = "dubbo",
|
|
@@ -127,13 +131,16 @@ export declare namespace FaaSMetadata {
|
|
|
127
131
|
* deploy or not
|
|
128
132
|
*/
|
|
129
133
|
isDeploy?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* function middleware
|
|
136
|
+
*/
|
|
137
|
+
middleware?: any[];
|
|
130
138
|
}
|
|
131
139
|
export interface EventTriggerOptions extends TriggerCommonOptions {
|
|
132
140
|
}
|
|
133
141
|
export interface HTTPTriggerOptions extends TriggerCommonOptions {
|
|
134
142
|
path: string;
|
|
135
143
|
method?: 'get' | 'post' | 'delete' | 'put' | 'head' | 'patch' | 'all';
|
|
136
|
-
middleware?: any[];
|
|
137
144
|
}
|
|
138
145
|
export interface APIGatewayTriggerOptions extends HTTPTriggerOptions {
|
|
139
146
|
}
|
|
@@ -178,20 +185,25 @@ export declare namespace FaaSMetadata {
|
|
|
178
185
|
}
|
|
179
186
|
export {};
|
|
180
187
|
}
|
|
181
|
-
export declare
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
export declare abstract class FrameworkType {
|
|
189
|
+
abstract name: string;
|
|
190
|
+
}
|
|
191
|
+
export declare class MidwayFrameworkType extends FrameworkType {
|
|
192
|
+
name: string;
|
|
193
|
+
static WEB: MidwayFrameworkType;
|
|
194
|
+
static WEB_KOA: MidwayFrameworkType;
|
|
195
|
+
static WEB_EXPRESS: MidwayFrameworkType;
|
|
196
|
+
static FAAS: MidwayFrameworkType;
|
|
197
|
+
static MS_GRPC: MidwayFrameworkType;
|
|
198
|
+
static MS_RABBITMQ: MidwayFrameworkType;
|
|
199
|
+
static WS_IO: MidwayFrameworkType;
|
|
200
|
+
static WS: MidwayFrameworkType;
|
|
201
|
+
static SERVERLESS_APP: MidwayFrameworkType;
|
|
202
|
+
static CUSTOM: MidwayFrameworkType;
|
|
203
|
+
static EMPTY: MidwayFrameworkType;
|
|
204
|
+
static LIGHT: MidwayFrameworkType;
|
|
205
|
+
static TASK: MidwayFrameworkType;
|
|
206
|
+
constructor(name: string);
|
|
195
207
|
}
|
|
196
208
|
export declare enum ServerlessTriggerType {
|
|
197
209
|
EVENT = "event",
|
|
@@ -205,4 +217,9 @@ export declare enum ServerlessTriggerType {
|
|
|
205
217
|
HSF = "hsf",
|
|
206
218
|
MTOP = "mtop"
|
|
207
219
|
}
|
|
220
|
+
export interface IModuleStore {
|
|
221
|
+
listModule(key: string): any;
|
|
222
|
+
saveModule(key: string, module: any): any;
|
|
223
|
+
transformModule?(moduleMap: Map<string, Set<any>>): any;
|
|
224
|
+
}
|
|
208
225
|
//# sourceMappingURL=interface.d.ts.map
|
package/dist/interface.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerlessTriggerType = exports.MidwayFrameworkType = exports.MSListenerType = exports.MSProviderType = void 0;
|
|
3
|
+
exports.ServerlessTriggerType = exports.MidwayFrameworkType = exports.FrameworkType = exports.MSListenerType = exports.MSProviderType = exports.ScopeEnum = void 0;
|
|
4
|
+
var ScopeEnum;
|
|
5
|
+
(function (ScopeEnum) {
|
|
6
|
+
ScopeEnum["Singleton"] = "Singleton";
|
|
7
|
+
ScopeEnum["Request"] = "Request";
|
|
8
|
+
ScopeEnum["Prototype"] = "Prototype";
|
|
9
|
+
})(ScopeEnum = exports.ScopeEnum || (exports.ScopeEnum = {}));
|
|
4
10
|
var MSProviderType;
|
|
5
11
|
(function (MSProviderType) {
|
|
6
12
|
MSProviderType["DUBBO"] = "dubbo";
|
|
@@ -14,22 +20,30 @@ var MSListenerType;
|
|
|
14
20
|
MSListenerType["KAFKA"] = "kafka";
|
|
15
21
|
MSListenerType["REDIS"] = "redis";
|
|
16
22
|
})(MSListenerType = exports.MSListenerType || (exports.MSListenerType = {}));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
class FrameworkType {
|
|
24
|
+
}
|
|
25
|
+
exports.FrameworkType = FrameworkType;
|
|
26
|
+
class MidwayFrameworkType extends FrameworkType {
|
|
27
|
+
constructor(name) {
|
|
28
|
+
super();
|
|
29
|
+
this.name = name;
|
|
30
|
+
}
|
|
31
|
+
;
|
|
32
|
+
}
|
|
33
|
+
exports.MidwayFrameworkType = MidwayFrameworkType;
|
|
34
|
+
MidwayFrameworkType.WEB = new MidwayFrameworkType('@midwayjs/web');
|
|
35
|
+
MidwayFrameworkType.WEB_KOA = new MidwayFrameworkType('@midwayjs/web-koa');
|
|
36
|
+
MidwayFrameworkType.WEB_EXPRESS = new MidwayFrameworkType('@midwayjs/express');
|
|
37
|
+
MidwayFrameworkType.FAAS = new MidwayFrameworkType('@midwayjs/faas');
|
|
38
|
+
MidwayFrameworkType.MS_GRPC = new MidwayFrameworkType('@midwayjs/grpc');
|
|
39
|
+
MidwayFrameworkType.MS_RABBITMQ = new MidwayFrameworkType('@midwayjs/rabbitmq');
|
|
40
|
+
MidwayFrameworkType.WS_IO = new MidwayFrameworkType('@midwayjs/socketio');
|
|
41
|
+
MidwayFrameworkType.WS = new MidwayFrameworkType('@midwayjs/ws');
|
|
42
|
+
MidwayFrameworkType.SERVERLESS_APP = new MidwayFrameworkType('@midwayjs/serverless-app');
|
|
43
|
+
MidwayFrameworkType.CUSTOM = new MidwayFrameworkType('');
|
|
44
|
+
MidwayFrameworkType.EMPTY = new MidwayFrameworkType('empty');
|
|
45
|
+
MidwayFrameworkType.LIGHT = new MidwayFrameworkType('light');
|
|
46
|
+
MidwayFrameworkType.TASK = new MidwayFrameworkType('@midwayjs/task');
|
|
33
47
|
var ServerlessTriggerType;
|
|
34
48
|
(function (ServerlessTriggerType) {
|
|
35
49
|
ServerlessTriggerType["EVENT"] = "event";
|
package/dist/util/index.d.ts
CHANGED
|
@@ -23,4 +23,9 @@ export declare function getParamNames(func: any): string[];
|
|
|
23
23
|
* @param name 类名称
|
|
24
24
|
*/
|
|
25
25
|
export declare function classNamed(name: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* generate a lightweight random id, enough for ioc container
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateRandomId(): string;
|
|
30
|
+
export declare function merge(target: any, src: any): any;
|
|
26
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/util/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.classNamed = exports.getParamNames = exports.sleep = exports.isNullOrUndefined = exports.isNull = exports.isUndefined = exports.isRegExp = exports.isSet = exports.isMap = exports.isProxy = exports.isNumber = exports.isObject = exports.isFunction = exports.isPromise = exports.isGeneratorFunction = exports.isAsyncFunction = exports.isClass = void 0;
|
|
3
|
+
exports.merge = exports.generateRandomId = exports.classNamed = exports.getParamNames = exports.sleep = exports.isNullOrUndefined = exports.isNull = exports.isUndefined = exports.isRegExp = exports.isSet = exports.isMap = exports.isProxy = exports.isNumber = exports.isObject = exports.isFunction = exports.isPromise = exports.isGeneratorFunction = exports.isAsyncFunction = exports.isClass = void 0;
|
|
4
4
|
const util = require("util");
|
|
5
5
|
const camelcase = require("camelcase");
|
|
6
|
+
const crypto = require("crypto");
|
|
6
7
|
const ToString = Function.prototype.toString;
|
|
7
8
|
function fnBody(fn) {
|
|
8
9
|
return ToString.call(fn)
|
|
@@ -109,4 +110,29 @@ function classNamed(name) {
|
|
|
109
110
|
return camelcase(name);
|
|
110
111
|
}
|
|
111
112
|
exports.classNamed = classNamed;
|
|
113
|
+
/**
|
|
114
|
+
* generate a lightweight random id, enough for ioc container
|
|
115
|
+
*/
|
|
116
|
+
function generateRandomId() {
|
|
117
|
+
// => f9b327e70bbcf42494ccb28b2d98e00e
|
|
118
|
+
return crypto.randomBytes(16).toString('hex');
|
|
119
|
+
}
|
|
120
|
+
exports.generateRandomId = generateRandomId;
|
|
121
|
+
function merge(target, src) {
|
|
122
|
+
if (!target) {
|
|
123
|
+
target = src;
|
|
124
|
+
src = null;
|
|
125
|
+
}
|
|
126
|
+
if (!target) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
if (Array.isArray(target)) {
|
|
130
|
+
return target.concat(src || []);
|
|
131
|
+
}
|
|
132
|
+
if (typeof target === 'object') {
|
|
133
|
+
return Object.assign({}, target, src);
|
|
134
|
+
}
|
|
135
|
+
throw new Error('can not merge meta that type of ' + typeof target);
|
|
136
|
+
}
|
|
137
|
+
exports.merge = merge;
|
|
112
138
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/decorator",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"description": "definition decorator for midway project",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -12,10 +12,7 @@
|
|
|
12
12
|
"link": "npm link"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@types/express": "^4.17.8",
|
|
16
|
-
"@types/koa": "^2.11.4",
|
|
17
15
|
"camelcase": "^6.2.0",
|
|
18
|
-
"class-transformer": "^0.3.1",
|
|
19
16
|
"reflect-metadata": "^0.1.13"
|
|
20
17
|
},
|
|
21
18
|
"devDependencies": {
|
|
@@ -30,7 +27,7 @@
|
|
|
30
27
|
"dist/**/*.d.ts"
|
|
31
28
|
],
|
|
32
29
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
30
|
+
"node": ">=12"
|
|
34
31
|
},
|
|
35
32
|
"author": "Harry Chen <czy88840616@gmail.com>",
|
|
36
33
|
"repository": {
|
|
@@ -40,5 +37,5 @@
|
|
|
40
37
|
"publishConfig": {
|
|
41
38
|
"access": "public"
|
|
42
39
|
},
|
|
43
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "02e2144e302f807770b512b0d89da3145b1cbf2e"
|
|
44
41
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Autoload = void 0;
|
|
4
|
-
const decoratorManager_1 = require("../common/decoratorManager");
|
|
5
|
-
function Autoload() {
|
|
6
|
-
return function (target) {
|
|
7
|
-
decoratorManager_1.savePreloadModule(target);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
exports.Autoload = Autoload;
|
|
11
|
-
//# sourceMappingURL=autoload.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Inject = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
function Inject(identifier) {
|
|
6
|
-
return function (target, targetKey, index) {
|
|
7
|
-
if (typeof index === 'number') {
|
|
8
|
-
__1.saveConstructorInject({ target, targetKey, identifier, index });
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
__1.savePropertyInject({ target, targetKey, identifier });
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.Inject = Inject;
|
|
16
|
-
//# sourceMappingURL=inject.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ScopeEnum } from '../';
|
|
2
|
-
export declare function Async(): (target: any) => void;
|
|
3
|
-
export declare function Init(): (target: any, propertyKey: string) => void;
|
|
4
|
-
export declare function Destroy(): (target: any, propertyKey: string) => void;
|
|
5
|
-
export declare function Scope(scope?: ScopeEnum): (target: any) => void;
|
|
6
|
-
export declare function Autowire(isAutowire?: boolean): (target: any) => void;
|
|
7
|
-
//# sourceMappingURL=objectDef.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Autowire = exports.Scope = exports.Destroy = exports.Init = exports.Async = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
const debug = require('util').debuglog('decorator:context:obj_def');
|
|
6
|
-
function Async() {
|
|
7
|
-
return function (target) {
|
|
8
|
-
debug(`set [async] property in [${target.name}]`);
|
|
9
|
-
return __1.saveObjectDefProps(target, { isAsync: true });
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
exports.Async = Async;
|
|
13
|
-
function Init() {
|
|
14
|
-
return function (target, propertyKey) {
|
|
15
|
-
debug(`set [init] property in [${target.constructor.name}]`);
|
|
16
|
-
return __1.saveObjectDefProps(target.constructor, { initMethod: propertyKey });
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
exports.Init = Init;
|
|
20
|
-
function Destroy() {
|
|
21
|
-
return function (target, propertyKey) {
|
|
22
|
-
debug(`set [destroy] property in [${target.constructor.name}]`);
|
|
23
|
-
return __1.saveObjectDefProps(target.constructor, {
|
|
24
|
-
destroyMethod: propertyKey,
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.Destroy = Destroy;
|
|
29
|
-
function Scope(scope = __1.ScopeEnum.Singleton) {
|
|
30
|
-
return function (target) {
|
|
31
|
-
debug(`set [scope] property in [${target.name}]`);
|
|
32
|
-
return __1.saveObjectDefProps(target, { scope });
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.Scope = Scope;
|
|
36
|
-
function Autowire(isAutowire = true) {
|
|
37
|
-
return function (target) {
|
|
38
|
-
debug(`set [autowire] property in [${target.name}]`);
|
|
39
|
-
return __1.saveObjectDefProps(target, { isAutowire });
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
exports.Autowire = Autowire;
|
|
43
|
-
//# sourceMappingURL=objectDef.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pipeline = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
function Pipeline(valves) {
|
|
6
|
-
return function (target, targetKey, index) {
|
|
7
|
-
if (typeof index === 'number') {
|
|
8
|
-
__1.saveConstructorInject({
|
|
9
|
-
target,
|
|
10
|
-
targetKey,
|
|
11
|
-
identifier: __1.PIPELINE_IDENTIFIER,
|
|
12
|
-
index,
|
|
13
|
-
args: valves,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
__1.savePropertyInject({
|
|
18
|
-
target,
|
|
19
|
-
targetKey,
|
|
20
|
-
identifier: __1.PIPELINE_IDENTIFIER,
|
|
21
|
-
args: valves,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.Pipeline = Pipeline;
|
|
27
|
-
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Priority = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
function Priority(priority) {
|
|
6
|
-
return (target) => {
|
|
7
|
-
__1.saveClassMetadata(__1.PRIORITY_KEY, priority, target);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
exports.Priority = Priority;
|
|
11
|
-
//# sourceMappingURL=priority.js.map
|
package/dist/annotation/queue.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Queue = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
const constant_1 = require("../constant");
|
|
6
|
-
function Queue(options) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
__1.saveModule(constant_1.MODULE_TASK_QUEUE_KEY, target);
|
|
9
|
-
__1.saveClassMetadata(constant_1.MODULE_TASK_QUEUE_OPTIONS, {
|
|
10
|
-
options,
|
|
11
|
-
name: target.name,
|
|
12
|
-
}, target);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.Queue = Queue;
|
|
16
|
-
//# sourceMappingURL=queue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=rule.d.ts.map
|
package/dist/annotation/rule.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import * as joi from 'joi';
|
|
2
|
-
// import {
|
|
3
|
-
// attachClassMetadata,
|
|
4
|
-
// getClassMetadata,
|
|
5
|
-
// getPropertyType,
|
|
6
|
-
// saveClassMetadata,
|
|
7
|
-
// RULES_KEY,
|
|
8
|
-
// } from '..';
|
|
9
|
-
//
|
|
10
|
-
// export interface RuleOptions {
|
|
11
|
-
// required?: boolean;
|
|
12
|
-
// }
|
|
13
|
-
//
|
|
14
|
-
// export function Rule(rule, options: RuleOptions = { required: true }) {
|
|
15
|
-
// return function (...args) {
|
|
16
|
-
// if (args[1]) {
|
|
17
|
-
// // 函数装饰器
|
|
18
|
-
// const [target, propertyKey] = args;
|
|
19
|
-
// if (!joi.isSchema(rule)) {
|
|
20
|
-
// rule = getClassMetadata(RULES_KEY, rule);
|
|
21
|
-
// if (getPropertyType(target, propertyKey).name === 'Array') {
|
|
22
|
-
// rule = joi.array().items(rule);
|
|
23
|
-
// } else {
|
|
24
|
-
// rule = joi.object(rule);
|
|
25
|
-
// }
|
|
26
|
-
// if (options.required) {
|
|
27
|
-
// rule = rule.required();
|
|
28
|
-
// }
|
|
29
|
-
// }
|
|
30
|
-
//
|
|
31
|
-
// attachClassMetadata(RULES_KEY, rule, target, propertyKey);
|
|
32
|
-
// } else {
|
|
33
|
-
// //类的装饰器
|
|
34
|
-
// const rules = getClassMetadata(RULES_KEY, rule);
|
|
35
|
-
// if (rules) {
|
|
36
|
-
// let currentRule = getClassMetadata(RULES_KEY, args[0]);
|
|
37
|
-
// currentRule = currentRule ?? {};
|
|
38
|
-
// Object.keys(rules).map(item => {
|
|
39
|
-
// if (!currentRule[item]) {
|
|
40
|
-
// currentRule[item] = rules[item];
|
|
41
|
-
// }
|
|
42
|
-
// });
|
|
43
|
-
// saveClassMetadata(RULES_KEY, currentRule, args[0]);
|
|
44
|
-
// }
|
|
45
|
-
// }
|
|
46
|
-
// };
|
|
47
|
-
// }
|
|
48
|
-
//
|
|
49
|
-
// export { joi as RuleType };
|
|
50
|
-
//# sourceMappingURL=rule.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Schedule = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
const objectDef_1 = require("./objectDef");
|
|
6
|
-
function Schedule(scheduleOpts) {
|
|
7
|
-
return function (target) {
|
|
8
|
-
__1.saveModule(__1.SCHEDULE_KEY, target);
|
|
9
|
-
__1.saveClassMetadata(__1.SCHEDULE_KEY, scheduleOpts, target);
|
|
10
|
-
objectDef_1.Scope(__1.ScopeEnum.Request)(target);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
exports.Schedule = Schedule;
|
|
14
|
-
//# sourceMappingURL=schedule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// import { getClassMetadata, getMethodParamTypes, RULES_KEY } from '..';
|
|
2
|
-
// import { plainToClass } from 'class-transformer';
|
|
3
|
-
// import * as Joi from 'joi';
|
|
4
|
-
//
|
|
5
|
-
// export function Validate(isTransform = true) {
|
|
6
|
-
// return function (
|
|
7
|
-
// target,
|
|
8
|
-
// propertyKey: string | symbol,
|
|
9
|
-
// descriptor: PropertyDescriptor
|
|
10
|
-
// ) {
|
|
11
|
-
// const origin = descriptor.value;
|
|
12
|
-
// const paramTypes = getMethodParamTypes(target, propertyKey);
|
|
13
|
-
//
|
|
14
|
-
// descriptor.value = function (...args: any[]) {
|
|
15
|
-
// for (let i = 0; i < paramTypes.length; i++) {
|
|
16
|
-
// const item = paramTypes[i];
|
|
17
|
-
// const rules = getClassMetadata(RULES_KEY, item);
|
|
18
|
-
// if (rules) {
|
|
19
|
-
// const schema = Joi.object(rules);
|
|
20
|
-
// const result = schema.validate(args[i]);
|
|
21
|
-
// if (result.error) {
|
|
22
|
-
// throw result.error;
|
|
23
|
-
// } else {
|
|
24
|
-
// args[i] = result.value;
|
|
25
|
-
// }
|
|
26
|
-
// // passed
|
|
27
|
-
// if (isTransform) {
|
|
28
|
-
// args[i] = plainToClass(item, args[i]);
|
|
29
|
-
// }
|
|
30
|
-
// }
|
|
31
|
-
// }
|
|
32
|
-
// return origin.call(this, ...args);
|
|
33
|
-
// };
|
|
34
|
-
// };
|
|
35
|
-
// }
|
|
36
|
-
//# sourceMappingURL=validate.js.map
|