@tsed/di 8.0.0-alpha.1 → 8.0.0-alpha.11

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 (251) hide show
  1. package/lib/browser/di.umd.min.js +1 -1
  2. package/lib/browser/di.umd.min.js.map +1 -1
  3. package/lib/esm/common/decorators/autoInjectable.js.map +1 -1
  4. package/lib/esm/common/decorators/configuration.js.map +1 -1
  5. package/lib/esm/common/decorators/constant.js.map +1 -1
  6. package/lib/esm/common/decorators/controller.js.map +1 -1
  7. package/lib/esm/common/decorators/inject.js +1 -1
  8. package/lib/esm/common/decorators/inject.js.map +1 -1
  9. package/lib/esm/common/decorators/intercept.js.map +1 -1
  10. package/lib/esm/common/decorators/lazyInject.js.map +1 -1
  11. package/lib/esm/common/decorators/module.js +1 -1
  12. package/lib/esm/common/decorators/module.js.map +1 -1
  13. package/lib/esm/common/decorators/opts.js.map +1 -1
  14. package/lib/esm/common/decorators/overrideProvider.js.map +1 -1
  15. package/lib/esm/common/decorators/scope.js.map +1 -1
  16. package/lib/esm/common/decorators/useOpts.js +1 -1
  17. package/lib/esm/common/decorators/useOpts.js.map +1 -1
  18. package/lib/esm/common/decorators/value.js.map +1 -1
  19. package/lib/esm/common/domain/Container.js.map +1 -1
  20. package/lib/esm/common/domain/LocalsContainer.js.map +1 -1
  21. package/lib/esm/common/domain/Provider.js.map +1 -1
  22. package/lib/esm/common/errors/InjectionError.js.map +1 -1
  23. package/lib/esm/common/registries/GlobalProviders.js +1 -5
  24. package/lib/esm/common/registries/GlobalProviders.js.map +1 -1
  25. package/lib/esm/common/registries/ProviderRegistry.js.map +1 -1
  26. package/lib/esm/common/services/DIConfiguration.js.map +1 -1
  27. package/lib/esm/common/services/InjectorService.js.map +1 -1
  28. package/lib/esm/common/utils/createContainer.js.map +1 -1
  29. package/lib/esm/common/utils/resolveControllers.js +1 -1
  30. package/lib/esm/common/utils/resolveControllers.js.map +1 -1
  31. package/lib/esm/node/decorators/injectContext.js +2 -2
  32. package/lib/esm/node/decorators/injectContext.js.map +1 -1
  33. package/lib/esm/node/domain/ContextLogger.js +2 -2
  34. package/lib/esm/node/domain/ContextLogger.js.map +1 -1
  35. package/lib/esm/node/domain/DIContext.js.map +1 -1
  36. package/lib/esm/node/services/DILogger.js.map +1 -1
  37. package/lib/esm/node/services/DITest.js +1 -1
  38. package/lib/esm/node/services/DITest.js.map +1 -1
  39. package/lib/esm/node/utils/asyncHookContext.js +3 -2
  40. package/lib/esm/node/utils/asyncHookContext.js.map +1 -1
  41. package/lib/esm/node/utils/setLoggerFormat.js.map +1 -1
  42. package/lib/esm/node/utils/setLoggerLevel.js.map +1 -1
  43. package/lib/types/common/decorators/module.d.ts +1 -1
  44. package/lib/types/common/domain/Container.d.ts +1 -1
  45. package/lib/types/common/domain/Provider.d.ts +1 -1
  46. package/lib/types/common/interfaces/ProviderOpts.d.ts +1 -1
  47. package/lib/types/common/interfaces/TokenProvider.d.ts +1 -1
  48. package/lib/types/node/decorators/injectContext.d.ts +2 -1
  49. package/lib/types/node/domain/ContextLogger.d.ts +3 -3
  50. package/lib/types/node/domain/DIContext.d.ts +1 -1
  51. package/lib/types/node/utils/asyncHookContext.d.ts +4 -3
  52. package/package.json +17 -18
  53. package/vitest.config.mts +4 -4
  54. package/lib/cjs/common/constants/constants.js +0 -9
  55. package/lib/cjs/common/constants/constants.js.map +0 -1
  56. package/lib/cjs/common/decorators/autoInjectable.js +0 -38
  57. package/lib/cjs/common/decorators/autoInjectable.js.map +0 -1
  58. package/lib/cjs/common/decorators/configuration.js +0 -24
  59. package/lib/cjs/common/decorators/configuration.js.map +0 -1
  60. package/lib/cjs/common/decorators/constant.js +0 -74
  61. package/lib/cjs/common/decorators/constant.js.map +0 -1
  62. package/lib/cjs/common/decorators/controller.js +0 -53
  63. package/lib/cjs/common/decorators/controller.js.map +0 -1
  64. package/lib/cjs/common/decorators/inject.js +0 -84
  65. package/lib/cjs/common/decorators/inject.js.map +0 -1
  66. package/lib/cjs/common/decorators/injectable.js +0 -32
  67. package/lib/cjs/common/decorators/injectable.js.map +0 -1
  68. package/lib/cjs/common/decorators/intercept.js +0 -65
  69. package/lib/cjs/common/decorators/intercept.js.map +0 -1
  70. package/lib/cjs/common/decorators/interceptor.js +0 -21
  71. package/lib/cjs/common/decorators/interceptor.js.map +0 -1
  72. package/lib/cjs/common/decorators/lazyInject.js +0 -71
  73. package/lib/cjs/common/decorators/lazyInject.js.map +0 -1
  74. package/lib/cjs/common/decorators/module.js +0 -32
  75. package/lib/cjs/common/decorators/module.js.map +0 -1
  76. package/lib/cjs/common/decorators/opts.js +0 -54
  77. package/lib/cjs/common/decorators/opts.js.map +0 -1
  78. package/lib/cjs/common/decorators/overrideProvider.js +0 -17
  79. package/lib/cjs/common/decorators/overrideProvider.js.map +0 -1
  80. package/lib/cjs/common/decorators/scope.js +0 -16
  81. package/lib/cjs/common/decorators/scope.js.map +0 -1
  82. package/lib/cjs/common/decorators/service.js +0 -18
  83. package/lib/cjs/common/decorators/service.js.map +0 -1
  84. package/lib/cjs/common/decorators/useOpts.js +0 -61
  85. package/lib/cjs/common/decorators/useOpts.js.map +0 -1
  86. package/lib/cjs/common/decorators/value.js +0 -62
  87. package/lib/cjs/common/decorators/value.js.map +0 -1
  88. package/lib/cjs/common/domain/Container.js +0 -72
  89. package/lib/cjs/common/domain/Container.js.map +0 -1
  90. package/lib/cjs/common/domain/ControllerProvider.js +0 -36
  91. package/lib/cjs/common/domain/ControllerProvider.js.map +0 -1
  92. package/lib/cjs/common/domain/InjectablePropertyType.js +0 -12
  93. package/lib/cjs/common/domain/InjectablePropertyType.js.map +0 -1
  94. package/lib/cjs/common/domain/LocalsContainer.js +0 -15
  95. package/lib/cjs/common/domain/LocalsContainer.js.map +0 -1
  96. package/lib/cjs/common/domain/Provider.js +0 -134
  97. package/lib/cjs/common/domain/Provider.js.map +0 -1
  98. package/lib/cjs/common/domain/ProviderScope.js +0 -10
  99. package/lib/cjs/common/domain/ProviderScope.js.map +0 -1
  100. package/lib/cjs/common/domain/ProviderType.js +0 -15
  101. package/lib/cjs/common/domain/ProviderType.js.map +0 -1
  102. package/lib/cjs/common/errors/InjectionError.js +0 -58
  103. package/lib/cjs/common/errors/InjectionError.js.map +0 -1
  104. package/lib/cjs/common/errors/InvalidPropertyTokenError.js +0 -12
  105. package/lib/cjs/common/errors/InvalidPropertyTokenError.js.map +0 -1
  106. package/lib/cjs/common/index.js +0 -58
  107. package/lib/cjs/common/index.js.map +0 -1
  108. package/lib/cjs/common/interfaces/DIConfigurationOptions.js +0 -3
  109. package/lib/cjs/common/interfaces/DIConfigurationOptions.js.map +0 -1
  110. package/lib/cjs/common/interfaces/DILogger.js +0 -3
  111. package/lib/cjs/common/interfaces/DILogger.js.map +0 -1
  112. package/lib/cjs/common/interfaces/DILoggerOptions.js +0 -3
  113. package/lib/cjs/common/interfaces/DILoggerOptions.js.map +0 -1
  114. package/lib/cjs/common/interfaces/DIResolver.js +0 -3
  115. package/lib/cjs/common/interfaces/DIResolver.js.map +0 -1
  116. package/lib/cjs/common/interfaces/ImportTokenProviderOpts.js +0 -3
  117. package/lib/cjs/common/interfaces/ImportTokenProviderOpts.js.map +0 -1
  118. package/lib/cjs/common/interfaces/InterceptorContext.js +0 -3
  119. package/lib/cjs/common/interfaces/InterceptorContext.js.map +0 -1
  120. package/lib/cjs/common/interfaces/InterceptorMethods.js +0 -3
  121. package/lib/cjs/common/interfaces/InterceptorMethods.js.map +0 -1
  122. package/lib/cjs/common/interfaces/InvokeOptions.js +0 -3
  123. package/lib/cjs/common/interfaces/InvokeOptions.js.map +0 -1
  124. package/lib/cjs/common/interfaces/OnDestroy.js +0 -3
  125. package/lib/cjs/common/interfaces/OnDestroy.js.map +0 -1
  126. package/lib/cjs/common/interfaces/OnInit.js +0 -3
  127. package/lib/cjs/common/interfaces/OnInit.js.map +0 -1
  128. package/lib/cjs/common/interfaces/ProviderOpts.js +0 -3
  129. package/lib/cjs/common/interfaces/ProviderOpts.js.map +0 -1
  130. package/lib/cjs/common/interfaces/RegistrySettings.js +0 -3
  131. package/lib/cjs/common/interfaces/RegistrySettings.js.map +0 -1
  132. package/lib/cjs/common/interfaces/ResolvedInvokeOptions.js +0 -3
  133. package/lib/cjs/common/interfaces/ResolvedInvokeOptions.js.map +0 -1
  134. package/lib/cjs/common/interfaces/TokenProvider.js +0 -3
  135. package/lib/cjs/common/interfaces/TokenProvider.js.map +0 -1
  136. package/lib/cjs/common/interfaces/TokenRoute.js +0 -3
  137. package/lib/cjs/common/interfaces/TokenRoute.js.map +0 -1
  138. package/lib/cjs/common/registries/GlobalProviders.js +0 -121
  139. package/lib/cjs/common/registries/GlobalProviders.js.map +0 -1
  140. package/lib/cjs/common/registries/ProviderRegistry.js +0 -86
  141. package/lib/cjs/common/registries/ProviderRegistry.js.map +0 -1
  142. package/lib/cjs/common/services/DIConfiguration.js +0 -142
  143. package/lib/cjs/common/services/DIConfiguration.js.map +0 -1
  144. package/lib/cjs/common/services/DILogger.js +0 -14
  145. package/lib/cjs/common/services/DILogger.js.map +0 -1
  146. package/lib/cjs/common/services/InjectorService.js +0 -536
  147. package/lib/cjs/common/services/InjectorService.js.map +0 -1
  148. package/lib/cjs/common/utils/colors.js +0 -10
  149. package/lib/cjs/common/utils/colors.js.map +0 -1
  150. package/lib/cjs/common/utils/createContainer.js +0 -14
  151. package/lib/cjs/common/utils/createContainer.js.map +0 -1
  152. package/lib/cjs/common/utils/getConfiguration.js +0 -23
  153. package/lib/cjs/common/utils/getConfiguration.js.map +0 -1
  154. package/lib/cjs/common/utils/getConstructorDependencies.js +0 -13
  155. package/lib/cjs/common/utils/getConstructorDependencies.js.map +0 -1
  156. package/lib/cjs/common/utils/resolveControllers.js +0 -47
  157. package/lib/cjs/common/utils/resolveControllers.js.map +0 -1
  158. package/lib/cjs/index.js +0 -6
  159. package/lib/cjs/index.js.map +0 -1
  160. package/lib/cjs/node/decorators/injectContext.js +0 -39
  161. package/lib/cjs/node/decorators/injectContext.js.map +0 -1
  162. package/lib/cjs/node/domain/ContextLogger.js +0 -99
  163. package/lib/cjs/node/domain/ContextLogger.js.map +0 -1
  164. package/lib/cjs/node/domain/DIContext.js +0 -102
  165. package/lib/cjs/node/domain/DIContext.js.map +0 -1
  166. package/lib/cjs/node/index.js +0 -18
  167. package/lib/cjs/node/index.js.map +0 -1
  168. package/lib/cjs/node/interfaces/AlterRunInContext.js +0 -3
  169. package/lib/cjs/node/interfaces/AlterRunInContext.js.map +0 -1
  170. package/lib/cjs/node/services/DILogger.js +0 -12
  171. package/lib/cjs/node/services/DILogger.js.map +0 -1
  172. package/lib/cjs/node/services/DITest.js +0 -126
  173. package/lib/cjs/node/services/DITest.js.map +0 -1
  174. package/lib/cjs/node/utils/asyncHookContext.js +0 -42
  175. package/lib/cjs/node/utils/asyncHookContext.js.map +0 -1
  176. package/lib/cjs/node/utils/attachLogger.js +0 -10
  177. package/lib/cjs/node/utils/attachLogger.js.map +0 -1
  178. package/lib/cjs/node/utils/setLoggerConfiguration.js +0 -11
  179. package/lib/cjs/node/utils/setLoggerConfiguration.js.map +0 -1
  180. package/lib/cjs/node/utils/setLoggerFormat.js +0 -33
  181. package/lib/cjs/node/utils/setLoggerFormat.js.map +0 -1
  182. package/lib/cjs/node/utils/setLoggerLevel.js +0 -15
  183. package/lib/cjs/node/utils/setLoggerLevel.js.map +0 -1
  184. package/lib/cjs/package.json +0 -3
  185. package/lib/esm/package.json +0 -3
  186. package/lib/types-esm/common/constants/constants.d.ts +0 -5
  187. package/lib/types-esm/common/decorators/autoInjectable.d.ts +0 -1
  188. package/lib/types-esm/common/decorators/configuration.d.ts +0 -8
  189. package/lib/types-esm/common/decorators/constant.d.ts +0 -39
  190. package/lib/types-esm/common/decorators/controller.d.ts +0 -42
  191. package/lib/types-esm/common/decorators/inject.d.ts +0 -35
  192. package/lib/types-esm/common/decorators/injectable.d.ts +0 -20
  193. package/lib/types-esm/common/decorators/intercept.d.ts +0 -13
  194. package/lib/types-esm/common/decorators/interceptor.d.ts +0 -10
  195. package/lib/types-esm/common/decorators/lazyInject.d.ts +0 -43
  196. package/lib/types-esm/common/decorators/module.d.ts +0 -37
  197. package/lib/types-esm/common/decorators/opts.d.ts +0 -41
  198. package/lib/types-esm/common/decorators/overrideProvider.d.ts +0 -8
  199. package/lib/types-esm/common/decorators/scope.d.ts +0 -8
  200. package/lib/types-esm/common/decorators/service.d.ts +0 -10
  201. package/lib/types-esm/common/decorators/useOpts.d.ts +0 -42
  202. package/lib/types-esm/common/decorators/value.d.ts +0 -37
  203. package/lib/types-esm/common/domain/Container.d.ts +0 -43
  204. package/lib/types-esm/common/domain/ControllerProvider.d.ts +0 -17
  205. package/lib/types-esm/common/domain/InjectablePropertyType.d.ts +0 -7
  206. package/lib/types-esm/common/domain/LocalsContainer.d.ts +0 -6
  207. package/lib/types-esm/common/domain/Provider.d.ts +0 -71
  208. package/lib/types-esm/common/domain/ProviderScope.d.ts +0 -5
  209. package/lib/types-esm/common/domain/ProviderType.d.ts +0 -10
  210. package/lib/types-esm/common/errors/InjectionError.d.ts +0 -8
  211. package/lib/types-esm/common/errors/InvalidPropertyTokenError.d.ts +0 -4
  212. package/lib/types-esm/common/index.d.ts +0 -54
  213. package/lib/types-esm/common/interfaces/DIConfigurationOptions.d.ts +0 -29
  214. package/lib/types-esm/common/interfaces/DILogger.d.ts +0 -8
  215. package/lib/types-esm/common/interfaces/DILoggerOptions.d.ts +0 -53
  216. package/lib/types-esm/common/interfaces/DIResolver.d.ts +0 -5
  217. package/lib/types-esm/common/interfaces/ImportTokenProviderOpts.d.ts +0 -19
  218. package/lib/types-esm/common/interfaces/InterceptorContext.d.ts +0 -11
  219. package/lib/types-esm/common/interfaces/InterceptorMethods.d.ts +0 -4
  220. package/lib/types-esm/common/interfaces/InvokeOptions.d.ts +0 -30
  221. package/lib/types-esm/common/interfaces/OnDestroy.d.ts +0 -3
  222. package/lib/types-esm/common/interfaces/OnInit.d.ts +0 -3
  223. package/lib/types-esm/common/interfaces/ProviderOpts.d.ts +0 -59
  224. package/lib/types-esm/common/interfaces/RegistrySettings.d.ts +0 -21
  225. package/lib/types-esm/common/interfaces/ResolvedInvokeOptions.d.ts +0 -12
  226. package/lib/types-esm/common/interfaces/TokenProvider.d.ts +0 -2
  227. package/lib/types-esm/common/interfaces/TokenRoute.d.ts +0 -5
  228. package/lib/types-esm/common/registries/GlobalProviders.d.ts +0 -58
  229. package/lib/types-esm/common/registries/ProviderRegistry.d.ts +0 -58
  230. package/lib/types-esm/common/services/DIConfiguration.d.ts +0 -57
  231. package/lib/types-esm/common/services/DILogger.d.ts +0 -3
  232. package/lib/types-esm/common/services/InjectorService.d.ts +0 -203
  233. package/lib/types-esm/common/utils/colors.d.ts +0 -5
  234. package/lib/types-esm/common/utils/createContainer.d.ts +0 -3
  235. package/lib/types-esm/common/utils/getConfiguration.d.ts +0 -3
  236. package/lib/types-esm/common/utils/getConstructorDependencies.d.ts +0 -2
  237. package/lib/types-esm/common/utils/resolveControllers.d.ts +0 -12
  238. package/lib/types-esm/index.d.ts +0 -2
  239. package/lib/types-esm/node/decorators/injectContext.d.ts +0 -15
  240. package/lib/types-esm/node/domain/ContextLogger.d.ts +0 -37
  241. package/lib/types-esm/node/domain/DIContext.d.ts +0 -61
  242. package/lib/types-esm/node/index.d.ts +0 -14
  243. package/lib/types-esm/node/interfaces/AlterRunInContext.d.ts +0 -3
  244. package/lib/types-esm/node/services/DILogger.d.ts +0 -1
  245. package/lib/types-esm/node/services/DITest.d.ts +0 -37
  246. package/lib/types-esm/node/utils/asyncHookContext.d.ts +0 -14
  247. package/lib/types-esm/node/utils/attachLogger.d.ts +0 -2
  248. package/lib/types-esm/node/utils/setLoggerConfiguration.d.ts +0 -2
  249. package/lib/types-esm/node/utils/setLoggerFormat.d.ts +0 -6
  250. package/lib/types-esm/node/utils/setLoggerLevel.d.ts +0 -6
  251. /package/{webpack.config.js → webpack.config.cjs} +0 -0
