@celljs/core 4.0.0 → 4.2.0

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 (529) hide show
  1. package/README.md +49 -68
  2. package/esm/browser/static-module.d.ts +1 -1
  3. package/esm/common/annotation/aspect.d.ts +2 -1
  4. package/esm/common/annotation/aspect.js.map +1 -1
  5. package/esm/common/annotation/autowired-provider.d.ts +0 -2
  6. package/esm/common/annotation/autowired-provider.js +4 -13
  7. package/esm/common/annotation/autowired-provider.js.map +1 -1
  8. package/esm/common/annotation/autowired.d.ts +1 -1
  9. package/esm/common/annotation/autowired.js +11 -3
  10. package/esm/common/annotation/autowired.js.map +1 -1
  11. package/esm/common/annotation/component.d.ts +4 -8
  12. package/esm/common/annotation/component.js +0 -6
  13. package/esm/common/annotation/component.js.map +1 -1
  14. package/esm/common/annotation/constant.d.ts +1 -1
  15. package/esm/common/annotation/constant.js +6 -3
  16. package/esm/common/annotation/constant.js.map +1 -1
  17. package/esm/common/annotation/detached/autowired-provider.js +2 -2
  18. package/esm/common/annotation/detached/autowired-provider.js.map +1 -1
  19. package/esm/common/annotation/index.d.ts +0 -6
  20. package/esm/common/annotation/index.js +0 -6
  21. package/esm/common/annotation/index.js.map +1 -1
  22. package/esm/common/annotation/named.d.ts +2 -1
  23. package/esm/common/annotation/named.js +5 -1
  24. package/esm/common/annotation/named.js.map +1 -1
  25. package/esm/common/annotation/optional.d.ts +2 -1
  26. package/esm/common/annotation/optional.js +5 -1
  27. package/esm/common/annotation/optional.js.map +1 -1
  28. package/esm/common/annotation/post-construct.d.ts +2 -1
  29. package/esm/common/annotation/post-construct.js +5 -1
  30. package/esm/common/annotation/post-construct.js.map +1 -1
  31. package/esm/common/annotation/tagged.d.ts +2 -1
  32. package/esm/common/annotation/tagged.js +6 -1
  33. package/esm/common/annotation/tagged.js.map +1 -1
  34. package/esm/common/annotation/value.d.ts +3 -2
  35. package/esm/common/annotation/value.js +7 -10
  36. package/esm/common/annotation/value.js.map +1 -1
  37. package/esm/common/aop/aop-proxy-factory.d.ts +6 -2
  38. package/esm/common/aop/aop-proxy-factory.js +44 -28
  39. package/esm/common/aop/aop-proxy-factory.js.map +1 -1
  40. package/esm/common/aop/class-filter.js +6 -6
  41. package/esm/common/aop/class-filter.js.map +1 -1
  42. package/esm/common/application/application-factory.d.ts +1 -1
  43. package/esm/common/application/application-factory.js +4 -4
  44. package/esm/common/application/application-factory.js.map +1 -1
  45. package/esm/common/application/application-protocol.js +1 -1
  46. package/esm/common/application/application-protocol.js.map +1 -1
  47. package/esm/common/config/config-provider.js +2 -1
  48. package/esm/common/config/config-provider.js.map +1 -1
  49. package/esm/common/container/auto-bind.d.ts +7 -3
  50. package/esm/common/container/auto-bind.js +54 -71
  51. package/esm/common/container/auto-bind.js.map +1 -1
  52. package/esm/common/container/container-error.d.ts +21 -0
  53. package/esm/common/container/container-error.js +22 -0
  54. package/esm/common/container/container-error.js.map +1 -0
  55. package/esm/common/container/container-provider.d.ts +5 -4
  56. package/esm/common/container/container-provider.js +2 -1
  57. package/esm/common/container/container-provider.js.map +1 -1
  58. package/esm/common/container/container-util.d.ts +5 -7
  59. package/esm/common/container/container-util.js +8 -19
  60. package/esm/common/container/container-util.js.map +1 -1
  61. package/esm/common/container/container.d.ts +104 -0
  62. package/esm/common/container/container.js +299 -0
  63. package/esm/common/container/container.js.map +1 -0
  64. package/esm/common/container/dynamic-container.d.ts +1 -1
  65. package/esm/common/container/dynamic-container.js +2 -2
  66. package/esm/common/container/dynamic-container.js.map +1 -1
  67. package/esm/common/container/index.d.ts +5 -6
  68. package/esm/common/container/index.js +5 -3
  69. package/esm/common/container/index.js.map +1 -1
  70. package/esm/common/container/injection.d.ts +40 -0
  71. package/esm/common/container/injection.js +109 -0
  72. package/esm/common/container/injection.js.map +1 -0
  73. package/esm/common/container/scope.d.ts +2 -3
  74. package/esm/common/container/scope.js +2 -3
  75. package/esm/common/container/scope.js.map +1 -1
  76. package/esm/common/el/application-expression-engine.d.ts +7 -0
  77. package/esm/common/{provider/provider-creator.js → el/application-expression-engine.js} +11 -11
  78. package/esm/common/el/application-expression-engine.js.map +1 -0
  79. package/esm/common/el/core-context-initializer.d.ts +3 -2
  80. package/esm/common/el/core-context-initializer.js +10 -8
  81. package/esm/common/el/core-context-initializer.js.map +1 -1
  82. package/esm/common/el/expression-compiler.d.ts +7 -17
  83. package/esm/common/el/expression-compiler.js +10 -166
  84. package/esm/common/el/expression-compiler.js.map +1 -1
  85. package/esm/common/el/expression-engine.d.ts +61 -0
  86. package/esm/common/el/expression-engine.js +459 -0
  87. package/esm/common/el/expression-engine.js.map +1 -0
  88. package/esm/common/el/expression-handler.d.ts +8 -4
  89. package/esm/common/el/expression-handler.js +15 -58
  90. package/esm/common/el/expression-handler.js.map +1 -1
  91. package/esm/common/el/expression-protocol.d.ts +3 -5
  92. package/esm/common/el/expression-protocol.js +0 -1
  93. package/esm/common/el/expression-protocol.js.map +1 -1
  94. package/esm/common/el/expression-util.d.ts +69 -0
  95. package/esm/common/el/expression-util.js +346 -0
  96. package/esm/common/el/expression-util.js.map +1 -0
  97. package/esm/common/el/index.d.ts +3 -1
  98. package/esm/common/el/index.js +3 -1
  99. package/esm/common/el/index.js.map +1 -1
  100. package/esm/common/logger/abstract-logger.d.ts +4 -2
  101. package/esm/common/logger/abstract-logger.js +11 -6
  102. package/esm/common/logger/abstract-logger.js.map +1 -1
  103. package/esm/common/logger/logger-protocol.d.ts +4 -0
  104. package/esm/common/logger/logger-protocol.js +2 -0
  105. package/esm/common/logger/logger-protocol.js.map +1 -1
  106. package/esm/common/logger/logger.js +7 -7
  107. package/esm/common/logger/logger.js.map +1 -1
  108. package/esm/common/provider/index.d.ts +0 -1
  109. package/esm/common/provider/index.js +0 -1
  110. package/esm/common/provider/index.js.map +1 -1
  111. package/esm/common/provider/provider-protocol.d.ts +5 -9
  112. package/esm/common/provider/provider-protocol.js +0 -1
  113. package/esm/common/provider/provider-protocol.js.map +1 -1
  114. package/esm/common/provider/provider-util.d.ts +1 -1
  115. package/esm/common/provider/provider-util.js +2 -2
  116. package/esm/common/provider/provider-util.js.map +1 -1
  117. package/esm/common/provider/provider.d.ts +7 -6
  118. package/esm/common/provider/provider.js +15 -26
  119. package/esm/common/provider/provider.js.map +1 -1
  120. package/esm/common/static-module.d.ts +1 -1
  121. package/esm/common/static-module.js +1 -1
  122. package/esm/common/static-module.js.map +1 -1
  123. package/esm/common/test/mock-logger.d.ts +1 -0
  124. package/esm/common/test/mock-logger.js +5 -13
  125. package/esm/common/test/mock-logger.js.map +1 -1
  126. package/esm/common/test/test-module.d.ts +1 -1
  127. package/esm/common/test/test-module.js +1 -1
  128. package/esm/common/test/test-module.js.map +1 -1
  129. package/esm/common/utils/annotation-util.js +2 -1
  130. package/esm/common/utils/annotation-util.js.map +1 -1
  131. package/esm/common/utils/emitter.d.ts +1 -10
  132. package/esm/common/utils/emitter.js +0 -56
  133. package/esm/common/utils/emitter.js.map +1 -1
  134. package/esm/common/utils/mime-type-util.js +1 -1
  135. package/esm/common/utils/mime-type-util.js.map +1 -1
  136. package/esm/common/utils/mime-type.js +1 -1
  137. package/esm/common/utils/mime-type.js.map +1 -1
  138. package/esm/common/utils/proxy-util.d.ts +5 -2
  139. package/esm/common/utils/proxy-util.js +10 -28
  140. package/esm/common/utils/proxy-util.js.map +1 -1
  141. package/esm/node/context/context.d.ts +11 -2
  142. package/esm/node/context/context.js +36 -12
  143. package/esm/node/context/context.js.map +1 -1
  144. package/esm/node/index.d.ts +0 -1
  145. package/esm/node/index.js +0 -1
  146. package/esm/node/index.js.map +1 -1
  147. package/esm/node/static-module.d.ts +1 -1
  148. package/lib/browser/static-module.d.ts +1 -1
  149. package/lib/common/annotation/aspect.d.ts +2 -1
  150. package/lib/common/annotation/aspect.d.ts.map +1 -1
  151. package/lib/common/annotation/aspect.js.map +1 -1
  152. package/lib/common/annotation/autowired-provider.d.ts +0 -2
  153. package/lib/common/annotation/autowired-provider.d.ts.map +1 -1
  154. package/lib/common/annotation/autowired-provider.js +4 -14
  155. package/lib/common/annotation/autowired-provider.js.map +1 -1
  156. package/lib/common/annotation/autowired.d.ts +1 -1
  157. package/lib/common/annotation/autowired.d.ts.map +1 -1
  158. package/lib/common/annotation/autowired.js +11 -3
  159. package/lib/common/annotation/autowired.js.map +1 -1
  160. package/lib/common/annotation/component.d.ts +4 -8
  161. package/lib/common/annotation/component.d.ts.map +1 -1
  162. package/lib/common/annotation/component.js +0 -6
  163. package/lib/common/annotation/component.js.map +1 -1
  164. package/lib/common/annotation/constant.d.ts +1 -1
  165. package/lib/common/annotation/constant.d.ts.map +1 -1
  166. package/lib/common/annotation/constant.js +6 -3
  167. package/lib/common/annotation/constant.js.map +1 -1
  168. package/lib/common/annotation/detached/autowired-provider.js +2 -2
  169. package/lib/common/annotation/detached/autowired-provider.js.map +1 -1
  170. package/lib/common/annotation/index.d.ts +0 -6
  171. package/lib/common/annotation/index.d.ts.map +1 -1
  172. package/lib/common/annotation/index.js +0 -6
  173. package/lib/common/annotation/index.js.map +1 -1
  174. package/lib/common/annotation/named.d.ts +2 -1
  175. package/lib/common/annotation/named.d.ts.map +1 -1
  176. package/lib/common/annotation/named.js +6 -2
  177. package/lib/common/annotation/named.js.map +1 -1
  178. package/lib/common/annotation/optional.d.ts +2 -1
  179. package/lib/common/annotation/optional.d.ts.map +1 -1
  180. package/lib/common/annotation/optional.js +6 -2
  181. package/lib/common/annotation/optional.js.map +1 -1
  182. package/lib/common/annotation/post-construct.d.ts +2 -1
  183. package/lib/common/annotation/post-construct.d.ts.map +1 -1
  184. package/lib/common/annotation/post-construct.js +6 -2
  185. package/lib/common/annotation/post-construct.js.map +1 -1
  186. package/lib/common/annotation/tagged.d.ts +2 -1
  187. package/lib/common/annotation/tagged.d.ts.map +1 -1
  188. package/lib/common/annotation/tagged.js +7 -2
  189. package/lib/common/annotation/tagged.js.map +1 -1
  190. package/lib/common/annotation/value.d.ts +3 -2
  191. package/lib/common/annotation/value.d.ts.map +1 -1
  192. package/lib/common/annotation/value.js +7 -10
  193. package/lib/common/annotation/value.js.map +1 -1
  194. package/lib/common/aop/aop-proxy-factory.d.ts +6 -2
  195. package/lib/common/aop/aop-proxy-factory.d.ts.map +1 -1
  196. package/lib/common/aop/aop-proxy-factory.js +45 -29
  197. package/lib/common/aop/aop-proxy-factory.js.map +1 -1
  198. package/lib/common/aop/aop.spec.d.ts +2 -0
  199. package/lib/common/aop/aop.spec.d.ts.map +1 -0
  200. package/lib/common/aop/aop.spec.js +170 -0
  201. package/lib/common/aop/aop.spec.js.map +1 -0
  202. package/lib/common/aop/class-filter.js +7 -7
  203. package/lib/common/aop/class-filter.js.map +1 -1
  204. package/lib/common/application/application-factory.d.ts +1 -1
  205. package/lib/common/application/application-factory.d.ts.map +1 -1
  206. package/lib/common/application/application-factory.js +4 -4
  207. package/lib/common/application/application-factory.js.map +1 -1
  208. package/lib/common/application/application-protocol.js +1 -1
  209. package/lib/common/application/application-protocol.js.map +1 -1
  210. package/lib/common/application/lifecycle.spec.d.ts +2 -0
  211. package/lib/common/application/lifecycle.spec.d.ts.map +1 -0
  212. package/lib/common/application/lifecycle.spec.js +155 -0
  213. package/lib/common/application/lifecycle.spec.js.map +1 -0
  214. package/lib/common/config/config-provider.js +2 -1
  215. package/lib/common/config/config-provider.js.map +1 -1
  216. package/lib/common/container/assembly.spec.d.ts +2 -0
  217. package/lib/common/container/assembly.spec.d.ts.map +1 -0
  218. package/lib/common/container/assembly.spec.js +464 -0
  219. package/lib/common/container/assembly.spec.js.map +1 -0
  220. package/lib/common/container/auto-bind.d.ts +7 -3
  221. package/lib/common/container/auto-bind.d.ts.map +1 -1
  222. package/lib/common/container/auto-bind.js +54 -72
  223. package/lib/common/container/auto-bind.js.map +1 -1
  224. package/lib/common/container/container-error.d.ts +22 -0
  225. package/lib/common/container/container-error.d.ts.map +1 -0
  226. package/lib/common/container/container-error.js +26 -0
  227. package/lib/common/container/container-error.js.map +1 -0
  228. package/lib/common/container/container-provider.d.ts +5 -4
  229. package/lib/common/container/container-provider.d.ts.map +1 -1
  230. package/lib/common/container/container-provider.js +3 -2
  231. package/lib/common/container/container-provider.js.map +1 -1
  232. package/lib/common/container/container-util.d.ts +5 -7
  233. package/lib/common/container/container-util.d.ts.map +1 -1
  234. package/lib/common/container/container-util.js +8 -19
  235. package/lib/common/container/container-util.js.map +1 -1
  236. package/lib/common/container/container.d.ts +105 -0
  237. package/lib/common/container/container.d.ts.map +1 -0
  238. package/lib/common/container/container.js +305 -0
  239. package/lib/common/container/container.js.map +1 -0
  240. package/lib/common/container/container.spec.d.ts +2 -0
  241. package/lib/common/container/container.spec.d.ts.map +1 -0
  242. package/lib/common/container/container.spec.js +334 -0
  243. package/lib/common/container/container.spec.js.map +1 -0
  244. package/lib/common/container/dynamic-container.d.ts +1 -1
  245. package/lib/common/container/dynamic-container.d.ts.map +1 -1
  246. package/lib/common/container/dynamic-container.js +3 -3
  247. package/lib/common/container/dynamic-container.js.map +1 -1
  248. package/lib/common/container/index.d.ts +5 -6
  249. package/lib/common/container/index.d.ts.map +1 -1
  250. package/lib/common/container/index.js +5 -3
  251. package/lib/common/container/index.js.map +1 -1
  252. package/lib/common/container/injection.d.ts +41 -0
  253. package/lib/common/container/injection.d.ts.map +1 -0
  254. package/lib/common/container/injection.js +112 -0
  255. package/lib/common/container/injection.js.map +1 -0
  256. package/lib/common/container/scope.d.ts +2 -3
  257. package/lib/common/container/scope.d.ts.map +1 -1
  258. package/lib/common/container/scope.js +2 -3
  259. package/lib/common/container/scope.js.map +1 -1
  260. package/lib/common/el/application-expression-engine.d.ts +8 -0
  261. package/lib/common/el/application-expression-engine.d.ts.map +1 -0
  262. package/lib/common/el/application-expression-engine.js +22 -0
  263. package/lib/common/el/application-expression-engine.js.map +1 -0
  264. package/lib/common/el/core-context-initializer.d.ts +3 -2
  265. package/lib/common/el/core-context-initializer.d.ts.map +1 -1
  266. package/lib/common/el/core-context-initializer.js +9 -7
  267. package/lib/common/el/core-context-initializer.js.map +1 -1
  268. package/lib/common/el/expression-compiler.d.ts +7 -17
  269. package/lib/common/el/expression-compiler.d.ts.map +1 -1
  270. package/lib/common/el/expression-compiler.js +10 -166
  271. package/lib/common/el/expression-compiler.js.map +1 -1
  272. package/lib/common/el/expression-engine.d.ts +62 -0
  273. package/lib/common/el/expression-engine.d.ts.map +1 -0
  274. package/lib/common/el/expression-engine.js +465 -0
  275. package/lib/common/el/expression-engine.js.map +1 -0
  276. package/lib/common/el/expression-engine.spec.d.ts +2 -0
  277. package/lib/common/el/expression-engine.spec.d.ts.map +1 -0
  278. package/lib/common/el/expression-engine.spec.js +100 -0
  279. package/lib/common/el/expression-engine.spec.js.map +1 -0
  280. package/lib/common/el/expression-handler.d.ts +8 -4
  281. package/lib/common/el/expression-handler.d.ts.map +1 -1
  282. package/lib/common/el/expression-handler.js +14 -60
  283. package/lib/common/el/expression-handler.js.map +1 -1
  284. package/lib/common/el/expression-handler.spec.d.ts +2 -0
  285. package/lib/common/el/expression-handler.spec.d.ts.map +1 -0
  286. package/lib/common/el/expression-handler.spec.js +98 -0
  287. package/lib/common/el/expression-handler.spec.js.map +1 -0
  288. package/lib/common/el/expression-protocol.d.ts +3 -5
  289. package/lib/common/el/expression-protocol.d.ts.map +1 -1
  290. package/lib/common/el/expression-protocol.js +1 -2
  291. package/lib/common/el/expression-protocol.js.map +1 -1
  292. package/lib/common/el/expression-util.d.ts +70 -0
  293. package/lib/common/el/expression-util.d.ts.map +1 -0
  294. package/lib/common/el/expression-util.js +351 -0
  295. package/lib/common/el/expression-util.js.map +1 -0
  296. package/lib/common/el/expression-util.spec.d.ts +2 -0
  297. package/lib/common/el/expression-util.spec.d.ts.map +1 -0
  298. package/lib/common/el/expression-util.spec.js +45 -0
  299. package/lib/common/el/expression-util.spec.js.map +1 -0
  300. package/lib/common/el/index.d.ts +3 -1
  301. package/lib/common/el/index.d.ts.map +1 -1
  302. package/lib/common/el/index.js +3 -1
  303. package/lib/common/el/index.js.map +1 -1
  304. package/lib/common/el/value-and-el.spec.d.ts +2 -0
  305. package/lib/common/el/value-and-el.spec.d.ts.map +1 -0
  306. package/lib/common/el/value-and-el.spec.js +216 -0
  307. package/lib/common/el/value-and-el.spec.js.map +1 -0
  308. package/lib/common/logger/abstract-logger.d.ts +4 -2
  309. package/lib/common/logger/abstract-logger.d.ts.map +1 -1
  310. package/lib/common/logger/abstract-logger.js +10 -5
  311. package/lib/common/logger/abstract-logger.js.map +1 -1
  312. package/lib/common/logger/logger-protocol.d.ts +4 -0
  313. package/lib/common/logger/logger-protocol.d.ts.map +1 -1
  314. package/lib/common/logger/logger-protocol.js +3 -1
  315. package/lib/common/logger/logger-protocol.js.map +1 -1
  316. package/lib/common/logger/logger.js +7 -7
  317. package/lib/common/logger/logger.js.map +1 -1
  318. package/lib/common/logger/logger.spec.d.ts +2 -0
  319. package/lib/common/logger/logger.spec.d.ts.map +1 -0
  320. package/lib/common/logger/logger.spec.js +57 -0
  321. package/lib/common/logger/logger.spec.js.map +1 -0
  322. package/lib/common/provider/index.d.ts +0 -1
  323. package/lib/common/provider/index.d.ts.map +1 -1
  324. package/lib/common/provider/index.js +0 -1
  325. package/lib/common/provider/index.js.map +1 -1
  326. package/lib/common/provider/provider-protocol.d.ts +5 -9
  327. package/lib/common/provider/provider-protocol.d.ts.map +1 -1
  328. package/lib/common/provider/provider-protocol.js +1 -2
  329. package/lib/common/provider/provider-protocol.js.map +1 -1
  330. package/lib/common/provider/provider-util.d.ts +1 -1
  331. package/lib/common/provider/provider-util.d.ts.map +1 -1
  332. package/lib/common/provider/provider-util.js +2 -2
  333. package/lib/common/provider/provider-util.js.map +1 -1
  334. package/lib/common/provider/provider.d.ts +7 -6
  335. package/lib/common/provider/provider.d.ts.map +1 -1
  336. package/lib/common/provider/provider.js +16 -26
  337. package/lib/common/provider/provider.js.map +1 -1
  338. package/lib/common/static-module.d.ts +1 -1
  339. package/lib/common/static-module.js +2 -2
  340. package/lib/common/static-module.js.map +1 -1
  341. package/lib/common/test/mock-logger.d.ts +1 -0
  342. package/lib/common/test/mock-logger.d.ts.map +1 -1
  343. package/lib/common/test/mock-logger.js +5 -12
  344. package/lib/common/test/mock-logger.js.map +1 -1
  345. package/lib/common/test/test-module.d.ts +1 -1
  346. package/lib/common/test/test-module.d.ts.map +1 -1
  347. package/lib/common/test/test-module.js +2 -2
  348. package/lib/common/test/test-module.js.map +1 -1
  349. package/lib/common/utils/annotation-util.js +2 -1
  350. package/lib/common/utils/annotation-util.js.map +1 -1
  351. package/lib/common/utils/emitter.d.ts +1 -10
  352. package/lib/common/utils/emitter.d.ts.map +1 -1
  353. package/lib/common/utils/emitter.js +1 -58
  354. package/lib/common/utils/emitter.js.map +1 -1
  355. package/lib/common/utils/mime-type-util.js +1 -1
  356. package/lib/common/utils/mime-type-util.js.map +1 -1
  357. package/lib/common/utils/mime-type.js +1 -1
  358. package/lib/common/utils/mime-type.js.map +1 -1
  359. package/lib/common/utils/proxy-util.d.ts +5 -2
  360. package/lib/common/utils/proxy-util.d.ts.map +1 -1
  361. package/lib/common/utils/proxy-util.js +12 -30
  362. package/lib/common/utils/proxy-util.js.map +1 -1
  363. package/lib/common/utils/utils-behavior.spec.d.ts +2 -0
  364. package/lib/common/utils/utils-behavior.spec.d.ts.map +1 -0
  365. package/lib/common/utils/utils-behavior.spec.js +232 -0
  366. package/lib/common/utils/utils-behavior.spec.js.map +1 -0
  367. package/lib/node/context/context.d.ts +11 -2
  368. package/lib/node/context/context.d.ts.map +1 -1
  369. package/lib/node/context/context.js +36 -10
  370. package/lib/node/context/context.js.map +1 -1
  371. package/lib/node/context/context.spec.d.ts +2 -0
  372. package/lib/node/context/context.spec.d.ts.map +1 -0
  373. package/lib/node/context/context.spec.js +202 -0
  374. package/lib/node/context/context.spec.js.map +1 -0
  375. package/lib/node/index.d.ts +0 -1
  376. package/lib/node/index.d.ts.map +1 -1
  377. package/lib/node/index.js +0 -1
  378. package/lib/node/index.js.map +1 -1
  379. package/lib/node/static-module.d.ts +1 -1
  380. package/package.json +9 -21
  381. package/src/common/annotation/aspect.ts +2 -1
  382. package/src/common/annotation/autowired-provider.ts +4 -17
  383. package/src/common/annotation/autowired.ts +14 -6
  384. package/src/common/annotation/component.ts +6 -26
  385. package/src/common/annotation/constant.ts +10 -7
  386. package/src/common/annotation/detached/autowired-provider.ts +2 -2
  387. package/src/common/annotation/index.ts +0 -6
  388. package/src/common/annotation/named.ts +7 -1
  389. package/src/common/annotation/optional.ts +6 -1
  390. package/src/common/annotation/post-construct.ts +6 -1
  391. package/src/common/annotation/tagged.ts +8 -1
  392. package/src/common/annotation/value.ts +9 -11
  393. package/src/common/aop/aop-proxy-factory.ts +52 -30
  394. package/src/common/aop/aop.spec.ts +145 -0
  395. package/src/common/aop/class-filter.ts +6 -6
  396. package/src/common/application/application-factory.ts +4 -5
  397. package/src/common/application/application-protocol.ts +1 -1
  398. package/src/common/application/lifecycle.spec.ts +148 -0
  399. package/src/common/config/config-provider.ts +1 -1
  400. package/src/common/container/assembly.spec.ts +288 -0
  401. package/src/common/container/auto-bind.ts +56 -74
  402. package/src/common/container/container-error.ts +31 -0
  403. package/src/common/container/container-provider.ts +9 -7
  404. package/src/common/container/container-util.ts +8 -19
  405. package/src/common/container/container.spec.ts +262 -0
  406. package/src/common/container/container.ts +363 -0
  407. package/src/common/container/dynamic-container.ts +2 -2
  408. package/src/common/container/index.ts +5 -7
  409. package/src/common/container/injection.ts +135 -0
  410. package/src/common/container/scope.ts +2 -1
  411. package/src/common/el/application-expression-engine.ts +9 -0
  412. package/src/common/el/core-context-initializer.ts +9 -8
  413. package/src/common/el/expression-compiler.ts +9 -168
  414. package/src/common/el/expression-engine.spec.ts +107 -0
  415. package/src/common/el/expression-engine.ts +487 -0
  416. package/src/common/el/expression-handler.spec.ts +109 -0
  417. package/src/common/el/expression-handler.ts +17 -57
  418. package/src/common/el/expression-protocol.ts +4 -8
  419. package/src/common/el/expression-util.spec.ts +45 -0
  420. package/src/common/el/expression-util.ts +362 -0
  421. package/src/common/el/index.ts +3 -1
  422. package/src/common/el/value-and-el.spec.ts +186 -0
  423. package/src/common/logger/abstract-logger.ts +12 -6
  424. package/src/common/logger/logger-protocol.ts +5 -0
  425. package/src/common/logger/logger.spec.ts +61 -0
  426. package/src/common/logger/logger.ts +7 -7
  427. package/src/common/provider/index.ts +0 -2
  428. package/src/common/provider/provider-protocol.ts +5 -11
  429. package/src/common/provider/provider-util.ts +3 -3
  430. package/src/common/provider/provider.ts +17 -29
  431. package/src/common/static-module.ts +1 -1
  432. package/src/common/test/mock-logger.ts +3 -2
  433. package/src/common/test/test-module.ts +1 -1
  434. package/src/common/utils/annotation-util.ts +2 -2
  435. package/src/common/utils/emitter.ts +1 -63
  436. package/src/common/utils/mime-type-util.ts +1 -1
  437. package/src/common/utils/mime-type.ts +1 -1
  438. package/src/common/utils/proxy-util.ts +8 -28
  439. package/src/common/utils/utils-behavior.spec.ts +259 -0
  440. package/src/node/context/context.spec.ts +219 -0
  441. package/src/node/context/context.ts +35 -10
  442. package/src/node/index.ts +0 -1
  443. package/esm/common/annotation/decorate.d.ts +0 -1
  444. package/esm/common/annotation/decorate.js +0 -2
  445. package/esm/common/annotation/decorate.js.map +0 -1
  446. package/esm/common/annotation/inject.d.ts +0 -1
  447. package/esm/common/annotation/inject.js +0 -2
  448. package/esm/common/annotation/inject.js.map +0 -1
  449. package/esm/common/annotation/injectable.d.ts +0 -1
  450. package/esm/common/annotation/injectable.js +0 -2
  451. package/esm/common/annotation/injectable.js.map +0 -1
  452. package/esm/common/annotation/pre-destroy.d.ts +0 -1
  453. package/esm/common/annotation/pre-destroy.js +0 -2
  454. package/esm/common/annotation/pre-destroy.js.map +0 -1
  455. package/esm/common/annotation/target-name.d.ts +0 -1
  456. package/esm/common/annotation/target-name.js +0 -2
  457. package/esm/common/annotation/target-name.js.map +0 -1
  458. package/esm/common/annotation/unmanaged.d.ts +0 -1
  459. package/esm/common/annotation/unmanaged.js +0 -2
  460. package/esm/common/annotation/unmanaged.js.map +0 -1
  461. package/esm/common/container/container-factory.d.ts +0 -4
  462. package/esm/common/container/container-factory.js +0 -9
  463. package/esm/common/container/container-factory.js.map +0 -1
  464. package/esm/common/el/jexl-engine-provider.d.ts +0 -5
  465. package/esm/common/el/jexl-engine-provider.js +0 -22
  466. package/esm/common/el/jexl-engine-provider.js.map +0 -1
  467. package/esm/common/provider/provider-creator.d.ts +0 -6
  468. package/esm/common/provider/provider-creator.js.map +0 -1
  469. package/esm/node/utils/crc.d.ts +0 -1
  470. package/esm/node/utils/crc.js +0 -7
  471. package/esm/node/utils/crc.js.map +0 -1
  472. package/esm/node/utils/index.d.ts +0 -1
  473. package/esm/node/utils/index.js +0 -2
  474. package/esm/node/utils/index.js.map +0 -1
  475. package/lib/common/annotation/decorate.d.ts +0 -2
  476. package/lib/common/annotation/decorate.d.ts.map +0 -1
  477. package/lib/common/annotation/decorate.js +0 -6
  478. package/lib/common/annotation/decorate.js.map +0 -1
  479. package/lib/common/annotation/inject.d.ts +0 -2
  480. package/lib/common/annotation/inject.d.ts.map +0 -1
  481. package/lib/common/annotation/inject.js +0 -6
  482. package/lib/common/annotation/inject.js.map +0 -1
  483. package/lib/common/annotation/injectable.d.ts +0 -2
  484. package/lib/common/annotation/injectable.d.ts.map +0 -1
  485. package/lib/common/annotation/injectable.js +0 -6
  486. package/lib/common/annotation/injectable.js.map +0 -1
  487. package/lib/common/annotation/pre-destroy.d.ts +0 -2
  488. package/lib/common/annotation/pre-destroy.d.ts.map +0 -1
  489. package/lib/common/annotation/pre-destroy.js +0 -6
  490. package/lib/common/annotation/pre-destroy.js.map +0 -1
  491. package/lib/common/annotation/target-name.d.ts +0 -2
  492. package/lib/common/annotation/target-name.d.ts.map +0 -1
  493. package/lib/common/annotation/target-name.js +0 -6
  494. package/lib/common/annotation/target-name.js.map +0 -1
  495. package/lib/common/annotation/unmanaged.d.ts +0 -2
  496. package/lib/common/annotation/unmanaged.d.ts.map +0 -1
  497. package/lib/common/annotation/unmanaged.js +0 -6
  498. package/lib/common/annotation/unmanaged.js.map +0 -1
  499. package/lib/common/container/container-factory.d.ts +0 -5
  500. package/lib/common/container/container-factory.d.ts.map +0 -1
  501. package/lib/common/container/container-factory.js +0 -13
  502. package/lib/common/container/container-factory.js.map +0 -1
  503. package/lib/common/el/jexl-engine-provider.d.ts +0 -6
  504. package/lib/common/el/jexl-engine-provider.d.ts.map +0 -1
  505. package/lib/common/el/jexl-engine-provider.js +0 -25
  506. package/lib/common/el/jexl-engine-provider.js.map +0 -1
  507. package/lib/common/provider/provider-creator.d.ts +0 -7
  508. package/lib/common/provider/provider-creator.d.ts.map +0 -1
  509. package/lib/common/provider/provider-creator.js +0 -22
  510. package/lib/common/provider/provider-creator.js.map +0 -1
  511. package/lib/node/utils/crc.d.ts +0 -2
  512. package/lib/node/utils/crc.d.ts.map +0 -1
  513. package/lib/node/utils/crc.js +0 -10
  514. package/lib/node/utils/crc.js.map +0 -1
  515. package/lib/node/utils/index.d.ts +0 -2
  516. package/lib/node/utils/index.d.ts.map +0 -1
  517. package/lib/node/utils/index.js +0 -18
  518. package/lib/node/utils/index.js.map +0 -1
  519. package/src/common/annotation/decorate.ts +0 -1
  520. package/src/common/annotation/inject.ts +0 -1
  521. package/src/common/annotation/injectable.ts +0 -1
  522. package/src/common/annotation/pre-destroy.ts +0 -1
  523. package/src/common/annotation/target-name.ts +0 -1
  524. package/src/common/annotation/unmanaged.ts +0 -1
  525. package/src/common/container/container-factory.ts +0 -9
  526. package/src/common/el/jexl-engine-provider.ts +0 -18
  527. package/src/common/provider/provider-creator.ts +0 -12
  528. package/src/node/utils/crc.ts +0 -7
  529. package/src/node/utils/index.ts +0 -1
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Container = exports.ContainerModule = exports.Binding = void 0;
4
+ const container_error_1 = require("./container-error");
5
+ const injection_1 = require("./injection");
6
+ const scope_1 = require("./scope");
7
+ /** How an identifier is resolved: a class, a constant, a factory or another identifier. */
8
+ class Binding {
9
+ constructor(id) {
10
+ this.id = id;
11
+ this.scope = scope_1.Scope.Transient;
12
+ /** Singletons and constants once created. */
13
+ this.resolved = false;
14
+ }
15
+ to(implementation) {
16
+ this.type = 'class';
17
+ this.implementation = implementation;
18
+ return this;
19
+ }
20
+ toConstantValue(value) {
21
+ this.type = 'constant';
22
+ this.value = value;
23
+ this.resolved = true;
24
+ this.scope = scope_1.Scope.Singleton;
25
+ return this;
26
+ }
27
+ toDynamicValue(factory) {
28
+ this.type = 'factory';
29
+ this.factory = factory;
30
+ return this;
31
+ }
32
+ /** Resolves another identifier: an alias, the same instance when that one is a singleton. */
33
+ toService(id) {
34
+ this.type = 'service';
35
+ this.service = id;
36
+ this.factory = context => context.container.get(id);
37
+ return this;
38
+ }
39
+ inSingletonScope() {
40
+ this.scope = scope_1.Scope.Singleton;
41
+ return this;
42
+ }
43
+ inTransientScope() {
44
+ this.scope = scope_1.Scope.Transient;
45
+ return this;
46
+ }
47
+ when(constraint, condition = 'when') {
48
+ this.constraint = constraint;
49
+ this.condition = condition;
50
+ return this;
51
+ }
52
+ whenTargetNamed(name) {
53
+ return this.when(target => target.name === name, `named ${String(name)}`);
54
+ }
55
+ whenTargetTagged(key, value) {
56
+ return this.when(target => target.tags !== undefined && target.tags[key] === value, `tagged ${String(key)}=${String(value)}`);
57
+ }
58
+ /** Only where nothing is asked for by name or tag. */
59
+ whenTargetIsDefault() {
60
+ return this.when(target => target.name === undefined && target.tags === undefined, 'default');
61
+ }
62
+ /** Called with each new instance (once for singletons); returns the instance to use, e.g. a proxy. */
63
+ onActivation(handler) {
64
+ this.activation = handler;
65
+ return this;
66
+ }
67
+ }
68
+ exports.Binding = Binding;
69
+ /** A set of bindings that {@link Container.load} adds; what a DI module file exports by default. */
70
+ class ContainerModule {
71
+ constructor(registry) {
72
+ this.registry = registry;
73
+ }
74
+ }
75
+ exports.ContainerModule = ContainerModule;
76
+ const EMPTY = [];
77
+ /**
78
+ * The dependency injection container: bindings by identifier, resolved synchronously. Classes get their
79
+ * constructor parameters and properties from the decorators (`@Autowired`, `@Value`, `@Optional`,
80
+ * `@Named`, `@Tagged`) and `@PostConstruct` is called once they are injected.
81
+ */
82
+ class Container {
83
+ constructor(...modules) {
84
+ this.map = new Map();
85
+ /** The bindings being resolved and what asked for them, outermost first; for cycles and error messages. */
86
+ this.resolving = [];
87
+ this.requests = [];
88
+ this.load(...modules);
89
+ }
90
+ load(...modules) {
91
+ const bind = (id) => this.bind(id);
92
+ const unbind = (id) => this.unbind(id);
93
+ const isBound = (id, query) => this.isBound(id, query);
94
+ const rebind = (id) => this.rebind(id);
95
+ for (const module of modules) {
96
+ module.registry(bind, unbind, isBound, rebind);
97
+ }
98
+ }
99
+ bind(id) {
100
+ const binding = new Binding(id);
101
+ const bindings = this.map.get(id);
102
+ if (bindings) {
103
+ bindings.push(binding);
104
+ }
105
+ else {
106
+ this.map.set(id, [binding]);
107
+ }
108
+ return binding;
109
+ }
110
+ /** Replaces the bindings of the identifier. */
111
+ rebind(id) {
112
+ this.unbind(id);
113
+ return this.bind(id);
114
+ }
115
+ unbind(id) {
116
+ this.map.delete(id);
117
+ }
118
+ /** Whether the identifier has a binding; with a query, one that matches it. */
119
+ isBound(id, query) {
120
+ return query ? this.matching({ ...query, id }).length > 0 : this.map.has(id);
121
+ }
122
+ /** The one binding of the identifier that matches the query; throws when there is none or more than one. */
123
+ get(id, query) {
124
+ return this.resolve(query ? { ...query, id } : { id });
125
+ }
126
+ /**
127
+ * Every binding of the identifier, whatever its constraint; with a query, the ones that match it.
128
+ * Throws when there is none.
129
+ */
130
+ getAll(id, query) {
131
+ return this.resolveAll(query ? { ...query, id } : { id }, !query);
132
+ }
133
+ /** Resolves an injection point: one instance, all of them (`multi`), or none when it is `optional`. */
134
+ resolve(target) {
135
+ if (target.multi) {
136
+ return this.resolveAll(target);
137
+ }
138
+ const bindings = this.matching(target);
139
+ if (bindings.length === 1) {
140
+ return this.instance(bindings[0], target);
141
+ }
142
+ if (bindings.length === 0 && target.optional) {
143
+ return undefined;
144
+ }
145
+ throw bindings.length === 0 ? this.noBinding(target) : this.ambiguous(target, bindings);
146
+ }
147
+ /** Every binding by identifier, in the order they were bound; for tools (`cell check`, the dev MCP endpoint). */
148
+ bindings() {
149
+ return this.map;
150
+ }
151
+ resolveAll(target, unconstrained = false) {
152
+ var _a;
153
+ const bindings = unconstrained ? (_a = this.map.get(target.id)) !== null && _a !== void 0 ? _a : EMPTY : this.matching(target);
154
+ if (bindings.length === 0 && !target.optional) {
155
+ throw this.noBinding(target);
156
+ }
157
+ const instances = new Array(bindings.length);
158
+ for (let i = 0; i < bindings.length; i++) {
159
+ instances[i] = this.instance(bindings[i], target);
160
+ }
161
+ return instances;
162
+ }
163
+ matching(target) {
164
+ const bindings = this.map.get(target.id);
165
+ if (!bindings) {
166
+ return EMPTY;
167
+ }
168
+ for (const binding of bindings) {
169
+ if (binding.constraint && !binding.constraint(target)) {
170
+ return bindings.filter(b => !b.constraint || b.constraint(target));
171
+ }
172
+ }
173
+ return bindings;
174
+ }
175
+ instance(binding, target) {
176
+ if (binding.resolved) {
177
+ return binding.value;
178
+ }
179
+ if (this.resolving.includes(binding)) {
180
+ throw this.circular(target);
181
+ }
182
+ this.resolving.push(binding);
183
+ this.requests.push(target);
184
+ try {
185
+ const context = { container: this, target };
186
+ let value;
187
+ if (binding.type === 'class') {
188
+ value = this.construct(binding.implementation);
189
+ }
190
+ else if (binding.factory) {
191
+ value = binding.factory(context);
192
+ }
193
+ else {
194
+ throw new container_error_1.ContainerError({
195
+ code: 'CELL_DI_INCOMPLETE_BINDING',
196
+ message: `The binding of ${Container.idName(binding.id)} says nothing to resolve it to.`,
197
+ hint: 'Complete bind(id) with .to(Class), .toConstantValue(value), .toDynamicValue(factory) or .toService(id).',
198
+ path: this.path()
199
+ });
200
+ }
201
+ if (binding.activation) {
202
+ value = binding.activation(context, value);
203
+ }
204
+ if (binding.scope === scope_1.Scope.Singleton) {
205
+ binding.value = value;
206
+ binding.resolved = true;
207
+ }
208
+ return value;
209
+ }
210
+ finally {
211
+ this.resolving.pop();
212
+ this.requests.pop();
213
+ }
214
+ }
215
+ construct(type) {
216
+ const plan = injection_1.InjectionUtil.plan(type);
217
+ const parameters = plan.parameters;
218
+ const args = new Array(parameters.length);
219
+ for (let i = 0; i < parameters.length; i++) {
220
+ args[i] = this.resolve(parameters[i]);
221
+ }
222
+ const instance = new type(...args);
223
+ for (const property of plan.properties) {
224
+ const value = this.resolve(property);
225
+ // Like a default parameter: an optional property that nothing is bound to keeps its initial value.
226
+ if (value !== undefined || !property.optional) {
227
+ instance[property.key] = value;
228
+ }
229
+ }
230
+ if (plan.postConstruct !== undefined) {
231
+ instance[plan.postConstruct]();
232
+ }
233
+ return instance;
234
+ }
235
+ /** The identifiers being resolved, outermost first, then the one of `target`. */
236
+ path(target) {
237
+ const path = this.requests.map(request => Container.idName(request.id));
238
+ return target ? [...path, Container.idName(target.id)] : path;
239
+ }
240
+ neededBy(target) {
241
+ return target.owner ? `, needed by ${injection_1.InjectionUtil.describe(target)}` : '';
242
+ }
243
+ noBinding(target) {
244
+ var _a;
245
+ const path = this.path(target);
246
+ const name = Container.idName(target.id);
247
+ const bound = (_a = this.map.get(target.id)) !== null && _a !== void 0 ? _a : [];
248
+ let candidates = '';
249
+ if (bound.length > 0) {
250
+ candidates = ` The bindings of ${name} do not match: ${bound.map(Container.describe).join(', ')}.`;
251
+ }
252
+ else if ([...this.map.keys()].some(id => id !== target.id && Container.idName(id) === name)) {
253
+ candidates = ` Another identifier is also named ${name}: two copies of the module that declares it are loaded.`;
254
+ }
255
+ return new container_error_1.ContainerError({
256
+ code: 'CELL_DI_NO_BINDING',
257
+ message: `No binding for ${Container.describe({ id: target.id, ...Container.query(target) })}${this.neededBy(target)}${Container.chain(path)}.${candidates}`,
258
+ hint: 'Bind the identifier in a DI module (@Component(<id>) in a file the module imports), or mark the injection @Optional().',
259
+ path
260
+ });
261
+ }
262
+ ambiguous(target, bindings) {
263
+ const path = this.path(target);
264
+ return new container_error_1.ContainerError({
265
+ code: 'CELL_DI_AMBIGUOUS',
266
+ message: `${bindings.length} bindings match ${Container.idName(target.id)}${this.neededBy(target)}${Container.chain(path)}: ${bindings.map(Container.describe).join(', ')}.`,
267
+ hint: 'Inject all of them with @Autowired on an array, give one rebind: true to replace the others, or select one with @Named / @Tagged.',
268
+ path
269
+ });
270
+ }
271
+ circular(target) {
272
+ const path = this.path(target);
273
+ return new container_error_1.ContainerError({
274
+ code: 'CELL_DI_CIRCULAR',
275
+ message: `Circular dependency: ${path.join(' → ')}.`,
276
+ hint: 'Break the cycle: get one side lazily (a Provider, or @Autowired({ detached: true }) on a property), or move the shared part into another component.',
277
+ path
278
+ });
279
+ }
280
+ static chain(path) {
281
+ return path.length > 1 ? ` (${path.join(' → ')})` : '';
282
+ }
283
+ static query(target) {
284
+ return { name: target.name, tags: target.tags };
285
+ }
286
+ /** `RedisStore [named redis]`, `Symbol(Store) named redis`. */
287
+ static describe(binding) {
288
+ var _a;
289
+ if (binding instanceof Binding) {
290
+ const what = binding.type === 'class' ? binding.implementation.name || '(anonymous class)'
291
+ : binding.type === 'service' ? `→ ${Container.idName(binding.service)}` : ((_a = binding.type) !== null && _a !== void 0 ? _a : 'incomplete');
292
+ return binding.condition ? `${what} [${binding.condition}]` : what;
293
+ }
294
+ const tags = binding.tags ? Reflect.ownKeys(binding.tags).map(key => ` tagged ${String(key)}=${String(binding.tags[key])}`).join('') : '';
295
+ return `${Container.idName(binding.id)}${binding.name !== undefined ? ` named ${String(binding.name)}` : ''}${tags}`;
296
+ }
297
+ static idName(id) {
298
+ if (typeof id === 'function') {
299
+ return id.name || '(anonymous class)';
300
+ }
301
+ return String(id);
302
+ }
303
+ }
304
+ exports.Container = Container;
305
+ //# sourceMappingURL=container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.js","sourceRoot":"","sources":["../../../src/common/container/container.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AACnD,2CAA6D;AAC7D,mCAAgC;AAsBh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AC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,MAAM,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3I,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;IACzH,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,EAAW;QACrB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC3B,OAAO,EAAE,CAAC,IAAI,IAAI,mBAAmB,CAAC;QAC1C,CAAC;QACD,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=container.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.spec.d.ts","sourceRoot":"","sources":["../../../src/common/container/container.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,334 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const bun_test_1 = require("bun:test");
16
+ const chai_1 = require("chai");
17
+ const container_1 = require("./container");
18
+ const container_error_1 = require("./container-error");
19
+ const annotation_1 = require("../annotation");
20
+ const scope_1 = require("./scope");
21
+ /**
22
+ * The container on its own: bindings, constraints, injection by the decorators and its errors.
23
+ * The decorators only describe classes, so every test binds what it needs by hand.
24
+ */
25
+ function errorOf(fn) {
26
+ try {
27
+ fn();
28
+ }
29
+ catch (error) {
30
+ (0, chai_1.expect)(error).to.be.instanceOf(container_error_1.ContainerError);
31
+ return error;
32
+ }
33
+ throw new Error('expected a ContainerError');
34
+ }
35
+ (0, bun_test_1.describe)('Container', () => {
36
+ (0, bun_test_1.it)('binds a class, a constant, a factory and an alias; transient unless told otherwise', () => {
37
+ class A {
38
+ }
39
+ const Value1 = Symbol('Value1');
40
+ const Made = Symbol('Made');
41
+ const Alias = Symbol('Alias');
42
+ const c = new container_1.Container();
43
+ c.bind(A).to(A);
44
+ c.bind(Value1).toConstantValue(42);
45
+ let made = 0;
46
+ c.bind(Made).toDynamicValue(() => ++made).inSingletonScope();
47
+ c.bind(Alias).toService(Value1);
48
+ (0, chai_1.expect)(c.get(A)).to.be.instanceOf(A);
49
+ (0, chai_1.expect)(c.get(A)).not.to.equal(c.get(A));
50
+ (0, chai_1.expect)(c.get(Value1)).to.equal(42);
51
+ (0, chai_1.expect)([c.get(Made), c.get(Made)]).to.deep.equal([1, 1]);
52
+ (0, chai_1.expect)(c.get(Alias)).to.equal(42);
53
+ });
54
+ (0, bun_test_1.it)('loads modules: bind, unbind, isBound and rebind', () => {
55
+ const Id = Symbol('Id');
56
+ const c = new container_1.Container(new container_1.ContainerModule((bind, unbind, isBound, rebind) => {
57
+ bind(Id).toConstantValue('a');
58
+ (0, chai_1.expect)(isBound(Id)).to.equal(true);
59
+ rebind(Id).toConstantValue('b');
60
+ }));
61
+ (0, chai_1.expect)(c.getAll(Id)).to.deep.equal(['b']);
62
+ c.unbind(Id);
63
+ (0, chai_1.expect)(c.isBound(Id)).to.equal(false);
64
+ });
65
+ (0, bun_test_1.it)('selects bindings by name and tag; unconstrained bindings match any query, default ones only plain requests', () => {
66
+ const Store = Symbol('Store');
67
+ const c = new container_1.Container();
68
+ c.bind(Store).toConstantValue('redis').whenTargetNamed('redis');
69
+ c.bind(Store).toConstantValue('eu').whenTargetTagged('region', 'eu');
70
+ c.bind(Store).toConstantValue('memory').whenTargetIsDefault();
71
+ (0, chai_1.expect)(c.get(Store)).to.equal('memory');
72
+ (0, chai_1.expect)(c.get(Store, { name: 'redis' })).to.equal('redis');
73
+ (0, chai_1.expect)(c.get(Store, { tags: { region: 'eu' } })).to.equal('eu');
74
+ (0, chai_1.expect)(c.isBound(Store, { name: 'mongo' })).to.equal(false);
75
+ // Without a query, getAll and isBound take every binding, whatever its constraint.
76
+ (0, chai_1.expect)(c.getAll(Store)).to.deep.equal(['redis', 'eu', 'memory']);
77
+ (0, chai_1.expect)(c.isBound(Store)).to.equal(true);
78
+ c.bind(Store).toConstantValue('any');
79
+ (0, chai_1.expect)(c.getAll(Store, { name: 'redis' })).to.deep.equal(['redis', 'any']);
80
+ });
81
+ (0, bun_test_1.it)('injects constructor parameters, properties and @Value, then calls @PostConstruct once', () => {
82
+ const Clock = Symbol('Clock');
83
+ const calls = [];
84
+ let Service = class Service {
85
+ constructor(first) {
86
+ this.first = first;
87
+ }
88
+ init() {
89
+ calls.push(`init ${this.first} ${this.clock} ${this.answer}`);
90
+ }
91
+ };
92
+ __decorate([
93
+ (0, annotation_1.Autowired)(Clock),
94
+ __metadata("design:type", Number)
95
+ ], Service.prototype, "clock", void 0);
96
+ __decorate([
97
+ (0, annotation_1.Value)('answer'),
98
+ __metadata("design:type", Number)
99
+ ], Service.prototype, "answer", void 0);
100
+ __decorate([
101
+ (0, annotation_1.PostConstruct)(),
102
+ __metadata("design:type", Function),
103
+ __metadata("design:paramtypes", []),
104
+ __metadata("design:returntype", void 0)
105
+ ], Service.prototype, "init", null);
106
+ Service = __decorate([
107
+ __param(0, (0, annotation_1.Autowired)(Clock)),
108
+ __metadata("design:paramtypes", [Number])
109
+ ], Service);
110
+ const c = new container_1.Container();
111
+ c.bind(Clock).toConstantValue(7);
112
+ c.bind(annotation_1.VALUE).toDynamicValue(({ target }) => target.name === 'answer' ? 42 : undefined);
113
+ c.bind(Service).to(Service).inSingletonScope();
114
+ c.get(Service);
115
+ c.get(Service);
116
+ (0, chai_1.expect)(calls).to.deep.equal(['init 7 7 42']);
117
+ });
118
+ (0, bun_test_1.it)('takes constructor parameters without @Autowired from their declared class', () => {
119
+ class Dep {
120
+ }
121
+ class Uses {
122
+ constructor(dep) {
123
+ this.dep = dep;
124
+ }
125
+ }
126
+ Reflect.defineMetadata('design:paramtypes', [Dep], Uses);
127
+ const c = new container_1.Container();
128
+ c.bind(Dep).to(Dep).inSingletonScope();
129
+ c.bind(Uses).to(Uses);
130
+ (0, chai_1.expect)(c.get(Uses).dep).to.equal(c.get(Dep));
131
+ });
132
+ (0, bun_test_1.it)('subclasses inherit injected properties, @PostConstruct and the constructor of their parent', () => {
133
+ const Dep = Symbol('Dep');
134
+ let Base = class Base {
135
+ constructor(fromConstructor) {
136
+ this.fromConstructor = fromConstructor;
137
+ this.initialized = false;
138
+ }
139
+ init() {
140
+ this.initialized = true;
141
+ }
142
+ };
143
+ __decorate([
144
+ (0, annotation_1.Autowired)(Dep),
145
+ __metadata("design:type", String)
146
+ ], Base.prototype, "fromBase", void 0);
147
+ __decorate([
148
+ (0, annotation_1.PostConstruct)(),
149
+ __metadata("design:type", Function),
150
+ __metadata("design:paramtypes", []),
151
+ __metadata("design:returntype", void 0)
152
+ ], Base.prototype, "init", null);
153
+ Base = __decorate([
154
+ __param(0, (0, annotation_1.Autowired)(Dep)),
155
+ __metadata("design:paramtypes", [String])
156
+ ], Base);
157
+ class Derived extends Base {
158
+ }
159
+ __decorate([
160
+ (0, annotation_1.Autowired)(Dep),
161
+ (0, annotation_1.Named)('other'),
162
+ __metadata("design:type", String)
163
+ ], Derived.prototype, "own", void 0);
164
+ const c = new container_1.Container();
165
+ c.bind(Dep).toConstantValue('plain').whenTargetIsDefault();
166
+ c.bind(Dep).toConstantValue('other').whenTargetNamed('other');
167
+ c.bind(Derived).to(Derived);
168
+ const d = c.get(Derived);
169
+ (0, chai_1.expect)([d.fromBase, d.fromConstructor, d.own, d.initialized]).to.deep.equal(['plain', 'plain', 'other', true]);
170
+ });
171
+ (0, bun_test_1.it)('@Optional: undefined or [] when nothing is bound; an optional property keeps its initial value', () => {
172
+ const Missing = Symbol('Missing');
173
+ let Tolerant = class Tolerant {
174
+ constructor(param = 'default') {
175
+ this.param = param;
176
+ this.one = 'initial';
177
+ }
178
+ };
179
+ __decorate([
180
+ (0, annotation_1.Autowired)(Missing),
181
+ (0, annotation_1.Optional)(),
182
+ __metadata("design:type", String)
183
+ ], Tolerant.prototype, "one", void 0);
184
+ __decorate([
185
+ (0, annotation_1.Autowired)({ id: Missing, multi: true }),
186
+ (0, annotation_1.Optional)(),
187
+ __metadata("design:type", Array)
188
+ ], Tolerant.prototype, "many", void 0);
189
+ Tolerant = __decorate([
190
+ __param(0, (0, annotation_1.Autowired)(Missing)),
191
+ __param(0, (0, annotation_1.Optional)()),
192
+ __metadata("design:paramtypes", [Object])
193
+ ], Tolerant);
194
+ const c = new container_1.Container();
195
+ c.bind(Tolerant).to(Tolerant);
196
+ const t = c.get(Tolerant);
197
+ (0, chai_1.expect)([t.one, t.many, t.param]).to.deep.equal(['initial', [], 'default']);
198
+ });
199
+ (0, bun_test_1.it)('@Tagged on an injection point', () => {
200
+ const Store = Symbol('TaggedStore');
201
+ class Consumer {
202
+ }
203
+ __decorate([
204
+ (0, annotation_1.Autowired)(Store),
205
+ (0, annotation_1.Tagged)('region', 'eu'),
206
+ __metadata("design:type", String)
207
+ ], Consumer.prototype, "store", void 0);
208
+ const c = new container_1.Container();
209
+ c.bind(Store).toConstantValue('us').whenTargetTagged('region', 'us');
210
+ c.bind(Store).toConstantValue('eu').whenTargetTagged('region', 'eu');
211
+ c.bind(Consumer).to(Consumer);
212
+ (0, chai_1.expect)(c.get(Consumer).store).to.equal('eu');
213
+ });
214
+ (0, bun_test_1.it)('gives factories and activation handlers the injection point', () => {
215
+ const Logger = Symbol('Logger');
216
+ class Owner {
217
+ }
218
+ __decorate([
219
+ (0, annotation_1.Autowired)(Logger),
220
+ __metadata("design:type", String)
221
+ ], Owner.prototype, "logger", void 0);
222
+ const c = new container_1.Container();
223
+ c.bind(Logger).toDynamicValue(({ target }) => { var _a; return `logger of ${(_a = target.owner) === null || _a === void 0 ? void 0 : _a.name}.${String(target.key)}`; });
224
+ c.bind(Owner).to(Owner).onActivation((context, instance) => Object.assign(instance, { activated: context.target.id === Owner }));
225
+ const o = c.get(Owner);
226
+ (0, chai_1.expect)(o.logger).to.equal('logger of Owner.logger');
227
+ (0, chai_1.expect)(o.activated).to.equal(true);
228
+ });
229
+ (0, bun_test_1.it)('lists its bindings for tools', () => {
230
+ class A {
231
+ }
232
+ const Named1 = Symbol('Named1');
233
+ const c = new container_1.Container();
234
+ c.bind(A).to(A).inSingletonScope();
235
+ c.bind(Named1).toService(A).whenTargetNamed('x');
236
+ const rows = [...c.bindings()].flatMap(([id, bindings]) => bindings.map(b => [container_1.Container.idName(id), b.type, b.scope, b.condition]));
237
+ (0, chai_1.expect)(rows).to.deep.equal([['A', 'class', scope_1.Scope.Singleton, undefined], ['Symbol(Named1)', 'service', scope_1.Scope.Transient, 'named x']]);
238
+ });
239
+ (0, bun_test_1.describe)('errors', () => {
240
+ (0, bun_test_1.it)('CELL_DI_NO_BINDING names the identifier, who needs it and the chain', () => {
241
+ const Mailer = Symbol('Mailer');
242
+ class Signup {
243
+ }
244
+ __decorate([
245
+ (0, annotation_1.Autowired)(Mailer),
246
+ __metadata("design:type", Object)
247
+ ], Signup.prototype, "mailer", void 0);
248
+ let Controller = class Controller {
249
+ constructor(signup) {
250
+ this.signup = signup;
251
+ }
252
+ };
253
+ Controller = __decorate([
254
+ __param(0, (0, annotation_1.Autowired)(Signup)),
255
+ __metadata("design:paramtypes", [Signup])
256
+ ], Controller);
257
+ const c = new container_1.Container();
258
+ c.bind(Signup).to(Signup);
259
+ c.bind(Controller).to(Controller);
260
+ const error = errorOf(() => c.get(Controller));
261
+ (0, chai_1.expect)(error.code).to.equal('CELL_DI_NO_BINDING');
262
+ (0, chai_1.expect)(error.message).to.equal('No binding for Symbol(Mailer), needed by Signup.mailer (Controller → Signup → Symbol(Mailer)).');
263
+ (0, chai_1.expect)(error.path).to.deep.equal(['Controller', 'Signup', 'Symbol(Mailer)']);
264
+ (0, chai_1.expect)(error.hint).to.contain('@Optional()');
265
+ });
266
+ (0, bun_test_1.it)('CELL_DI_NO_BINDING lists the bindings that do not match, or a second identifier with the same name', () => {
267
+ const Store = Symbol('Store');
268
+ const c = new container_1.Container();
269
+ c.bind(Store).toConstantValue('redis').whenTargetNamed('redis');
270
+ (0, chai_1.expect)(errorOf(() => c.get(Store, { name: 'mongo' })).message)
271
+ .to.equal('No binding for Symbol(Store) named mongo. The bindings of Symbol(Store) do not match: constant [named redis].');
272
+ c.bind(Symbol('Twin')).toConstantValue(1);
273
+ (0, chai_1.expect)(errorOf(() => c.get(Symbol('Twin'))).message).to.contain('two copies of the module that declares it are loaded');
274
+ });
275
+ (0, bun_test_1.it)('CELL_DI_AMBIGUOUS lists the candidates', () => {
276
+ const Plugin = Symbol('Plugin');
277
+ class P1 {
278
+ }
279
+ class P2 {
280
+ }
281
+ const c = new container_1.Container();
282
+ c.bind(Plugin).to(P1);
283
+ c.bind(Plugin).to(P2);
284
+ const error = errorOf(() => c.get(Plugin));
285
+ (0, chai_1.expect)(error.code).to.equal('CELL_DI_AMBIGUOUS');
286
+ (0, chai_1.expect)(error.message).to.equal('2 bindings match Symbol(Plugin): P1, P2.');
287
+ (0, chai_1.expect)(c.getAll(Plugin)).to.have.length(2);
288
+ });
289
+ (0, bun_test_1.it)('CELL_DI_CIRCULAR shows the cycle, and the container still works afterwards', () => {
290
+ class A {
291
+ }
292
+ __decorate([
293
+ (0, annotation_1.Autowired)({ id: 'B' }),
294
+ __metadata("design:type", Object)
295
+ ], A.prototype, "b", void 0);
296
+ let B = class B {
297
+ constructor(a) {
298
+ this.a = a;
299
+ }
300
+ };
301
+ B = __decorate([
302
+ __param(0, (0, annotation_1.Autowired)(A)),
303
+ __metadata("design:paramtypes", [A])
304
+ ], B);
305
+ const c = new container_1.Container();
306
+ c.bind(A).to(A).inSingletonScope();
307
+ c.bind('B').to(B).inSingletonScope();
308
+ const error = errorOf(() => c.get(A));
309
+ (0, chai_1.expect)(error.code).to.equal('CELL_DI_CIRCULAR');
310
+ (0, chai_1.expect)(error.message).to.equal('Circular dependency: A → B → A.');
311
+ c.rebind('B').toConstantValue('b');
312
+ (0, chai_1.expect)(c.get(A).b).to.equal('b');
313
+ });
314
+ (0, bun_test_1.it)('CELL_DI_MISSING_INJECT for a parameter that names no identifier', () => {
315
+ class NoId {
316
+ constructor(options) {
317
+ this.options = options;
318
+ }
319
+ }
320
+ Reflect.defineMetadata('design:paramtypes', [Object], NoId);
321
+ const c = new container_1.Container();
322
+ c.bind(NoId).to(NoId);
323
+ const error = errorOf(() => c.get(NoId));
324
+ (0, chai_1.expect)(error.code).to.equal('CELL_DI_MISSING_INJECT');
325
+ (0, chai_1.expect)(error.message).to.contain('NoId constructor parameter #0');
326
+ });
327
+ (0, bun_test_1.it)('CELL_DI_INCOMPLETE_BINDING for bind() without a target', () => {
328
+ const c = new container_1.Container();
329
+ c.bind('nothing');
330
+ (0, chai_1.expect)(errorOf(() => c.get('nothing')).code).to.equal('CELL_DI_INCOMPLETE_BINDING');
331
+ });
332
+ });
333
+ });
334
+ //# sourceMappingURL=container.spec.js.map