@midwayjs/core 3.19.0 → 4.0.0-alpha.1

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 (134) hide show
  1. package/dist/baseFramework.d.ts +7 -35
  2. package/dist/baseFramework.js +10 -52
  3. package/dist/common/applicationManager.d.ts +6 -6
  4. package/dist/common/applicationManager.js +18 -35
  5. package/dist/common/asyncContextManager.d.ts +15 -0
  6. package/dist/common/asyncContextManager.js +51 -2
  7. package/dist/common/dataListener.js +1 -1
  8. package/dist/common/dataSourceManager.js +3 -4
  9. package/dist/common/fileDetector.d.ts +9 -9
  10. package/dist/common/fileDetector.js +30 -28
  11. package/dist/common/filterManager.js +5 -4
  12. package/dist/common/guardManager.js +3 -2
  13. package/dist/common/middlewareManager.js +4 -3
  14. package/dist/common/performanceManager.js +1 -1
  15. package/dist/common/priorityManager.js +2 -2
  16. package/dist/common/serviceFactory.js +1 -1
  17. package/dist/common/webGenerator.js +4 -6
  18. package/dist/config/config.default.js +1 -1
  19. package/dist/constants.d.ts +2 -32
  20. package/dist/constants.js +3 -33
  21. package/dist/context/componentLoader.d.ts +20 -0
  22. package/dist/context/componentLoader.js +193 -0
  23. package/dist/context/container.d.ts +14 -29
  24. package/dist/context/container.js +68 -306
  25. package/dist/context/definitionRegistry.d.ts +3 -0
  26. package/dist/context/definitionRegistry.js +8 -15
  27. package/dist/context/managedResolverFactory.d.ts +15 -40
  28. package/dist/context/managedResolverFactory.js +263 -348
  29. package/dist/context/requestContainer.d.ts +22 -12
  30. package/dist/context/requestContainer.js +43 -51
  31. package/dist/decorator/common/aspect.js +4 -4
  32. package/dist/decorator/common/autoload.js +1 -1
  33. package/dist/decorator/common/configuration.d.ts +1 -24
  34. package/dist/decorator/common/configuration.js +6 -1
  35. package/dist/decorator/common/filter.js +6 -6
  36. package/dist/decorator/common/framework.d.ts +46 -3
  37. package/dist/decorator/common/framework.js +43 -9
  38. package/dist/decorator/common/guard.js +4 -9
  39. package/dist/decorator/common/inject.d.ts +4 -2
  40. package/dist/decorator/common/inject.js +87 -4
  41. package/dist/decorator/common/mock.js +1 -1
  42. package/dist/decorator/common/objectDef.d.ts +0 -5
  43. package/dist/decorator/common/objectDef.js +8 -20
  44. package/dist/decorator/common/provide.d.ts +1 -1
  45. package/dist/decorator/common/provide.js +1 -1
  46. package/dist/decorator/common/scope.d.ts +6 -0
  47. package/dist/decorator/common/scope.js +21 -0
  48. package/dist/decorator/constant.d.ts +14 -17
  49. package/dist/decorator/constant.js +23 -35
  50. package/dist/decorator/decoratorManager.d.ts +21 -294
  51. package/dist/decorator/decoratorManager.js +127 -694
  52. package/dist/decorator/faas/serverlessTrigger.js +5 -5
  53. package/dist/decorator/index.d.ts +2 -3
  54. package/dist/decorator/index.js +6 -4
  55. package/dist/decorator/metadataManager.d.ts +127 -0
  56. package/dist/decorator/metadataManager.js +465 -0
  57. package/dist/decorator/microservice/consumer.js +3 -2
  58. package/dist/decorator/microservice/kafkaListener.js +2 -1
  59. package/dist/decorator/microservice/provider.js +6 -5
  60. package/dist/decorator/microservice/rabbitmqListener.js +2 -1
  61. package/dist/decorator/task/queue.js +3 -2
  62. package/dist/decorator/task/schedule.js +3 -2
  63. package/dist/decorator/task/task.js +4 -3
  64. package/dist/decorator/task/taskLocal.js +4 -3
  65. package/dist/decorator/web/controller.js +3 -2
  66. package/dist/decorator/web/paramMapping.js +2 -2
  67. package/dist/decorator/web/requestMapping.js +5 -5
  68. package/dist/decorator/web/response.js +6 -5
  69. package/dist/decorator/ws/webSocketController.js +3 -2
  70. package/dist/decorator/ws/webSocketEvent.js +7 -6
  71. package/dist/definitions/functionDefinition.d.ts +3 -3
  72. package/dist/definitions/functionDefinition.js +12 -11
  73. package/dist/definitions/objectCreator.d.ts +5 -11
  74. package/dist/definitions/objectCreator.js +3 -27
  75. package/dist/definitions/objectDefinition.d.ts +2 -3
  76. package/dist/definitions/objectDefinition.js +1 -3
  77. package/dist/error/base.js +2 -2
  78. package/dist/error/framework.d.ts +1 -8
  79. package/dist/error/framework.js +9 -25
  80. package/dist/error/http.js +1 -1
  81. package/dist/functional/configuration.d.ts +14 -15
  82. package/dist/functional/configuration.js +37 -47
  83. package/dist/functional/hooks.d.ts +10 -0
  84. package/dist/functional/hooks.js +68 -0
  85. package/dist/functional/index.d.ts +3 -0
  86. package/dist/functional/index.js +22 -0
  87. package/dist/index.d.ts +3 -3
  88. package/dist/index.js +3 -6
  89. package/dist/interface.d.ts +80 -114
  90. package/dist/interface.js +9 -33
  91. package/dist/legacy/constants.d.ts +29 -0
  92. package/dist/legacy/constants.js +33 -0
  93. package/dist/legacy/decorator.d.ts +255 -0
  94. package/dist/legacy/decorator.js +468 -0
  95. package/dist/legacy/index.d.ts +3 -0
  96. package/dist/legacy/index.js +19 -0
  97. package/dist/legacy/types.d.ts +2 -0
  98. package/dist/legacy/types.js +3 -0
  99. package/dist/response/base.d.ts +1 -0
  100. package/dist/response/http.d.ts +1 -0
  101. package/dist/service/aspectService.js +11 -12
  102. package/dist/service/configService.js +2 -2
  103. package/dist/service/decoratorService.d.ts +3 -3
  104. package/dist/service/decoratorService.js +14 -10
  105. package/dist/service/environmentService.js +2 -2
  106. package/dist/service/frameworkService.d.ts +5 -4
  107. package/dist/service/frameworkService.js +30 -28
  108. package/dist/service/healthService.js +4 -4
  109. package/dist/service/informationService.js +3 -4
  110. package/dist/service/lifeCycleService.js +6 -17
  111. package/dist/service/loggerService.js +3 -4
  112. package/dist/service/middlewareService.js +7 -8
  113. package/dist/service/mockService.js +9 -15
  114. package/dist/service/slsFunctionService.d.ts +1 -14
  115. package/dist/service/slsFunctionService.js +33 -81
  116. package/dist/service/webRouterService.js +11 -11
  117. package/dist/setup.d.ts +5 -5
  118. package/dist/setup.js +75 -93
  119. package/dist/util/contextUtil.d.ts +2 -2
  120. package/dist/util/httpclient.d.ts +3 -2
  121. package/dist/util/index.d.ts +14 -0
  122. package/dist/util/index.js +159 -25
  123. package/dist/util/pathFileUtil.d.ts +14 -1
  124. package/dist/util/pathFileUtil.js +27 -6
  125. package/dist/util/webRouterParam.js +2 -2
  126. package/package.json +24 -6
  127. package/dist/decorator/common/pipeline.d.ts +0 -3
  128. package/dist/decorator/common/pipeline.js +0 -12
  129. package/dist/decorator/rpc/hsf.d.ts +0 -13
  130. package/dist/decorator/rpc/hsf.js +0 -20
  131. package/dist/definitions/properties.d.ts +0 -7
  132. package/dist/definitions/properties.js +0 -19
  133. package/dist/service/pipelineService.d.ts +0 -168
  134. package/dist/service/pipelineService.js +0 -254