@@ -1,6 +1,6 @@
1
- import { DILogger } from "../../common/index.js";
2
1
  import { Hooks } from "@tsed/core";
3
2
  import { LogLevel } from "@tsed/logger";
3
+ import { DILogger } from "../../common/index.js";
4
4
  export interface ContextLoggerOptions extends Record<string, any> {
5
5
  id: string;
6
6
  logger?: DILogger;
@@ -17,10 +17,10 @@ export declare class ContextLogger {
17
17
  constructor({ id, logger, dateStart, level, maxStackSize, additionalProps }: ContextLoggerOptions);
18
18
  get hooks(): Hooks;
19
19
  private get stack();
20
- alterLog(cb: (data: any, level: "debug" | "info" | "warn" | "error" | "off" | "all", withRequest: boolean) => any): Hooks;
20
+ alterLog(cb: (data: any, level: "debug" | "info" | "warn" | "error" | "all", withRequest: boolean) => any): Hooks;
21
21
  alterIgnoreLog(cb: (ignore: boolean, data: any) => boolean): Hooks;
22
22
  info(obj: any): this;
23
- debug(obj: any, withRequest?: boolean): this;
23
+ debug(obj: any): this;
24
24
  warn(obj: any): this;
25
25
  error(obj: any): this;
26
26
  fatal(obj: any): this;
@@ -50,7 +50,7 @@ export declare class DIContext {
50
50
  get container(): LocalsContainer;
51
51
  destroy(): Promise<any>;
52
52
  emit(eventName: string, ...args: any[]): Promise<void>;
53
- runInContext(next: Function): Promise<any>;
53
+ runInContext<Result = unknown>(next: (...args: unknown[]) => Result): Promise<Result>;
54
54
  cache<Value = any>(key: string, cb: () => Value): Value;
55
55
  cacheAsync<Value = any>(key: string, cb: () => Promise<Value>): Promise<Value>;
56
56
  delete(key: any): boolean;
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  import { AsyncLocalStorage } from "async_hooks";
3
3
  import { InjectorService } from "../../common/index.js";
4
4
  import type { DIContext } from "../domain/DIContext.js";
@@ -8,7 +8,8 @@ export declare function getAsyncStore(): AsyncLocalStorage<{
8
8
  export declare function useContextRef(): {
9
9
  current: DIContext | undefined;
10
10
  } | undefined;
11
- export declare function getContext<Context = DIContext>(): Context | undefined;
12
- export declare function runInContext(ctx: DIContext | undefined, cb: any, injector?: InjectorService): Promise<any>;
11
+ export declare function useContext<Context = DIContext>(initialValue?: DIContext): Context | undefined;
12
+ export declare const getContext: typeof useContext;
13
+ export declare function runInContext<Result = unknown>(ctx: DIContext | undefined, cb: (...args: unknown[]) => Result, injector?: InjectorService): Promise<Result>;
13
14
  export declare function setContext(ctx: DIContext): void;
14
15
  export declare function bindContext(cb: any): any;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tsed/di",
3
3
  "description": "DI module for Ts.ED Framework",
4
- "type": "commonjs",
5
- "version": "8.0.0-alpha.1",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.11",
6
6
  "source": "./src/index.ts",
7
- "main": "lib/esm/index.js",
8
- "module": "lib/esm/index.js",
7
+ "main": "./lib/esm/index.js",
8
+ "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "browser": "./lib/browser/di.umd.min.js",
11
11
  "exports": {
@@ -13,8 +13,7 @@
13
13
  "types": "./lib/types/index.d.ts",
14
14
  "browser": "./lib/browser/di.umd.min.js",
15
15
  "import": "./lib/esm/index.js",
16
- "require": "./lib/cjs/index.js",
17
- "default": "./lib/cjs/index.js"
16
+ "default": "./lib/esm/index.js"
18
17
  }
19
18
  },
20
19
  "scripts": {
@@ -26,25 +25,25 @@
26
25
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
27
26
  },
28
27
  "dependencies": {
29
- "tslib": "2.6.2",
30
- "uuid": "9.0.1"
28
+ "tslib": "2.7.0",
29
+ "uuid": "^10.0.0"
31
30
  },
32
31
  "devDependencies": {
33
- "@tsed/barrels": "8.0.0-alpha.1",
34
- "@tsed/core": "8.0.0-alpha.1",
35
- "@tsed/logger": ">=6.7.5",
36
- "@tsed/schema": "8.0.0-alpha.1",
37
- "@tsed/typescript": "8.0.0-alpha.1",
32
+ "@tsed/barrels": "8.0.0-alpha.11",
33
+ "@tsed/core": "8.0.0-alpha.11",
34
+ "@tsed/logger": "^6.7.8",
35
+ "@tsed/schema": "8.0.0-alpha.11",
36
+ "@tsed/typescript": "8.0.0-alpha.11",
38
37
  "cross-env": "7.0.3",
39
- "eslint": "^8.57.0",
40
- "typescript": "4.9.5",
41
- "vitest": "2.0.4",
38
+ "eslint": "9.12.0",
39
+ "typescript": "5.4.5",
40
+ "vitest": "2.1.2",
42
41
  "webpack": "^5.75.0"
43
42
  },
44
43
  "peerDependencies": {
45
- "@tsed/core": "8.0.0-alpha.1",
44
+ "@tsed/core": "8.0.0-alpha.11",
46
45
  "@tsed/logger": ">=6.7.5",
47
- "@tsed/schema": "8.0.0-alpha.1"
46
+ "@tsed/schema": "8.0.0-alpha.11"
48
47
  },
49
48
  "peerDependenciesMeta": {
50
49
  "@tsed/core": {
package/vitest.config.mts CHANGED
@@ -10,10 +10,10 @@ export default defineConfig(
10
10
  coverage: {
11
11
  ...presets.test.coverage,
12
12
  thresholds: {
13
- statements: 98.75,
14
- branches: 97.2,
15
- functions: 98.67,
16
- lines: 98.75
13
+ statements: 0,
14
+ branches: 0,
15
+ functions: 0,
16
+ lines: 0
17
17
  }
18
18
  }
19
19
  }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DI_INTERCEPTOR_OPTIONS = exports.DI_USE_PARAM_OPTIONS = exports.DI_USE_OPTIONS = exports.DI_INJECTABLE_PROPS = exports.DI_INVOKE_OPTIONS = void 0;
4
- exports.DI_INVOKE_OPTIONS = Symbol("DI_INVOKE_OPTIONS");
5
- exports.DI_INJECTABLE_PROPS = Symbol("DI_INJECTABLE_PROPS");
6
- exports.DI_USE_OPTIONS = "DI_USE_OPTIONS";
7
- exports.DI_USE_PARAM_OPTIONS = "DI_USE_PARAM_OPTIONS";
8
- exports.DI_INTERCEPTOR_OPTIONS = "DI_INTERCEPTOR_OPTIONS";
9
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/common/constants/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAChD,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACpD,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAClC,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,sBAAsB,GAAG,wBAAwB,CAAC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AutoInjectable = void 0;
4
- const core_1 = require("@tsed/core");
5
- const LocalsContainer_js_1 = require("../domain/LocalsContainer.js");
6
- const InjectorService_js_1 = require("../services/InjectorService.js");
7
- const getConstructorDependencies_js_1 = require("../utils/getConstructorDependencies.js");
8
- function resolveAutoInjectableArgs(token, args) {
9
- const locals = new LocalsContainer_js_1.LocalsContainer();
10
- const injector = InjectorService_js_1.InjectorService.getInstance();
11
- const deps = (0, getConstructorDependencies_js_1.getConstructorDependencies)(token);
12
- const list = [];
13
- const length = Math.max(deps.length, args.length);
14
- for (let i = 0; i < length; i++) {
15
- if (args[i] !== undefined) {
16
- list.push(args[i]);
17
- }
18
- else {
19
- const value = deps[i];
20
- const instance = (0, core_1.isArray)(value)
21
- ? injector.getMany(value[0], locals, { parent: token })
22
- : injector.invoke(value, locals, { parent: token });
23
- list.push(instance);
24
- }
25
- }
26
- return list;
27
- }
28
- function AutoInjectable() {
29
- return (constr) => {
30
- return class AutoInjectable extends constr {
31
- constructor(...args) {
32
- super(...resolveAutoInjectableArgs(constr, args));
33
- }
34
- };
35
- };
36
- }
37
- exports.AutoInjectable = AutoInjectable;
38
- //# sourceMappingURL=autoInjectable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"autoInjectable.js","sourceRoot":"","sources":["../../../../src/common/decorators/autoInjectable.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAC9C,qEAA6D;AAE7D,uEAA+D;AAC/D,0FAAkF;AAElF,SA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C;AACJ,CAAC;AARD,wCAQC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Configuration = void 0;
4
- const core_1 = require("@tsed/core");
5
- const inject_js_1 = require("./inject.js");
6
- /**
7
- * Get or set Configuration on a class.
8
- *
9
- * @decorator
10
- */
11
- function Configuration(configuration = {}) {
12
- return (...args) => {
13
- switch ((0, core_1.decoratorTypeOf)(args)) {
14
- case core_1.DecoratorTypes.CLASS:
15
- (0, core_1.StoreSet)("configuration", configuration)(args[0]);
16
- break;
17
- default:
18
- case core_1.DecoratorTypes.PARAM_CTOR:
19
- return (0, inject_js_1.Inject)(Configuration)(args[0], args[1], args[2]);
20
- }
21
- };
22
- }
23
- exports.Configuration = Configuration;
24
- //# sourceMappingURL=configuration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../src/common/decorators/configuration.ts"],"names":[],"mappings":";;;AAAA,qCAA0F;AAC1F,2CAAmC;AAGnC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,gBAA6C,EAAE;IAC3E,OAAO,CAAC,GAAG,IAAyB,EAAE,EAAE;QACtC,QAAQ,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,eAAQ,EAAC,eAAe,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAElD,MAAM;YACR,QAAQ;YACR,KAAK,qBAAc,CAAC,UAAU;gBAC5B,OAAO,IAAA,kBAAM,EAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAW,CAAC,CAAC;SACrE;IACH,CAAC,CAAC;AACJ,CAAC;AAZD,sCAYC"}
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Constant = exports.bindConstant = exports.constant = void 0;
4
- const core_1 = require("@tsed/core");
5
- const InjectorService_js_1 = require("../services/InjectorService.js");
6
- function constant(expression, defaultValue) {
7
- return InjectorService_js_1.InjectorService.getInstance().settings.get(expression, defaultValue);
8
- }
9
- exports.constant = constant;
10
- function bindConstant(target, propertyKey, expression, defaultValue) {
11
- const symbol = Symbol();
12
- (0, core_1.catchError)(() => Reflect.deleteProperty(target, propertyKey));
13
- Reflect.defineProperty(target, propertyKey, {
14
- get() {
15
- if (this[symbol] !== undefined) {
16
- return this[symbol];
17
- }
18
- const value = constant(expression, defaultValue);
19
- this[symbol] = Object.freeze((0, core_1.deepClone)(value));
20
- return this[symbol];
21
- },
22
- set(value) {
23
- const bean = constant(expression, defaultValue) || this[symbol];
24
- if (bean === undefined && value !== undefined) {
25
- this[symbol] = value;
26
- }
27
- },
28
- enumerable: true,
29
- configurable: true
30
- });
31
- }
32
- exports.bindConstant = bindConstant;
33
- /**
34
- * Return value from Configuration.
35
- *
36
- * ## Example
37
- *
38
- * ```typescript
39
- * import {Env} from "@tsed/core";
40
- * import {Constant, Value} from "@tsed/di";
41
- *
42
- * export class MyClass {
43
- *
44
- * @Constant("env")
45
- * env: Env;
46
- *
47
- * @Value("swagger.path")
48
- * swaggerPath: string;
49
- *
50
- * @Value("swagger.path", "defaultValue")
51
- * swaggerPath: string;
52
- *
53
- * constructor() {
54
- * console.log(this.swaggerPath) // undefined. Not available on constructor
55
- * }
56
- *
57
- * $onInit() {
58
- * console.log(this.swaggerPath) // something
59
- * }
60
- * }
61
- * ```
62
- *
63
- * @param {string} expression
64
- * @param defaultValue
65
- * @returns {(targetClass: any, attributeName: string) => any}
66
- * @decorator
67
- */
68
- function Constant(expression, defaultValue) {
69
- return (target, propertyKey) => {
70
- return bindConstant(target, propertyKey, expression, defaultValue);
71
- };
72
- }
73
- exports.Constant = Constant;
74
- //# sourceMappingURL=constant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"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;;;;;;;;;;;;GAkCG;AACH,SAAgB,QAAQ,CAAiB,UAAkB,EAAE,YAAmB;IAC9E,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,OAAO,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC;AAJD,4BAIC"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Controller = void 0;
4
- const core_1 = require("@tsed/core");
5
- const schema_1 = require("@tsed/schema");
6
- const ProviderRegistry_js_1 = require("../registries/ProviderRegistry.js");
7
- function mapOptions(options) {
8
- if (typeof options === "string" || options instanceof RegExp || (0, core_1.isArrayOrArrayClass)(options)) {
9
- return {
10
- path: options
11
- };
12
- }
13
- return options;
14
- }
15
- /**
16
- * Declare a new controller with his Rest path. His methods annotated will be collected to build the routing list.
17
- * This routing listing will be built with the `express.Router` object.
18
- *
19
- * ::: tip
20
- * See [Controllers](/docs/controllers.md) section for more details
21
- * :::
22
- *
23
- * ```typescript
24
- * @Controller("/calendars")
25
- * export provide CalendarCtrl {
26
- *
27
- * @Get("/:id")
28
- * public get(
29
- * @Req() request: Req,
30
- * @Res() response: Res,
31
- * @Next() next: Next
32
- * ): void {
33
- *
34
- * }
35
- * }
36
- * ```
37
- *
38
- * @param options
39
- * @controller
40
- * @decorator
41
- * @classDecorator
42
- */
43
- function Controller(options) {
44
- const { children = [], path, ...opts } = mapOptions(options);
45
- return (0, core_1.useDecorators)((target) => {
46
- (0, ProviderRegistry_js_1.registerController)({
47
- provide: target,
48
- ...opts
49
- });
50
- }, path && (0, schema_1.Path)(path), (0, schema_1.Children)(...children));
51
- }
52
- exports.Controller = Controller;
53
- //# sourceMappingURL=controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/common/decorators/controller.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yCAA4C;AAE5C,2EAAqE;AAgBrE,SAAS,UAAU,CAAC,OAAY;IAC9B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,YAAY,MAAM,IAAI,IAAA,0BAAmB,EAAC,OAAO,CAAC,EAAE;QAC5F,OAAO;YACL,IAAI,EAAE,OAAO;SACd,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,UAAU,CAAC,OAAqC;IAC9D,MAAM,EAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAE3D,OAAO,IAAA,oBAAa,EAClB,CAAC,MAAY,EAAE,EAAE;QACf,IAAA,wCAAkB,EAAC;YACjB,OAAO,EAAE,MAAM;YACf,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC,EACD,IAAI,IAAI,IAAA,aAAI,EAAC,IAAW,CAAC,EACzB,IAAA,iBAAQ,EAAC,GAAG,QAAQ,CAAC,CACtB,CAAC;AACJ,CAAC;AAbD,gCAaC"}
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Inject = exports.injectMany = exports.inject = void 0;
4
- const core_1 = require("@tsed/core");
5
- const constants_js_1 = require("../constants/constants.js");
6
- const InvalidPropertyTokenError_js_1 = require("../errors/InvalidPropertyTokenError.js");
7
- const InjectorService_js_1 = require("../services/InjectorService.js");
8
- const getConstructorDependencies_js_1 = require("../utils/getConstructorDependencies.js");
9
- function inject(token, opts) {
10
- return InjectorService_js_1.InjectorService.getInstance().invoke(token, opts?.locals || InjectorService_js_1.InjectorService.getLocals(), opts);
11
- }
12
- exports.inject = inject;
13
- function injectMany(token, opts) {
14
- return InjectorService_js_1.InjectorService.getInstance().getMany(token, opts?.locals || InjectorService_js_1.InjectorService.getLocals(), opts);
15
- }
16
- exports.injectMany = injectMany;
17
- function setToken(token, { target, propertyKey, parameterIndex }) {
18
- const paramTypes = (0, getConstructorDependencies_js_1.getConstructorDependencies)(target, propertyKey);
19
- const type = paramTypes[parameterIndex];
20
- paramTypes[parameterIndex] = type === Array ? [token] : token;
21
- core_1.Metadata.setParamTypes(target, propertyKey, paramTypes);
22
- (0, getConstructorDependencies_js_1.setConstructorDependencies)(target, paramTypes);
23
- }
24
- function getTokenType(token, target, propertyKey) {
25
- const useType = token || core_1.Metadata.getType(target, propertyKey);
26
- if (useType === Object) {
27
- throw new InvalidPropertyTokenError_js_1.InvalidPropertyTokenError(target, String(propertyKey));
28
- }
29
- return useType;
30
- }
31
- function bindInjectableProperty(target, propertyKey, { token, transform = (o) => o, useOpts }) {
32
- const symbol = Symbol();
33
- if (!target[constants_js_1.DI_INJECTABLE_PROPS]) {
34
- Reflect.defineProperty(target, constants_js_1.DI_INJECTABLE_PROPS, {
35
- value: new Set(),
36
- enumerable: false,
37
- configurable: false
38
- });
39
- }
40
- target[constants_js_1.DI_INJECTABLE_PROPS].add(propertyKey);
41
- (0, core_1.catchError)(() => Reflect.deleteProperty(target, propertyKey));
42
- Reflect.defineProperty(target, propertyKey, {
43
- get() {
44
- const useType = getTokenType(token, target, propertyKey);
45
- const originalType = core_1.Metadata.getType(target, propertyKey);
46
- const invokeOpts = {
47
- rebuild: !!this[constants_js_1.DI_INVOKE_OPTIONS]?.rebuild,
48
- locals: this[constants_js_1.DI_INVOKE_OPTIONS]?.locals,
49
- useOpts: useOpts || core_1.Store.from(target, propertyKey).get(constants_js_1.DI_USE_OPTIONS)
50
- };
51
- if (this[symbol] === undefined) {
52
- this[symbol] = originalType === Array ? injectMany(token, invokeOpts) : inject(useType, invokeOpts);
53
- }
54
- [].concat(this[symbol]).forEach((instance, index) => {
55
- if ((0, core_1.isPromise)(this[symbol])) {
56
- instance.then((result) => {
57
- this[symbol][index] = result;
58
- if (originalType !== Array) {
59
- this[symbol] = result;
60
- }
61
- });
62
- }
63
- });
64
- return transform(this[symbol], { self: this, target, propertyKey });
65
- }
66
- });
67
- }
68
- function Inject(token, opts = {}) {
69
- opts = typeof opts === "function" ? { transform: opts } : opts;
70
- return (target, propertyKey, index) => {
71
- const bindingType = (0, core_1.decoratorTypeOf)([target, propertyKey, index]);
72
- switch (bindingType) {
73
- case core_1.DecoratorTypes.PARAM_CTOR:
74
- if (token) {
75
- setToken(token, { target, propertyKey, parameterIndex: index });
76
- }
77
- break;
78
- case core_1.DecoratorTypes.PROP:
79
- bindInjectableProperty(target, propertyKey, { ...opts, token });
80
- }
81
- };
82
- }
83
- exports.Inject = Inject;
84
- //# sourceMappingURL=inject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../../src/common/decorators/inject.ts"],"names":[],"mappings":";;;AAAA,qCAA8G;AAC9G,4DAAiG;AACjG,yFAAiF;AAGjF,uEAA+D;AAC/D,0FAA8G;AAE9G,SAAgB,MAAM,CAAI,KAAuB,EAAE,IAAqE;IACtH,OAAO,oCAAe,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,oCAAe,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;AACxG,CAAC;AAFD,wBAEC;AAED,SAAgB,UAAU,CAAI,KAAsB,EAAE,IAAqE;IACzH,OAAO,oCAAe,CAAC,WAAW,EAAE,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,oCAAe,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;AAC5G,CAAC;AAFD,gCAEC;AAED,SAAS,QAAQ,CACf,KAAoB,EACpB,EACE,MAAM,EACN,WAAW,EACX,cAAc,EAKf;IAED,MAAM,UAAU,GAAG,IAAA,0DAA0B,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnE,MAAM,IAAI,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAExC,UAAU,CAAC,cAAc,C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C;AAyBD,SAAgB,MAAM,CACpB,KAAmD,EACnD,OAA+F,EAAE;IAEjG,IAAI,GAAG,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE7D,OAAO,CAAC,MAAW,EAAE,WAAwC,EAAE,KAAc,EAAE,EAAE;QAC/E,MAAM,WAAW,GAAG,IAAA,sBAAe,EAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QAElE,QAAQ,WAAW,EAAE;YACnB,KAAK,qBAAc,CAAC,UAAU;gBAC5B,IAAI,KAAK,EAAE;oBACT,QAAQ,CAAC,KAAK,EAAE,EAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,KAAM,EAAC,CAAC,CAAC;iBAChE;gBACD,MAAM;YACR,KAAK,qBAAc,CAAC,IAAI;gBACtB,sBAAsB,CAAC,MAAM,EAAE,WAAY,EAAE,EAAC,GAAG,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;SAClE;IACH,CAAC,CAAC;AACJ,CAAC;AAnBD,wBAmBC"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Injectable = void 0;
4
- const ProviderRegistry_js_1 = require("../registries/ProviderRegistry.js");
5
- /**
6
- * The decorators `@Injectable()` declare a new service can be injected in other service, controller, interceptor, etc.. on there `constructor`.
7
- * All classes annotated with `@Injectable()` are built one time, excepted if you change the default provider configuration.
8
- *
9
- * ::: tip
10
- * `@Injectable()` use the `reflect-metadata` to collect and inject the built provided to other services.
11
- * :::
12
- *
13
- * ### Options
14
- *
15
- * - type (@@ProviderType@@ or `string`): Kind of provider. (Default: `ProviderType.PROVIDER`)
16
- * - scope (@@ProviderScope@@): Kind of provider. (Default: `ProviderScope.SINGLETON`)
17
- * - provide (@@TokenProvider@@): An injection token (Note: This option override default metadata generated by Typescript).
18
- * - deps (`Type<any>`): List of class or provider which will be injected to the constructor (Note: This options override default metadata generated by Typescript).
19
- *
20
- * @returns {Function}
21
- * @decorator
22
- */
23
- function Injectable(options = {}) {
24
- return (target) => {
25
- (0, ProviderRegistry_js_1.registerProvider)({
26
- ...options,
27
- ...(options.provide ? { useClass: target } : { provide: target })
28
- });
29
- };
30
- }
31
- exports.Injectable = Injectable;
32
- //# sourceMappingURL=injectable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"injectable.js","sourceRoot":"","sources":["../../../../src/common/decorators/injectable.ts"],"names":[],"mappings":";;;AACA,2EAAmE;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,UAAU,CAAC,UAAiC,EAAE;IAC5D,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,IAAA,sCAAgB,EAAC;YACf,GAAG,OAAO;YACV,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,MAAM,EAAC,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAPD,gCAOC"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Intercept = exports.bindIntercept = exports.getInterceptorOptions = void 0;
4
- const core_1 = require("@tsed/core");
5
- const constants_js_1 = require("../constants/constants.js");
6
- const inject_js_1 = require("./inject.js");
7
- function getInterceptorOptions(target, propertyKey) {
8
- return core_1.Store.fromMethod(target, propertyKey).get(constants_js_1.DI_INTERCEPTOR_OPTIONS);
9
- }
10
- exports.getInterceptorOptions = getInterceptorOptions;
11
- function bindIntercept(target, propertyKey, token, options) {
12
- const klass = (0, core_1.classOf)(target);
13
- const descriptor = Reflect.getOwnPropertyDescriptor(klass.prototype, propertyKey);
14
- const originalMethod = descriptor.value;
15
- const symbol = Symbol();
16
- core_1.Store.fromMethod(klass, propertyKey).set(constants_js_1.DI_INTERCEPTOR_OPTIONS, options);
17
- descriptor.value = function (...args) {
18
- const next = (err) => {
19
- if (!err) {
20
- return originalMethod.apply(this, args);
21
- }
22
- throw err;
23
- };
24
- const context = {
25
- target,
26
- propertyKey,
27
- args,
28
- options,
29
- next
30
- };
31
- const invokeOpts = {
32
- rebuild: !!this[constants_js_1.DI_INVOKE_OPTIONS]?.rebuild,
33
- locals: this[constants_js_1.DI_INVOKE_OPTIONS]?.locals
34
- };
35
- this[symbol] = this[symbol] || (0, inject_js_1.inject)(token, invokeOpts);
36
- return this[symbol].intercept({
37
- ...context,
38
- options
39
- }, next);
40
- };
41
- return descriptor;
42
- }
43
- exports.bindIntercept = bindIntercept;
44
- /**
45
- * Attaches interceptor to method call and executes the before and after methods
46
- *
47
- * @param interceptor
48
- * @param options
49
- * @decorator
50
- */
51
- function Intercept(interceptor, options) {
52
- return (...args) => {
53
- const [target, propertyKey] = args;
54
- const type = (0, core_1.decoratorTypeOf)(args);
55
- switch (type) {
56
- case core_1.DecoratorTypes.CLASS:
57
- (0, core_1.decorateMethodsOf)(target, Intercept(interceptor, options));
58
- break;
59
- case core_1.DecoratorTypes.METHOD:
60
- return bindIntercept(target, propertyKey, interceptor, options);
61
- }
62
- };
63
- }
64
- exports.Intercept = Intercept;
65
- //# sourceMappingURL=intercept.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../../src/common/decorators/intercept.ts"],"names":[],"mappings":";;;AAAA,qCAAyH;AACzH,4DAAoF;AAKpF,2CAAmC;AAEnC,SAAgB,qBAAqB,CAAI,MAAiB,EAAE,WAA4B;IACtF,OAAO,YAAK,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,qCAAsB,CAAM,CAAC;AAChF,CAAC;AAFD,sDAEC;AAED,SAAgB,aAAa,CAAC,MAAW,EAAE,WAA4B,EAAE,KAAoB,EAAE,OAAgC;IAC7H,MAAM,KAAK,GAAG,IAAA,cAAO,EA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M,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC;QACnC,MAAM,IAAI,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC;QACnC,QAAQ,IAAI,EAAE;YACZ,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,MAAM,EAAE,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC3D,MAAM;YACR,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;SACnE;IACH,CAAC,CAAC;AACJ,CAAC;AAZD,8BAYC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Interceptor = void 0;
4
- const ProviderType_js_1 = require("../domain/ProviderType.js");
5
- const injectable_js_1 = require("./injectable.js");
6
- /**
7
- * The decorators `@Service()` declare a new service can be injected in other service or controller on there `constructor`.
8
- * All services annotated with `@Service()` are constructed one time.
9
- *
10
- * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.
11
- *
12
- * @returns {Function}
13
- * @decorator
14
- */
15
- function Interceptor() {
16
- return (0, injectable_js_1.Injectable)({
17
- type: ProviderType_js_1.ProviderType.INTERCEPTOR
18
- });
19
- }
20
- exports.Interceptor = Interceptor;
21
- //# sourceMappingURL=interceptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interceptor.js","sourceRoot":"","sources":["../../../../src/common/decorators/interceptor.ts"],"names":[],"mappings":";;;AAAA,+DAAuD;AACvD,mDAA2C;AAE3C;;;;;;;;GAQG;AACH,SAAgB,WAAW;IACzB,OAAO,IAAA,0BAAU,EAAC;QAChB,IAAI,EAAE,8BAAY,CAAC,WAAW;KAC/B,CAAC,CAAC;AACL,CAAC;AAJD,kCAIC"}