@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.
Files changed (108) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/constant.d.ts +7 -5
  3. package/dist/constant.js +18 -9
  4. package/dist/{annotation → decorator/common}/aspect.d.ts +0 -0
  5. package/dist/{annotation → decorator/common}/aspect.js +5 -4
  6. package/dist/{annotation → decorator/common}/autoload.d.ts +0 -0
  7. package/dist/decorator/common/autoload.js +13 -0
  8. package/dist/{annotation → decorator/common}/configuration.d.ts +0 -0
  9. package/dist/{annotation → decorator/common}/configuration.js +2 -2
  10. package/dist/{annotation → decorator/common}/decide.d.ts +0 -0
  11. package/dist/{annotation → decorator/common}/decide.js +0 -0
  12. package/dist/decorator/common/filter.d.ts +4 -0
  13. package/dist/decorator/common/filter.js +30 -0
  14. package/dist/decorator/common/framework.d.ts +2 -0
  15. package/dist/decorator/common/framework.js +13 -0
  16. package/dist/{annotation → decorator/common}/index.d.ts +6 -8
  17. package/dist/{annotation → decorator/common}/index.js +6 -10
  18. package/dist/decorator/common/inject.d.ts +3 -0
  19. package/dist/decorator/common/inject.js +11 -0
  20. package/dist/decorator/common/middleware.d.ts +2 -0
  21. package/dist/decorator/common/middleware.js +12 -0
  22. package/dist/decorator/common/objectDef.d.ts +5 -0
  23. package/dist/decorator/common/objectDef.js +25 -0
  24. package/dist/decorator/common/pipeline.d.ts +3 -0
  25. package/dist/decorator/common/pipeline.js +11 -0
  26. package/dist/decorator/common/provide.d.ts +3 -0
  27. package/dist/{annotation → decorator/common}/provide.js +2 -2
  28. package/dist/{faas/fun.d.ts → decorator/faas/serverlessTrigger.d.ts} +2 -14
  29. package/dist/decorator/faas/serverlessTrigger.js +29 -0
  30. package/dist/decorator/framework/index.d.ts +7 -0
  31. package/dist/decorator/framework/index.js +33 -0
  32. package/dist/{annotation → decorator/framework}/schedule.d.ts +0 -0
  33. package/dist/decorator/framework/schedule.js +15 -0
  34. package/dist/decorator/index.d.ts +18 -0
  35. package/dist/decorator/index.js +38 -0
  36. package/dist/{microservice → decorator/microservice}/consumer.d.ts +1 -1
  37. package/dist/decorator/microservice/consumer.js +17 -0
  38. package/dist/{microservice → decorator/microservice}/provider.d.ts +1 -1
  39. package/dist/{microservice → decorator/microservice}/provider.js +9 -8
  40. package/dist/{microservice → decorator/microservice}/rabbitmqListener.d.ts +0 -0
  41. package/dist/{microservice → decorator/microservice}/rabbitmqListener.js +2 -2
  42. package/dist/{rpc → decorator/rpc}/hsf.d.ts +0 -0
  43. package/dist/decorator/rpc/hsf.js +19 -0
  44. package/dist/decorator/task/queue.d.ts +2 -0
  45. package/dist/decorator/task/queue.js +17 -0
  46. package/dist/{annotation → decorator/task}/task.d.ts +0 -0
  47. package/dist/{annotation → decorator/task}/task.js +4 -4
  48. package/dist/{annotation → decorator/task}/taskLocal.d.ts +0 -0
  49. package/dist/{annotation → decorator/task}/taskLocal.js +4 -4
  50. package/dist/{web → decorator/web}/controller.d.ts +3 -1
  51. package/dist/{web → decorator/web}/controller.js +6 -5
  52. package/dist/{web → decorator/web}/paramMapping.d.ts +10 -10
  53. package/dist/{web → decorator/web}/paramMapping.js +4 -8
  54. package/dist/{web → decorator/web}/requestMapping.d.ts +34 -1
  55. package/dist/{web → decorator/web}/requestMapping.js +5 -3
  56. package/dist/{web → decorator/web}/response.d.ts +0 -0
  57. package/dist/{web → decorator/web}/response.js +6 -6
  58. package/dist/{ws → decorator/ws}/webSocketController.d.ts +1 -1
  59. package/dist/decorator/ws/webSocketController.js +18 -0
  60. package/dist/{ws → decorator/ws}/webSocketEvent.d.ts +1 -1
  61. package/dist/{ws → decorator/ws}/webSocketEvent.js +7 -7
  62. package/dist/decoratorManager.d.ts +288 -0
  63. package/dist/{common/decoratorManager.js → decoratorManager.js} +248 -288
  64. package/dist/index.d.ts +2 -21
  65. package/dist/index.js +2 -21
  66. package/dist/interface.d.ts +40 -23
  67. package/dist/interface.js +31 -17
  68. package/dist/util/index.d.ts +5 -0
  69. package/dist/util/index.js +27 -1
  70. package/package.json +3 -6
  71. package/dist/annotation/autoload.js +0 -11
  72. package/dist/annotation/inject.d.ts +0 -3
  73. package/dist/annotation/inject.js +0 -16
  74. package/dist/annotation/objectDef.d.ts +0 -7
  75. package/dist/annotation/objectDef.js +0 -43
  76. package/dist/annotation/pipeline.d.ts +0 -3
  77. package/dist/annotation/pipeline.js +0 -27
  78. package/dist/annotation/priority.d.ts +0 -2
  79. package/dist/annotation/priority.js +0 -11
  80. package/dist/annotation/provide.d.ts +0 -3
  81. package/dist/annotation/queue.d.ts +0 -2
  82. package/dist/annotation/queue.js +0 -16
  83. package/dist/annotation/rule.d.ts +0 -1
  84. package/dist/annotation/rule.js +0 -50
  85. package/dist/annotation/schedule.js +0 -14
  86. package/dist/annotation/validate.d.ts +0 -1
  87. package/dist/annotation/validate.js +0 -36
  88. package/dist/common/decoratorManager.d.ts +0 -317
  89. package/dist/common/errMsg.d.ts +0 -4
  90. package/dist/common/errMsg.js +0 -8
  91. package/dist/common/metadata.d.ts +0 -9
  92. package/dist/common/metadata.js +0 -20
  93. package/dist/common/scopeEnum.d.ts +0 -6
  94. package/dist/common/scopeEnum.js +0 -10
  95. package/dist/faas/fun.js +0 -62
  96. package/dist/faas/handler.d.ts +0 -3
  97. package/dist/faas/handler.js +0 -21
  98. package/dist/framework/app.d.ts +0 -3
  99. package/dist/framework/app.js +0 -22
  100. package/dist/framework/config.d.ts +0 -2
  101. package/dist/framework/config.js +0 -25
  102. package/dist/framework/logger.d.ts +0 -2
  103. package/dist/framework/logger.js +0 -22
  104. package/dist/framework/plugin.d.ts +0 -2
  105. package/dist/framework/plugin.js +0 -22
  106. package/dist/microservice/consumer.js +0 -17
  107. package/dist/rpc/hsf.js +0 -18
  108. 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 './common/decoratorManager';
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("./common/decoratorManager"), exports);
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
@@ -1,8 +1,11 @@
1
- import { ScopeEnum } from './common/scopeEnum';
2
- import { Middleware } from 'koa';
3
- import { RequestHandler } from 'express';
4
- export declare type MiddlewareParamArray = Array<Middleware | RequestHandler | string>;
5
- export declare type ObjectIdentifier = string;
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?: IManagedInstance[];
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]: TagPropsMetadata[];
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 enum MidwayFrameworkType {
182
- WEB = "@midwayjs/web",
183
- WEB_KOA = "@midwayjs/koa",
184
- WEB_EXPRESS = "@midwayjs/express",
185
- FAAS = "@midwayjs/faas",
186
- MS_HSF = "",
187
- MS_GRPC = "@midwayjs/grpc",
188
- MS_RABBITMQ = "@midwayjs/rabbitmq",
189
- WS_IO = "@midwayjs/socketio",
190
- WS = "@midwayjs/ws",
191
- SERVERLESS_APP = "@midwayjs/serverless-app",
192
- CUSTOM = "",
193
- EMPTY = "empty",
194
- LIGHT = "light"
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
- var MidwayFrameworkType;
18
- (function (MidwayFrameworkType) {
19
- MidwayFrameworkType["WEB"] = "@midwayjs/web";
20
- MidwayFrameworkType["WEB_KOA"] = "@midwayjs/koa";
21
- MidwayFrameworkType["WEB_EXPRESS"] = "@midwayjs/express";
22
- MidwayFrameworkType["FAAS"] = "@midwayjs/faas";
23
- MidwayFrameworkType["MS_HSF"] = "";
24
- MidwayFrameworkType["MS_GRPC"] = "@midwayjs/grpc";
25
- MidwayFrameworkType["MS_RABBITMQ"] = "@midwayjs/rabbitmq";
26
- MidwayFrameworkType["WS_IO"] = "@midwayjs/socketio";
27
- MidwayFrameworkType["WS"] = "@midwayjs/ws";
28
- MidwayFrameworkType["SERVERLESS_APP"] = "@midwayjs/serverless-app";
29
- MidwayFrameworkType["CUSTOM"] = "";
30
- MidwayFrameworkType["EMPTY"] = "empty";
31
- MidwayFrameworkType["LIGHT"] = "light";
32
- })(MidwayFrameworkType = exports.MidwayFrameworkType || (exports.MidwayFrameworkType = {}));
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";
@@ -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
@@ -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-alpha.6+6c8b724b",
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": ">= 10.0.0"
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": "6c8b724b08cf395287636b80387653f9540768e5"
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,3 +0,0 @@
1
- import { ObjectIdentifier } from '../interface';
2
- export declare function Inject(identifier?: ObjectIdentifier): (target: any, targetKey: string, index?: number) => void;
3
- //# sourceMappingURL=inject.d.ts.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,3 +0,0 @@
1
- import { ObjectIdentifier } from '../interface';
2
- export declare function Pipeline(valves?: ObjectIdentifier[]): (target: any, targetKey: string, index?: number) => void;
3
- //# sourceMappingURL=pipeline.d.ts.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,2 +0,0 @@
1
- export declare function Priority(priority: number): ClassDecorator;
2
- //# sourceMappingURL=priority.d.ts.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
@@ -1,3 +0,0 @@
1
- import { ObjectIdentifier } from '../interface';
2
- export declare function Provide(identifier?: ObjectIdentifier): (target: any) => any;
3
- //# sourceMappingURL=provide.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function Queue(options?: any): (target: any) => void;
2
- //# sourceMappingURL=queue.d.ts.map
@@ -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
@@ -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