@@ -0,0 +1,255 @@
1
+ import { MethodDecoratorOptions, ObjectDefinitionOptions, ObjectIdentifier, ParamDecoratorOptions, TagPropsMetadata } from '../interface';
2
+ /**
3
+ * save data to class
4
+ * @param decoratorNameKey
5
+ * @param data
6
+ * @param target
7
+ * @param mergeIfExist
8
+ * @since 2.3.0
9
+ * @deprecated Use MetadataManager.defineMetadata instead
10
+ */
11
+ export declare function saveClassMetadata(decoratorNameKey: ObjectIdentifier, data: any, target: any, mergeIfExist?: boolean): void;
12
+ /**
13
+ * attach data to class
14
+ * @param decoratorNameKey
15
+ * @param data
16
+ * @param target
17
+ * @param groupBy
18
+ * @since 2.3.0
19
+ * @deprecated Use MetadataManager.attachMetadata instead
20
+ */
21
+ export declare function attachClassMetadata(decoratorNameKey: ObjectIdentifier, data: any, target: any, groupBy?: string): void;
22
+ /**
23
+ * get data from class and proto
24
+ * @param decoratorNameKey
25
+ * @param target
26
+ * @param propertyName
27
+ * @param useCache
28
+ * @since 2.3.0
29
+ * @deprecated Use MetadataManager.getMetadata instead
30
+ */
31
+ export declare function getClassExtendedMetadata<T = any>(decoratorNameKey: ObjectIdentifier, target: any, propertyName?: string, useCache?: boolean): T;
32
+ /**
33
+ * get data from class
34
+ * @param decoratorNameKey
35
+ * @param target
36
+ * @since 2.3.0
37
+ * @deprecated Use MetadataManager.getOwnMetadata instead
38
+ */
39
+ export declare function getClassMetadata<T = any>(decoratorNameKey: ObjectIdentifier, target: any): T;
40
+ /**
41
+ * save property data to class
42
+ * @param decoratorNameKey
43
+ * @param data
44
+ * @param target
45
+ * @param propertyName
46
+ * @since 2.3.0
47
+ * @deprecated Use MetadataManager.defineMetadata instead
48
+ */
49
+ export declare function savePropertyDataToClass(decoratorNameKey: ObjectIdentifier, data: any, target: any, propertyName: any): void;
50
+ /**
51
+ * attach property data to class
52
+ * @param decoratorNameKey
53
+ * @param data
54
+ * @param target
55
+ * @param propertyName
56
+ * @since 2.3.0
57
+ * @deprecated
58
+ */
59
+ export declare function attachPropertyDataToClass(decoratorNameKey: ObjectIdentifier, data: any, target: any, propertyName: any): void;
60
+ /**
61
+ * get property data from class
62
+ * @param decoratorNameKey
63
+ * @param target
64
+ * @param propertyName
65
+ * @since 2.3.0
66
+ * @deprecated Use MetadataManager.getOwnMetadata instead
67
+ */
68
+ export declare function getPropertyDataFromClass<T = any>(decoratorNameKey: ObjectIdentifier, target: any, propertyName: any): T;
69
+ /**
70
+ * list property data from class
71
+ * @param decoratorNameKey
72
+ * @param target
73
+ * @since 2.3.0
74
+ * @deprecated
75
+ */
76
+ export declare function listPropertyDataFromClass(decoratorNameKey: ObjectIdentifier, target: any): any[];
77
+ /**
78
+ * save property data
79
+ * @param decoratorNameKey
80
+ * @param data
81
+ * @param target
82
+ * @param propertyName
83
+ * @since 2.3.0
84
+ * @deprecated Use MetadataManager.defineMetadata instead
85
+ */
86
+ export declare function savePropertyMetadata(decoratorNameKey: ObjectIdentifier, data: any, target: any, propertyName: any): void;
87
+ /**
88
+ * attach property data
89
+ * @param decoratorNameKey
90
+ * @param data
91
+ * @param target
92
+ * @param propertyName
93
+ * @since 2.3.0
94
+ * @deprecated
95
+ */
96
+ export declare function attachPropertyMetadata(decoratorNameKey: ObjectIdentifier, data: any, target: any, propertyName: any): void;
97
+ /**
98
+ * get property data
99
+ * @param decoratorNameKey
100
+ * @param target
101
+ * @param propertyName
102
+ * @since 2.3.0
103
+ * @deprecated Use MetadataManager.getOwnMetadata instead
104
+ */
105
+ export declare function getPropertyMetadata<T = any>(decoratorNameKey: ObjectIdentifier, target: any, propertyName: any): T;
106
+ /**
107
+ * save preload module by target
108
+ * @param target
109
+ * @since 2.0.0
110
+ * @deprecated Use DecoratorManager.savePreStartModule instead
111
+ */
112
+ export declare function savePreloadModule(target: any): void;
113
+ /**
114
+ * list preload module
115
+ * @since 2.0.0
116
+ * @deprecated Use DecoratorManager.listPreStartModule instead
117
+ */
118
+ export declare function listPreloadModule(): any[];
119
+ /**
120
+ * save module to inner map
121
+ * @param decoratorNameKey
122
+ * @param target
123
+ * @since 2.0.0
124
+ * @deprecated Use DecoratorManager.saveModule instead
125
+ */
126
+ export declare function saveModule(decoratorNameKey: ObjectIdentifier, target: any): void;
127
+ /**
128
+ * list module from decorator key
129
+ * @param decoratorNameKey
130
+ * @param filter
131
+ * @since 2.0.0
132
+ * @deprecated Use DecoratorManager.listModule instead
133
+ */
134
+ export declare function listModule(decoratorNameKey: ObjectIdentifier, filter?: (module: any) => boolean): any[];
135
+ /**
136
+ * reset module
137
+ * @param decoratorNameKey
138
+ * @since 2.0.0
139
+ * @deprecated Use DecoratorManager.resetModule instead
140
+ */
141
+ export declare function resetModule(decoratorNameKey: ObjectIdentifier): void;
142
+ /**
143
+ * clear all module
144
+ * @since 3.0.0
145
+ * @deprecated Use DecoratorManager.clearAllModule instead
146
+ */
147
+ export declare function clearAllModule(): void;
148
+ /**
149
+ * class provider id
150
+ * @since 2.3.0
151
+ * @deprecated Use DecoratorManager.saveProviderId instead
152
+ */
153
+ export declare function saveProviderId(identifier: ObjectIdentifier, target: any): import("../interface").ClassType;
154
+ /**
155
+ * get provider id from module
156
+ * @since 3.0.0
157
+ * @deprecated Use DecoratorManager.getProviderId instead
158
+ */
159
+ export declare function getProviderId(module: any): string;
160
+ /**
161
+ * @since 3.0.0
162
+ * @deprecated Use DecoratorManager.getProviderName instead
163
+ */
164
+ export declare function getProviderName(module: any): string;
165
+ /**
166
+ * get provider uuid from module
167
+ * @since 3.0.0
168
+ * @deprecated Use DecoratorManager.getProviderUUId instead
169
+ */
170
+ export declare function getProviderUUId(module: any): string;
171
+ /**
172
+ * use @Provide decorator or not
173
+ * @since 3.0.0
174
+ * @deprecated Use DecoratorManager.isProvide instead
175
+ */
176
+ export declare function isProvide(target: any): boolean;
177
+ /**
178
+ * Create a custom property inject
179
+ * @param decoratorKey
180
+ * @param metadata
181
+ * @param impl default true, configuration need decoratorService.registerMethodHandler
182
+ * @since 3.0.0
183
+ * @deprecated Use DecoratorManager.createCustomPropertyDecorator instead
184
+ */
185
+ export declare function createCustomPropertyDecorator(decoratorKey: string, metadata: any, impl?: boolean): PropertyDecorator;
186
+ /**
187
+ * Create a custom method decorator
188
+ * @param decoratorKey
189
+ * @param metadata
190
+ * @param implOrOptions
191
+ * @since 3.0.0
192
+ * @deprecated Use DecoratorManager.createCustomMethodDecorator instead
193
+ */
194
+ export declare function createCustomMethodDecorator(decoratorKey: string, metadata: any, implOrOptions?: boolean | MethodDecoratorOptions): MethodDecorator;
195
+ /**
196
+ * Create a custom param decorator
197
+ * @param decoratorKey
198
+ * @param metadata
199
+ * @param implOrOptions
200
+ * @since 3.0.0
201
+ * @deprecated Use DecoratorManager.createCustomParamDecorator instead
202
+ */
203
+ export declare function createCustomParamDecorator(decoratorKey: string, metadata: any, implOrOptions?: boolean | ParamDecoratorOptions): ParameterDecorator;
204
+ /**
205
+ * get property(method) type from metadata
206
+ * @param target
207
+ * @param methodName
208
+ * @since 3.0.0
209
+ * @deprecated Use MetadataManager.getPropertyType instead
210
+ */
211
+ export declare function getPropertyType(target: any, methodName: string | symbol): import("../interface").TSDesignType<unknown>;
212
+ /**
213
+ * get parameters type by reflect-metadata
214
+ * @since 3.0.0
215
+ * @deprecated Use MetadataManager.getMethodParamTypes instead
216
+ */
217
+ export declare function getMethodParamTypes(target: any, methodName: string | symbol): any;
218
+ /**
219
+ * save property inject args
220
+ * @param opts 参数
221
+ * @since 2.3.0
222
+ * @deprecated Use MetadataManager.attachMetadata instead
223
+ */
224
+ export declare function savePropertyInject(opts: {
225
+ identifier: ObjectIdentifier;
226
+ target: any;
227
+ targetKey: string;
228
+ args?: any;
229
+ }): void;
230
+ /**
231
+ * get property inject args
232
+ * @param target
233
+ * @param useCache
234
+ * @since 2.3.0
235
+ * @deprecated Use MetadataManager.getMetadata instead
236
+ */
237
+ export declare function getPropertyInject(target: any, useCache?: boolean): {
238
+ [methodName: string]: TagPropsMetadata;
239
+ };
240
+ /**
241
+ * save class object definition
242
+ * @param target class
243
+ * @param props property data
244
+ * @since 2.3.0
245
+ * @deprecated Use MetadataManager.attachMetadata instead
246
+ */
247
+ export declare function saveObjectDefinition(target: any, props?: {}): any;
248
+ /**
249
+ * get class object definition from metadata
250
+ * @param target
251
+ * @since 2.3.0
252
+ * @deprecated Use MetadataManager.getPropertiesWithMetadata instead
253
+ */
254
+ export declare function getObjectDefinition(target: any): ObjectDefinitionOptions;
255
+ //# sourceMappingURL=decorator.d.ts.map