inversify 6.1.4 → 6.1.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (529) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +6 -15
  3. package/{amd → lib/cjs}/annotation/decorator_utils.d.ts +1 -0
  4. package/lib/cjs/annotation/decorator_utils.d.ts.map +1 -0
  5. package/{es6 → lib/cjs}/annotation/decorator_utils.js +25 -7
  6. package/lib/cjs/annotation/decorator_utils.js.map +1 -0
  7. package/{es6 → lib/cjs}/annotation/inject.d.ts +1 -0
  8. package/lib/cjs/annotation/inject.d.ts.map +1 -0
  9. package/{es6 → lib/cjs}/annotation/inject.js +18 -7
  10. package/lib/cjs/annotation/inject.js.map +1 -0
  11. package/{amd → lib/cjs}/annotation/inject_base.d.ts +1 -0
  12. package/lib/cjs/annotation/inject_base.d.ts.map +1 -0
  13. package/{es6 → lib/cjs}/annotation/inject_base.js +2 -0
  14. package/lib/cjs/annotation/inject_base.js.map +1 -0
  15. package/{amd → lib/cjs}/annotation/injectable.d.ts +1 -0
  16. package/lib/cjs/annotation/injectable.d.ts.map +1 -0
  17. package/{es6 → lib/cjs}/annotation/injectable.js +19 -7
  18. package/lib/cjs/annotation/injectable.js.map +1 -0
  19. package/{es → lib/cjs}/annotation/multi_inject.d.ts +1 -0
  20. package/lib/cjs/annotation/multi_inject.d.ts.map +1 -0
  21. package/{es6 → lib/cjs}/annotation/multi_inject.js +18 -7
  22. package/lib/cjs/annotation/multi_inject.js.map +1 -0
  23. package/{amd → lib/cjs}/annotation/named.d.ts +1 -0
  24. package/lib/cjs/annotation/named.d.ts.map +1 -0
  25. package/{es6 → lib/cjs}/annotation/named.js +19 -7
  26. package/lib/cjs/annotation/named.js.map +1 -0
  27. package/{amd → lib/cjs}/annotation/optional.d.ts +1 -0
  28. package/lib/cjs/annotation/optional.d.ts.map +1 -0
  29. package/{es6 → lib/cjs}/annotation/optional.js +18 -7
  30. package/lib/cjs/annotation/optional.js.map +1 -0
  31. package/{amd → lib/cjs}/annotation/post_construct.d.ts +1 -0
  32. package/lib/cjs/annotation/post_construct.d.ts.map +1 -0
  33. package/{es6 → lib/cjs}/annotation/post_construct.js +18 -7
  34. package/lib/cjs/annotation/post_construct.js.map +1 -0
  35. package/{es6 → lib/cjs}/annotation/pre_destroy.d.ts +1 -0
  36. package/lib/cjs/annotation/pre_destroy.d.ts.map +1 -0
  37. package/{es6 → lib/cjs}/annotation/pre_destroy.js +18 -7
  38. package/lib/cjs/annotation/pre_destroy.js.map +1 -0
  39. package/{es → lib/cjs}/annotation/property_event_decorator.d.ts +1 -0
  40. package/lib/cjs/annotation/property_event_decorator.d.ts.map +1 -0
  41. package/{es6 → lib/cjs}/annotation/property_event_decorator.js +1 -0
  42. package/lib/cjs/annotation/property_event_decorator.js.map +1 -0
  43. package/{amd → lib/cjs}/annotation/tagged.d.ts +1 -0
  44. package/lib/cjs/annotation/tagged.d.ts.map +1 -0
  45. package/{es6 → lib/cjs}/annotation/tagged.js +2 -0
  46. package/lib/cjs/annotation/tagged.js.map +1 -0
  47. package/{es6 → lib/cjs}/annotation/target_name.d.ts +1 -0
  48. package/lib/cjs/annotation/target_name.d.ts.map +1 -0
  49. package/{es6 → lib/cjs}/annotation/target_name.js +18 -7
  50. package/lib/cjs/annotation/target_name.js.map +1 -0
  51. package/{es6 → lib/cjs}/annotation/unmanaged.d.ts +1 -0
  52. package/lib/cjs/annotation/unmanaged.d.ts.map +1 -0
  53. package/{es6 → lib/cjs}/annotation/unmanaged.js +18 -7
  54. package/lib/cjs/annotation/unmanaged.js.map +1 -0
  55. package/{es6 → lib/cjs}/bindings/binding.d.ts +1 -0
  56. package/lib/cjs/bindings/binding.d.ts.map +1 -0
  57. package/{es6 → lib/cjs}/bindings/binding.js +29 -0
  58. package/lib/cjs/bindings/binding.js.map +1 -0
  59. package/{amd → lib/cjs}/bindings/binding_count.d.ts +1 -0
  60. package/lib/cjs/bindings/binding_count.d.ts.map +1 -0
  61. package/lib/{bindings → cjs/bindings}/binding_count.js +1 -0
  62. package/lib/cjs/bindings/binding_count.js.map +1 -0
  63. package/{amd → lib/cjs}/constants/error_msgs.d.ts +1 -0
  64. package/lib/cjs/constants/error_msgs.d.ts.map +1 -0
  65. package/{es6 → lib/cjs}/constants/error_msgs.js +2 -0
  66. package/lib/cjs/constants/error_msgs.js.map +1 -0
  67. package/{es → lib/cjs}/constants/literal_types.d.ts +1 -0
  68. package/lib/cjs/constants/literal_types.d.ts.map +1 -0
  69. package/{es6 → lib/cjs}/constants/literal_types.js +4 -0
  70. package/lib/cjs/constants/literal_types.js.map +1 -0
  71. package/{amd → lib/cjs}/constants/metadata_keys.d.ts +1 -0
  72. package/lib/cjs/constants/metadata_keys.d.ts.map +1 -0
  73. package/{es6 → lib/cjs}/constants/metadata_keys.js +13 -0
  74. package/lib/cjs/constants/metadata_keys.js.map +1 -0
  75. package/{es6 → lib/cjs}/container/container.d.ts +3 -0
  76. package/lib/cjs/container/container.d.ts.map +1 -0
  77. package/{es6 → lib/cjs}/container/container.js +157 -147
  78. package/lib/cjs/container/container.js.map +1 -0
  79. package/{amd → lib/cjs}/container/container_module.d.ts +1 -0
  80. package/lib/cjs/container/container_module.d.ts.map +1 -0
  81. package/{es6 → lib/cjs}/container/container_module.js +5 -0
  82. package/lib/cjs/container/container_module.js.map +1 -0
  83. package/{es → lib/cjs}/container/container_snapshot.d.ts +1 -0
  84. package/lib/cjs/container/container_snapshot.d.ts.map +1 -0
  85. package/{es6 → lib/cjs}/container/container_snapshot.js +6 -0
  86. package/lib/cjs/container/container_snapshot.js.map +1 -0
  87. package/{es → lib/cjs}/container/lookup.d.ts +1 -0
  88. package/lib/cjs/container/lookup.d.ts.map +1 -0
  89. package/{es6 → lib/cjs}/container/lookup.js +26 -7
  90. package/lib/cjs/container/lookup.js.map +1 -0
  91. package/{es6 → lib/cjs}/container/module_activation_store.d.ts +3 -2
  92. package/lib/cjs/container/module_activation_store.d.ts.map +1 -0
  93. package/{es6 → lib/cjs}/container/module_activation_store.js +2 -3
  94. package/lib/cjs/container/module_activation_store.js.map +1 -0
  95. package/{amd/inversify.d.ts → lib/cjs/index.d.ts} +2 -0
  96. package/lib/cjs/index.d.ts.map +1 -0
  97. package/{es6/inversify.js → lib/cjs/index.js} +20 -7
  98. package/lib/cjs/index.js.map +1 -0
  99. package/{amd → lib/cjs}/interfaces/interfaces.d.ts +3 -2
  100. package/lib/cjs/interfaces/interfaces.d.ts.map +1 -0
  101. package/lib/{interfaces → cjs/interfaces}/interfaces.js +1 -0
  102. package/lib/cjs/interfaces/interfaces.js.map +1 -0
  103. package/lib/cjs/package.json +3 -0
  104. package/{es6 → lib/cjs}/planning/context.d.ts +1 -0
  105. package/lib/cjs/planning/context.d.ts.map +1 -0
  106. package/{es6 → lib/cjs}/planning/context.js +5 -0
  107. package/lib/cjs/planning/context.js.map +1 -0
  108. package/{es6 → lib/cjs}/planning/metadata.d.ts +1 -0
  109. package/lib/cjs/planning/metadata.d.ts.map +1 -0
  110. package/{es6 → lib/cjs}/planning/metadata.js +20 -7
  111. package/lib/cjs/planning/metadata.js.map +1 -0
  112. package/{es → lib/cjs}/planning/metadata_reader.d.ts +1 -0
  113. package/lib/cjs/planning/metadata_reader.d.ts.map +1 -0
  114. package/{es6 → lib/cjs}/planning/metadata_reader.js +24 -12
  115. package/lib/cjs/planning/metadata_reader.js.map +1 -0
  116. package/{amd → lib/cjs}/planning/plan.d.ts +1 -0
  117. package/lib/cjs/planning/plan.d.ts.map +1 -0
  118. package/{es6 → lib/cjs}/planning/plan.js +3 -0
  119. package/lib/cjs/planning/plan.js.map +1 -0
  120. package/{amd → lib/cjs}/planning/planner.d.ts +1 -0
  121. package/lib/cjs/planning/planner.d.ts.map +1 -0
  122. package/{es6 → lib/cjs}/planning/planner.js +27 -7
  123. package/lib/cjs/planning/planner.js.map +1 -0
  124. package/{amd → lib/cjs}/planning/queryable_string.d.ts +1 -0
  125. package/lib/cjs/planning/queryable_string.d.ts.map +1 -0
  126. package/{es6 → lib/cjs}/planning/queryable_string.js +3 -0
  127. package/lib/cjs/planning/queryable_string.js.map +1 -0
  128. package/{amd → lib/cjs}/planning/reflection_utils.d.ts +1 -0
  129. package/lib/cjs/planning/reflection_utils.d.ts.map +1 -0
  130. package/{es6 → lib/cjs}/planning/reflection_utils.js +25 -8
  131. package/lib/cjs/planning/reflection_utils.js.map +1 -0
  132. package/{amd → lib/cjs}/planning/request.d.ts +1 -0
  133. package/lib/cjs/planning/request.d.ts.map +1 -0
  134. package/{es6 → lib/cjs}/planning/request.js +13 -1
  135. package/lib/cjs/planning/request.js.map +1 -0
  136. package/{es → lib/cjs}/resolution/instantiation.d.ts +1 -0
  137. package/lib/cjs/resolution/instantiation.d.ts.map +1 -0
  138. package/{es6 → lib/cjs}/resolution/instantiation.js +40 -37
  139. package/lib/cjs/resolution/instantiation.js.map +1 -0
  140. package/{amd → lib/cjs}/resolution/resolver.d.ts +1 -0
  141. package/lib/cjs/resolution/resolver.d.ts.map +1 -0
  142. package/{es6 → lib/cjs}/resolution/resolver.js +39 -20
  143. package/lib/cjs/resolution/resolver.js.map +1 -0
  144. package/{amd → lib/cjs}/scope/scope.d.ts +1 -0
  145. package/lib/cjs/scope/scope.d.ts.map +1 -0
  146. package/{es6 → lib/cjs}/scope/scope.js +10 -12
  147. package/lib/cjs/scope/scope.js.map +1 -0
  148. package/{amd → lib/cjs}/syntax/binding_in_syntax.d.ts +1 -0
  149. package/lib/cjs/syntax/binding_in_syntax.d.ts.map +1 -0
  150. package/{es6 → lib/cjs}/syntax/binding_in_syntax.js +2 -0
  151. package/lib/cjs/syntax/binding_in_syntax.js.map +1 -0
  152. package/{es6 → lib/cjs}/syntax/binding_in_when_on_syntax.d.ts +1 -0
  153. package/lib/cjs/syntax/binding_in_when_on_syntax.d.ts.map +1 -0
  154. package/{es6 → lib/cjs}/syntax/binding_in_when_on_syntax.js +5 -0
  155. package/lib/cjs/syntax/binding_in_when_on_syntax.js.map +1 -0
  156. package/{es6 → lib/cjs}/syntax/binding_on_syntax.d.ts +1 -0
  157. package/lib/cjs/syntax/binding_on_syntax.d.ts.map +1 -0
  158. package/{es6 → lib/cjs}/syntax/binding_on_syntax.js +2 -0
  159. package/lib/cjs/syntax/binding_on_syntax.js.map +1 -0
  160. package/{es → lib/cjs}/syntax/binding_to_syntax.d.ts +1 -0
  161. package/lib/cjs/syntax/binding_to_syntax.d.ts.map +1 -0
  162. package/{es6 → lib/cjs}/syntax/binding_to_syntax.js +43 -8
  163. package/lib/cjs/syntax/binding_to_syntax.js.map +1 -0
  164. package/{amd → lib/cjs}/syntax/binding_when_on_syntax.d.ts +1 -0
  165. package/lib/cjs/syntax/binding_when_on_syntax.d.ts.map +1 -0
  166. package/{es6 → lib/cjs}/syntax/binding_when_on_syntax.js +4 -0
  167. package/lib/cjs/syntax/binding_when_on_syntax.js.map +1 -0
  168. package/{es6 → lib/cjs}/syntax/binding_when_syntax.d.ts +1 -0
  169. package/lib/cjs/syntax/binding_when_syntax.d.ts.map +1 -0
  170. package/{es6 → lib/cjs}/syntax/binding_when_syntax.js +5 -1
  171. package/lib/cjs/syntax/binding_when_syntax.js.map +1 -0
  172. package/{amd → lib/cjs}/syntax/constraint_helpers.d.ts +1 -0
  173. package/lib/cjs/syntax/constraint_helpers.d.ts.map +1 -0
  174. package/{es6 → lib/cjs}/syntax/constraint_helpers.js +22 -7
  175. package/lib/cjs/syntax/constraint_helpers.js.map +1 -0
  176. package/{amd → lib/cjs}/utils/async.d.ts +1 -0
  177. package/lib/cjs/utils/async.d.ts.map +1 -0
  178. package/{es6 → lib/cjs}/utils/async.js +1 -0
  179. package/lib/cjs/utils/async.js.map +1 -0
  180. package/{es6 → lib/cjs}/utils/binding_utils.d.ts +1 -0
  181. package/lib/cjs/utils/binding_utils.d.ts.map +1 -0
  182. package/{es6 → lib/cjs}/utils/binding_utils.js +21 -7
  183. package/lib/cjs/utils/binding_utils.js.map +1 -0
  184. package/{es6 → lib/cjs}/utils/clonable.d.ts +1 -0
  185. package/lib/cjs/utils/clonable.d.ts.map +1 -0
  186. package/{es6 → lib/cjs}/utils/clonable.js +1 -0
  187. package/lib/cjs/utils/clonable.js.map +1 -0
  188. package/{amd → lib/cjs}/utils/exceptions.d.ts +1 -0
  189. package/lib/cjs/utils/exceptions.d.ts.map +1 -0
  190. package/{es6 → lib/cjs}/utils/exceptions.js +18 -7
  191. package/lib/cjs/utils/exceptions.js.map +1 -0
  192. package/{es6 → lib/cjs}/utils/factory_type.d.ts +1 -0
  193. package/lib/cjs/utils/factory_type.d.ts.map +1 -0
  194. package/{es6 → lib/cjs}/utils/factory_type.js +1 -0
  195. package/lib/cjs/utils/factory_type.js.map +1 -0
  196. package/{amd → lib/cjs}/utils/id.d.ts +1 -0
  197. package/lib/cjs/utils/id.d.ts.map +1 -0
  198. package/{es6 → lib/cjs}/utils/id.js +1 -0
  199. package/lib/cjs/utils/id.js.map +1 -0
  200. package/{amd → lib/cjs}/utils/js.d.ts +1 -0
  201. package/lib/cjs/utils/js.d.ts.map +1 -0
  202. package/{es6 → lib/cjs}/utils/js.js +1 -0
  203. package/lib/cjs/utils/js.js.map +1 -0
  204. package/{amd → lib/cjs}/utils/serialization.d.ts +1 -0
  205. package/lib/cjs/utils/serialization.d.ts.map +1 -0
  206. package/{es6 → lib/cjs}/utils/serialization.js +23 -7
  207. package/lib/cjs/utils/serialization.js.map +1 -0
  208. package/{es6/interfaces/interfaces.d.ts → lib/esm/index.d.ts} +207 -8
  209. package/lib/esm/index.d.ts.map +1 -0
  210. package/lib/esm/index.js +2 -0
  211. package/lib/esm/index.js.map +1 -0
  212. package/package.json +30 -34
  213. package/amd/annotation/decorator_utils.js +0 -119
  214. package/amd/annotation/inject.d.ts +0 -5
  215. package/amd/annotation/inject.js +0 -31
  216. package/amd/annotation/inject_base.js +0 -16
  217. package/amd/annotation/injectable.js +0 -40
  218. package/amd/annotation/lazy_service_identifier.js +0 -4
  219. package/amd/annotation/multi_inject.d.ts +0 -5
  220. package/amd/annotation/multi_inject.js +0 -31
  221. package/amd/annotation/named.js +0 -32
  222. package/amd/annotation/optional.js +0 -32
  223. package/amd/annotation/post_construct.js +0 -32
  224. package/amd/annotation/pre_destroy.d.ts +0 -4
  225. package/amd/annotation/pre_destroy.js +0 -32
  226. package/amd/annotation/property_event_decorator.d.ts +0 -4
  227. package/amd/annotation/property_event_decorator.js +0 -16
  228. package/amd/annotation/tagged.js +0 -8
  229. package/amd/annotation/target_name.d.ts +0 -3
  230. package/amd/annotation/target_name.js +0 -35
  231. package/amd/annotation/unmanaged.d.ts +0 -3
  232. package/amd/annotation/unmanaged.js +0 -35
  233. package/amd/bindings/binding.d.ts +0 -20
  234. package/amd/bindings/binding.js +0 -40
  235. package/amd/bindings/binding_count.js +0 -11
  236. package/amd/constants/error_msgs.js +0 -75
  237. package/amd/constants/literal_types.d.ts +0 -5
  238. package/amd/constants/literal_types.js +0 -28
  239. package/amd/constants/metadata_keys.js +0 -28
  240. package/amd/container/container.d.ts +0 -73
  241. package/amd/container/container.js +0 -766
  242. package/amd/container/container_module.js +0 -21
  243. package/amd/container/container_snapshot.d.ts +0 -10
  244. package/amd/container/container_snapshot.js +0 -20
  245. package/amd/container/lookup.d.ts +0 -17
  246. package/amd/container/lookup.js +0 -132
  247. package/amd/container/module_activation_store.d.ts +0 -10
  248. package/amd/container/module_activation_store.js +0 -51
  249. package/amd/interfaces/interfaces.js +0 -4
  250. package/amd/inversify.js +0 -57
  251. package/amd/planning/context.d.ts +0 -11
  252. package/amd/planning/context.js +0 -19
  253. package/amd/planning/metadata.d.ts +0 -8
  254. package/amd/planning/metadata.js +0 -45
  255. package/amd/planning/metadata_reader.d.ts +0 -6
  256. package/amd/planning/metadata_reader.js +0 -49
  257. package/amd/planning/plan.js +0 -13
  258. package/amd/planning/planner.js +0 -187
  259. package/amd/planning/queryable_string.js +0 -33
  260. package/amd/planning/reflection_utils.js +0 -55
  261. package/amd/planning/request.js +0 -24
  262. package/amd/planning/target.js +0 -111
  263. package/amd/resolution/instantiation.d.ts +0 -3
  264. package/amd/resolution/instantiation.js +0 -219
  265. package/amd/resolution/resolver.js +0 -234
  266. package/amd/scope/scope.js +0 -93
  267. package/amd/syntax/binding_in_syntax.js +0 -24
  268. package/amd/syntax/binding_in_when_on_syntax.d.ts +0 -29
  269. package/amd/syntax/binding_in_when_on_syntax.js +0 -75
  270. package/amd/syntax/binding_on_syntax.d.ts +0 -8
  271. package/amd/syntax/binding_on_syntax.js +0 -20
  272. package/amd/syntax/binding_to_syntax.d.ts +0 -18
  273. package/amd/syntax/binding_to_syntax.js +0 -116
  274. package/amd/syntax/binding_when_on_syntax.js +0 -65
  275. package/amd/syntax/binding_when_syntax.d.ts +0 -21
  276. package/amd/syntax/binding_when_syntax.js +0 -107
  277. package/amd/syntax/constraint_helpers.js +0 -66
  278. package/amd/utils/async.js +0 -17
  279. package/amd/utils/binding_utils.d.ts +0 -4
  280. package/amd/utils/binding_utils.js +0 -86
  281. package/amd/utils/clonable.d.ts +0 -3
  282. package/amd/utils/clonable.js +0 -11
  283. package/amd/utils/exceptions.js +0 -46
  284. package/amd/utils/factory_type.d.ts +0 -5
  285. package/amd/utils/factory_type.js +0 -11
  286. package/amd/utils/id.js +0 -9
  287. package/amd/utils/js.js +0 -18
  288. package/amd/utils/serialization.js +0 -135
  289. package/es/annotation/decorator_utils.d.ts +0 -16
  290. package/es/annotation/decorator_utils.js +0 -90
  291. package/es/annotation/inject.d.ts +0 -5
  292. package/es/annotation/inject.js +0 -4
  293. package/es/annotation/inject_base.d.ts +0 -4
  294. package/es/annotation/inject_base.js +0 -14
  295. package/es/annotation/injectable.d.ts +0 -2
  296. package/es/annotation/injectable.js +0 -13
  297. package/es/annotation/lazy_service_identifier.js +0 -1
  298. package/es/annotation/multi_inject.js +0 -4
  299. package/es/annotation/named.d.ts +0 -2
  300. package/es/annotation/named.js +0 -7
  301. package/es/annotation/optional.d.ts +0 -2
  302. package/es/annotation/optional.js +0 -7
  303. package/es/annotation/post_construct.d.ts +0 -4
  304. package/es/annotation/post_construct.js +0 -5
  305. package/es/annotation/pre_destroy.d.ts +0 -4
  306. package/es/annotation/pre_destroy.js +0 -5
  307. package/es/annotation/property_event_decorator.js +0 -13
  308. package/es/annotation/tagged.d.ts +0 -2
  309. package/es/annotation/tagged.js +0 -6
  310. package/es/annotation/target_name.d.ts +0 -3
  311. package/es/annotation/target_name.js +0 -10
  312. package/es/annotation/unmanaged.d.ts +0 -3
  313. package/es/annotation/unmanaged.js +0 -10
  314. package/es/bindings/binding.d.ts +0 -20
  315. package/es/bindings/binding.js +0 -37
  316. package/es/bindings/binding_count.d.ts +0 -5
  317. package/es/bindings/binding_count.js +0 -6
  318. package/es/constants/error_msgs.d.ts +0 -30
  319. package/es/constants/error_msgs.js +0 -62
  320. package/es/constants/literal_types.js +0 -21
  321. package/es/constants/metadata_keys.d.ts +0 -13
  322. package/es/constants/metadata_keys.js +0 -23
  323. package/es/container/container.d.ts +0 -73
  324. package/es/container/container.js +0 -750
  325. package/es/container/container_module.d.ts +0 -11
  326. package/es/container/container_module.js +0 -17
  327. package/es/container/container_snapshot.js +0 -15
  328. package/es/container/lookup.js +0 -105
  329. package/es/container/module_activation_store.d.ts +0 -10
  330. package/es/container/module_activation_store.js +0 -47
  331. package/es/interfaces/interfaces.d.ts +0 -269
  332. package/es/interfaces/interfaces.js +0 -1
  333. package/es/inversify.d.ts +0 -24
  334. package/es/inversify.js +0 -2
  335. package/es/planning/context.d.ts +0 -11
  336. package/es/planning/context.js +0 -15
  337. package/es/planning/metadata.d.ts +0 -8
  338. package/es/planning/metadata.js +0 -17
  339. package/es/planning/metadata_reader.js +0 -21
  340. package/es/planning/plan.d.ts +0 -7
  341. package/es/planning/plan.js +0 -8
  342. package/es/planning/planner.d.ts +0 -5
  343. package/es/planning/planner.js +0 -168
  344. package/es/planning/queryable_string.d.ts +0 -10
  345. package/es/planning/queryable_string.js +0 -28
  346. package/es/planning/reflection_utils.d.ts +0 -5
  347. package/es/planning/reflection_utils.js +0 -27
  348. package/es/planning/request.d.ts +0 -14
  349. package/es/planning/request.js +0 -20
  350. package/es/planning/target.js +0 -87
  351. package/es/resolution/instantiation.js +0 -195
  352. package/es/resolution/resolver.d.ts +0 -3
  353. package/es/resolution/resolver.js +0 -214
  354. package/es/scope/scope.d.ts +0 -3
  355. package/es/scope/scope.js +0 -88
  356. package/es/syntax/binding_in_syntax.d.ts +0 -9
  357. package/es/syntax/binding_in_syntax.js +0 -21
  358. package/es/syntax/binding_in_when_on_syntax.d.ts +0 -29
  359. package/es/syntax/binding_in_when_on_syntax.js +0 -73
  360. package/es/syntax/binding_on_syntax.d.ts +0 -8
  361. package/es/syntax/binding_on_syntax.js +0 -16
  362. package/es/syntax/binding_to_syntax.js +0 -91
  363. package/es/syntax/binding_when_on_syntax.d.ts +0 -25
  364. package/es/syntax/binding_when_on_syntax.js +0 -62
  365. package/es/syntax/binding_when_syntax.d.ts +0 -21
  366. package/es/syntax/binding_when_syntax.js +0 -104
  367. package/es/syntax/constraint_helpers.d.ts +0 -6
  368. package/es/syntax/constraint_helpers.js +0 -36
  369. package/es/utils/async.d.ts +0 -3
  370. package/es/utils/async.js +0 -12
  371. package/es/utils/binding_utils.d.ts +0 -4
  372. package/es/utils/binding_utils.js +0 -58
  373. package/es/utils/clonable.d.ts +0 -3
  374. package/es/utils/clonable.js +0 -7
  375. package/es/utils/exceptions.d.ts +0 -2
  376. package/es/utils/exceptions.js +0 -16
  377. package/es/utils/factory_type.d.ts +0 -5
  378. package/es/utils/factory_type.js +0 -6
  379. package/es/utils/id.d.ts +0 -2
  380. package/es/utils/id.js +0 -5
  381. package/es/utils/js.d.ts +0 -1
  382. package/es/utils/js.js +0 -13
  383. package/es/utils/serialization.d.ts +0 -10
  384. package/es/utils/serialization.js +0 -103
  385. package/es6/annotation/decorator_utils.d.ts +0 -16
  386. package/es6/annotation/inject_base.d.ts +0 -4
  387. package/es6/annotation/injectable.d.ts +0 -2
  388. package/es6/annotation/lazy_service_identifier.js +0 -2
  389. package/es6/annotation/multi_inject.d.ts +0 -5
  390. package/es6/annotation/named.d.ts +0 -2
  391. package/es6/annotation/optional.d.ts +0 -2
  392. package/es6/annotation/post_construct.d.ts +0 -4
  393. package/es6/annotation/property_event_decorator.d.ts +0 -4
  394. package/es6/annotation/tagged.d.ts +0 -2
  395. package/es6/bindings/binding_count.d.ts +0 -5
  396. package/es6/bindings/binding_count.js +0 -9
  397. package/es6/constants/error_msgs.d.ts +0 -30
  398. package/es6/constants/literal_types.d.ts +0 -5
  399. package/es6/constants/metadata_keys.d.ts +0 -13
  400. package/es6/container/container_module.d.ts +0 -11
  401. package/es6/container/container_snapshot.d.ts +0 -10
  402. package/es6/container/lookup.d.ts +0 -17
  403. package/es6/interfaces/interfaces.js +0 -2
  404. package/es6/inversify.d.ts +0 -24
  405. package/es6/planning/metadata_reader.d.ts +0 -6
  406. package/es6/planning/plan.d.ts +0 -7
  407. package/es6/planning/planner.d.ts +0 -5
  408. package/es6/planning/queryable_string.d.ts +0 -10
  409. package/es6/planning/reflection_utils.d.ts +0 -5
  410. package/es6/planning/request.d.ts +0 -14
  411. package/es6/planning/target.js +0 -105
  412. package/es6/resolution/instantiation.d.ts +0 -3
  413. package/es6/resolution/resolver.d.ts +0 -3
  414. package/es6/scope/scope.d.ts +0 -3
  415. package/es6/syntax/binding_in_syntax.d.ts +0 -9
  416. package/es6/syntax/binding_to_syntax.d.ts +0 -18
  417. package/es6/syntax/binding_when_on_syntax.d.ts +0 -25
  418. package/es6/syntax/constraint_helpers.d.ts +0 -6
  419. package/es6/utils/async.d.ts +0 -3
  420. package/es6/utils/exceptions.d.ts +0 -2
  421. package/es6/utils/id.d.ts +0 -2
  422. package/es6/utils/js.d.ts +0 -1
  423. package/es6/utils/serialization.d.ts +0 -10
  424. package/lib/annotation/decorator_utils.d.ts +0 -16
  425. package/lib/annotation/decorator_utils.js +0 -118
  426. package/lib/annotation/inject.d.ts +0 -5
  427. package/lib/annotation/inject.js +0 -30
  428. package/lib/annotation/inject_base.d.ts +0 -4
  429. package/lib/annotation/inject_base.js +0 -17
  430. package/lib/annotation/injectable.d.ts +0 -2
  431. package/lib/annotation/injectable.js +0 -38
  432. package/lib/annotation/lazy_service_identifier.d.ts +0 -3
  433. package/lib/annotation/lazy_service_identifier.js +0 -2
  434. package/lib/annotation/multi_inject.d.ts +0 -5
  435. package/lib/annotation/multi_inject.js +0 -30
  436. package/lib/annotation/named.d.ts +0 -2
  437. package/lib/annotation/named.js +0 -32
  438. package/lib/annotation/optional.d.ts +0 -2
  439. package/lib/annotation/optional.js +0 -32
  440. package/lib/annotation/post_construct.d.ts +0 -4
  441. package/lib/annotation/post_construct.js +0 -31
  442. package/lib/annotation/pre_destroy.d.ts +0 -4
  443. package/lib/annotation/pre_destroy.js +0 -31
  444. package/lib/annotation/property_event_decorator.d.ts +0 -4
  445. package/lib/annotation/property_event_decorator.js +0 -15
  446. package/lib/annotation/tagged.d.ts +0 -2
  447. package/lib/annotation/tagged.js +0 -8
  448. package/lib/annotation/target_name.d.ts +0 -3
  449. package/lib/annotation/target_name.js +0 -35
  450. package/lib/annotation/unmanaged.d.ts +0 -3
  451. package/lib/annotation/unmanaged.js +0 -35
  452. package/lib/bindings/binding.d.ts +0 -20
  453. package/lib/bindings/binding.js +0 -40
  454. package/lib/bindings/binding_count.d.ts +0 -5
  455. package/lib/constants/error_msgs.d.ts +0 -30
  456. package/lib/constants/error_msgs.js +0 -73
  457. package/lib/constants/literal_types.d.ts +0 -5
  458. package/lib/constants/literal_types.js +0 -26
  459. package/lib/constants/metadata_keys.d.ts +0 -13
  460. package/lib/constants/metadata_keys.js +0 -26
  461. package/lib/container/container.d.ts +0 -73
  462. package/lib/container/container.js +0 -776
  463. package/lib/container/container_module.d.ts +0 -11
  464. package/lib/container/container_module.js +0 -20
  465. package/lib/container/container_snapshot.d.ts +0 -10
  466. package/lib/container/container_snapshot.js +0 -18
  467. package/lib/container/lookup.d.ts +0 -17
  468. package/lib/container/lookup.js +0 -131
  469. package/lib/container/module_activation_store.d.ts +0 -10
  470. package/lib/container/module_activation_store.js +0 -50
  471. package/lib/interfaces/interfaces.d.ts +0 -269
  472. package/lib/inversify.d.ts +0 -24
  473. package/lib/inversify.js +0 -76
  474. package/lib/planning/context.d.ts +0 -11
  475. package/lib/planning/context.js +0 -18
  476. package/lib/planning/metadata.d.ts +0 -8
  477. package/lib/planning/metadata.js +0 -43
  478. package/lib/planning/metadata_reader.d.ts +0 -6
  479. package/lib/planning/metadata_reader.js +0 -47
  480. package/lib/planning/plan.d.ts +0 -7
  481. package/lib/planning/plan.js +0 -11
  482. package/lib/planning/planner.d.ts +0 -5
  483. package/lib/planning/planner.js +0 -195
  484. package/lib/planning/queryable_string.d.ts +0 -10
  485. package/lib/planning/queryable_string.js +0 -31
  486. package/lib/planning/reflection_utils.d.ts +0 -5
  487. package/lib/planning/reflection_utils.js +0 -55
  488. package/lib/planning/request.d.ts +0 -14
  489. package/lib/planning/request.js +0 -23
  490. package/lib/planning/target.d.ts +0 -23
  491. package/lib/planning/target.js +0 -113
  492. package/lib/resolution/instantiation.d.ts +0 -3
  493. package/lib/resolution/instantiation.js +0 -220
  494. package/lib/resolution/resolver.d.ts +0 -3
  495. package/lib/resolution/resolver.js +0 -239
  496. package/lib/scope/scope.d.ts +0 -3
  497. package/lib/scope/scope.js +0 -93
  498. package/lib/syntax/binding_in_syntax.d.ts +0 -9
  499. package/lib/syntax/binding_in_syntax.js +0 -24
  500. package/lib/syntax/binding_in_when_on_syntax.d.ts +0 -29
  501. package/lib/syntax/binding_in_when_on_syntax.js +0 -76
  502. package/lib/syntax/binding_on_syntax.d.ts +0 -8
  503. package/lib/syntax/binding_on_syntax.js +0 -19
  504. package/lib/syntax/binding_to_syntax.d.ts +0 -18
  505. package/lib/syntax/binding_to_syntax.js +0 -117
  506. package/lib/syntax/binding_when_on_syntax.d.ts +0 -25
  507. package/lib/syntax/binding_when_on_syntax.js +0 -65
  508. package/lib/syntax/binding_when_syntax.d.ts +0 -21
  509. package/lib/syntax/binding_when_syntax.js +0 -107
  510. package/lib/syntax/constraint_helpers.d.ts +0 -6
  511. package/lib/syntax/constraint_helpers.js +0 -65
  512. package/lib/tsconfig.tsbuildinfo +0 -1
  513. package/lib/utils/async.d.ts +0 -3
  514. package/lib/utils/async.js +0 -15
  515. package/lib/utils/binding_utils.d.ts +0 -4
  516. package/lib/utils/binding_utils.js +0 -87
  517. package/lib/utils/clonable.d.ts +0 -3
  518. package/lib/utils/clonable.js +0 -9
  519. package/lib/utils/exceptions.d.ts +0 -2
  520. package/lib/utils/exceptions.js +0 -44
  521. package/lib/utils/factory_type.d.ts +0 -5
  522. package/lib/utils/factory_type.js +0 -9
  523. package/lib/utils/id.d.ts +0 -2
  524. package/lib/utils/id.js +0 -7
  525. package/lib/utils/js.d.ts +0 -1
  526. package/lib/utils/js.js +0 -16
  527. package/lib/utils/serialization.d.ts +0 -10
  528. package/lib/utils/serialization.js +0 -133
  529. /package/{es → lib/esm}/package.json +0 -0
@@ -1,776 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- var __generator = (this && this.__generator) || function (thisArg, body) {
46
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
47
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
- function verb(n) { return function (v) { return step([n, v]); }; }
49
- function step(op) {
50
- if (f) throw new TypeError("Generator is already executing.");
51
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
- if (y = 0, t) op = [op[0] & 2, t.value];
54
- switch (op[0]) {
55
- case 0: case 1: t = op; break;
56
- case 4: _.label++; return { value: op[1], done: false };
57
- case 5: _.label++; y = op[1]; op = [0]; continue;
58
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
- default:
60
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
- if (t[2]) _.ops.pop();
65
- _.trys.pop(); continue;
66
- }
67
- op = body.call(thisArg, _);
68
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
- }
71
- };
72
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
73
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
74
- if (ar || !(i in from)) {
75
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
76
- ar[i] = from[i];
77
- }
78
- }
79
- return to.concat(ar || Array.prototype.slice.call(from));
80
- };
81
- Object.defineProperty(exports, "__esModule", { value: true });
82
- exports.Container = void 0;
83
- var binding_1 = require("../bindings/binding");
84
- var ERROR_MSGS = __importStar(require("../constants/error_msgs"));
85
- var literal_types_1 = require("../constants/literal_types");
86
- var METADATA_KEY = __importStar(require("../constants/metadata_keys"));
87
- var metadata_reader_1 = require("../planning/metadata_reader");
88
- var planner_1 = require("../planning/planner");
89
- var resolver_1 = require("../resolution/resolver");
90
- var binding_to_syntax_1 = require("../syntax/binding_to_syntax");
91
- var async_1 = require("../utils/async");
92
- var id_1 = require("../utils/id");
93
- var serialization_1 = require("../utils/serialization");
94
- var container_snapshot_1 = require("./container_snapshot");
95
- var lookup_1 = require("./lookup");
96
- var module_activation_store_1 = require("./module_activation_store");
97
- var Container = (function () {
98
- function Container(containerOptions) {
99
- var options = containerOptions || {};
100
- if (typeof options !== 'object') {
101
- throw new Error(ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);
102
- }
103
- if (options.defaultScope === undefined) {
104
- options.defaultScope = literal_types_1.BindingScopeEnum.Transient;
105
- }
106
- else if (options.defaultScope !== literal_types_1.BindingScopeEnum.Singleton &&
107
- options.defaultScope !== literal_types_1.BindingScopeEnum.Transient &&
108
- options.defaultScope !== literal_types_1.BindingScopeEnum.Request) {
109
- throw new Error(ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);
110
- }
111
- if (options.autoBindInjectable === undefined) {
112
- options.autoBindInjectable = false;
113
- }
114
- else if (typeof options.autoBindInjectable !== 'boolean') {
115
- throw new Error(ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);
116
- }
117
- if (options.skipBaseClassChecks === undefined) {
118
- options.skipBaseClassChecks = false;
119
- }
120
- else if (typeof options.skipBaseClassChecks !== 'boolean') {
121
- throw new Error(ERROR_MSGS.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);
122
- }
123
- this.options = {
124
- autoBindInjectable: options.autoBindInjectable,
125
- defaultScope: options.defaultScope,
126
- skipBaseClassChecks: options.skipBaseClassChecks,
127
- };
128
- this.id = (0, id_1.id)();
129
- this._bindingDictionary = new lookup_1.Lookup();
130
- this._snapshots = [];
131
- this._middleware = null;
132
- this._activations = new lookup_1.Lookup();
133
- this._deactivations = new lookup_1.Lookup();
134
- this.parent = null;
135
- this._metadataReader = new metadata_reader_1.MetadataReader();
136
- this._moduleActivationStore = new module_activation_store_1.ModuleActivationStore();
137
- }
138
- Container.merge = function (container1, container2) {
139
- var containers = [];
140
- for (var _i = 2; _i < arguments.length; _i++) {
141
- containers[_i - 2] = arguments[_i];
142
- }
143
- var container = new Container();
144
- var targetContainers = __spreadArray([
145
- container1,
146
- container2
147
- ], containers, true).map(function (targetContainer) {
148
- return (0, planner_1.getBindingDictionary)(targetContainer);
149
- });
150
- var bindingDictionary = (0, planner_1.getBindingDictionary)(container);
151
- function copyDictionary(origin, destination) {
152
- origin.traverse(function (_key, value) {
153
- value.forEach(function (binding) {
154
- destination.add(binding.serviceIdentifier, binding.clone());
155
- });
156
- });
157
- }
158
- targetContainers.forEach(function (targetBindingDictionary) {
159
- copyDictionary(targetBindingDictionary, bindingDictionary);
160
- });
161
- return container;
162
- };
163
- Container.prototype.load = function () {
164
- var modules = [];
165
- for (var _i = 0; _i < arguments.length; _i++) {
166
- modules[_i] = arguments[_i];
167
- }
168
- var getHelpers = this._getContainerModuleHelpersFactory();
169
- for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) {
170
- var currentModule = modules_1[_a];
171
- var containerModuleHelpers = getHelpers(currentModule.id);
172
- currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction, containerModuleHelpers.unbindAsyncFunction, containerModuleHelpers.onActivationFunction, containerModuleHelpers.onDeactivationFunction);
173
- }
174
- };
175
- Container.prototype.loadAsync = function () {
176
- var modules = [];
177
- for (var _i = 0; _i < arguments.length; _i++) {
178
- modules[_i] = arguments[_i];
179
- }
180
- return __awaiter(this, void 0, void 0, function () {
181
- var getHelpers, _a, modules_2, currentModule, containerModuleHelpers;
182
- return __generator(this, function (_b) {
183
- switch (_b.label) {
184
- case 0:
185
- getHelpers = this._getContainerModuleHelpersFactory();
186
- _a = 0, modules_2 = modules;
187
- _b.label = 1;
188
- case 1:
189
- if (!(_a < modules_2.length)) return [3, 4];
190
- currentModule = modules_2[_a];
191
- containerModuleHelpers = getHelpers(currentModule.id);
192
- return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction, containerModuleHelpers.unbindAsyncFunction, containerModuleHelpers.onActivationFunction, containerModuleHelpers.onDeactivationFunction)];
193
- case 2:
194
- _b.sent();
195
- _b.label = 3;
196
- case 3:
197
- _a++;
198
- return [3, 1];
199
- case 4: return [2];
200
- }
201
- });
202
- });
203
- };
204
- Container.prototype.unload = function () {
205
- var _this = this;
206
- var modules = [];
207
- for (var _i = 0; _i < arguments.length; _i++) {
208
- modules[_i] = arguments[_i];
209
- }
210
- modules.forEach(function (module) {
211
- var deactivations = _this._removeModuleBindings(module.id);
212
- _this._deactivateSingletons(deactivations);
213
- _this._removeModuleHandlers(module.id);
214
- });
215
- };
216
- Container.prototype.unloadAsync = function () {
217
- var modules = [];
218
- for (var _i = 0; _i < arguments.length; _i++) {
219
- modules[_i] = arguments[_i];
220
- }
221
- return __awaiter(this, void 0, void 0, function () {
222
- var _a, modules_3, module_1, deactivations;
223
- return __generator(this, function (_b) {
224
- switch (_b.label) {
225
- case 0:
226
- _a = 0, modules_3 = modules;
227
- _b.label = 1;
228
- case 1:
229
- if (!(_a < modules_3.length)) return [3, 4];
230
- module_1 = modules_3[_a];
231
- deactivations = this._removeModuleBindings(module_1.id);
232
- return [4, this._deactivateSingletonsAsync(deactivations)];
233
- case 2:
234
- _b.sent();
235
- this._removeModuleHandlers(module_1.id);
236
- _b.label = 3;
237
- case 3:
238
- _a++;
239
- return [3, 1];
240
- case 4: return [2];
241
- }
242
- });
243
- });
244
- };
245
- Container.prototype.bind = function (serviceIdentifier) {
246
- var scope = this.options.defaultScope || literal_types_1.BindingScopeEnum.Transient;
247
- var binding = new binding_1.Binding(serviceIdentifier, scope);
248
- this._bindingDictionary.add(serviceIdentifier, binding);
249
- return new binding_to_syntax_1.BindingToSyntax(binding);
250
- };
251
- Container.prototype.rebind = function (serviceIdentifier) {
252
- this.unbind(serviceIdentifier);
253
- return this.bind(serviceIdentifier);
254
- };
255
- Container.prototype.rebindAsync = function (serviceIdentifier) {
256
- return __awaiter(this, void 0, void 0, function () {
257
- return __generator(this, function (_a) {
258
- switch (_a.label) {
259
- case 0: return [4, this.unbindAsync(serviceIdentifier)];
260
- case 1:
261
- _a.sent();
262
- return [2, this.bind(serviceIdentifier)];
263
- }
264
- });
265
- });
266
- };
267
- Container.prototype.unbind = function (serviceIdentifier) {
268
- if (this._bindingDictionary.hasKey(serviceIdentifier)) {
269
- var bindings = this._bindingDictionary.get(serviceIdentifier);
270
- this._deactivateSingletons(bindings);
271
- }
272
- this._removeServiceFromDictionary(serviceIdentifier);
273
- };
274
- Container.prototype.unbindAsync = function (serviceIdentifier) {
275
- return __awaiter(this, void 0, void 0, function () {
276
- var bindings;
277
- return __generator(this, function (_a) {
278
- switch (_a.label) {
279
- case 0:
280
- if (!this._bindingDictionary.hasKey(serviceIdentifier)) return [3, 2];
281
- bindings = this._bindingDictionary.get(serviceIdentifier);
282
- return [4, this._deactivateSingletonsAsync(bindings)];
283
- case 1:
284
- _a.sent();
285
- _a.label = 2;
286
- case 2:
287
- this._removeServiceFromDictionary(serviceIdentifier);
288
- return [2];
289
- }
290
- });
291
- });
292
- };
293
- Container.prototype.unbindAll = function () {
294
- var _this = this;
295
- this._bindingDictionary.traverse(function (_key, value) {
296
- _this._deactivateSingletons(value);
297
- });
298
- this._bindingDictionary = new lookup_1.Lookup();
299
- };
300
- Container.prototype.unbindAllAsync = function () {
301
- return __awaiter(this, void 0, void 0, function () {
302
- var promises;
303
- var _this = this;
304
- return __generator(this, function (_a) {
305
- switch (_a.label) {
306
- case 0:
307
- promises = [];
308
- this._bindingDictionary.traverse(function (_key, value) {
309
- promises.push(_this._deactivateSingletonsAsync(value));
310
- });
311
- return [4, Promise.all(promises)];
312
- case 1:
313
- _a.sent();
314
- this._bindingDictionary = new lookup_1.Lookup();
315
- return [2];
316
- }
317
- });
318
- });
319
- };
320
- Container.prototype.onActivation = function (serviceIdentifier, onActivation) {
321
- this._activations.add(serviceIdentifier, onActivation);
322
- };
323
- Container.prototype.onDeactivation = function (serviceIdentifier, onDeactivation) {
324
- this._deactivations.add(serviceIdentifier, onDeactivation);
325
- };
326
- Container.prototype.isBound = function (serviceIdentifier) {
327
- var bound = this._bindingDictionary.hasKey(serviceIdentifier);
328
- if (!bound && this.parent) {
329
- bound = this.parent.isBound(serviceIdentifier);
330
- }
331
- return bound;
332
- };
333
- Container.prototype.isCurrentBound = function (serviceIdentifier) {
334
- return this._bindingDictionary.hasKey(serviceIdentifier);
335
- };
336
- Container.prototype.isBoundNamed = function (serviceIdentifier, named) {
337
- return this.isBoundTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
338
- };
339
- Container.prototype.isBoundTagged = function (serviceIdentifier, key, value) {
340
- var bound = false;
341
- if (this._bindingDictionary.hasKey(serviceIdentifier)) {
342
- var bindings = this._bindingDictionary.get(serviceIdentifier);
343
- var request_1 = (0, planner_1.createMockRequest)(this, serviceIdentifier, key, value);
344
- bound = bindings.some(function (b) { return b.constraint(request_1); });
345
- }
346
- if (!bound && this.parent) {
347
- bound = this.parent.isBoundTagged(serviceIdentifier, key, value);
348
- }
349
- return bound;
350
- };
351
- Container.prototype.snapshot = function () {
352
- this._snapshots.push(container_snapshot_1.ContainerSnapshot.of(this._bindingDictionary.clone(), this._middleware, this._activations.clone(), this._deactivations.clone(), this._moduleActivationStore.clone()));
353
- };
354
- Container.prototype.restore = function () {
355
- var snapshot = this._snapshots.pop();
356
- if (snapshot === undefined) {
357
- throw new Error(ERROR_MSGS.NO_MORE_SNAPSHOTS_AVAILABLE);
358
- }
359
- this._bindingDictionary = snapshot.bindings;
360
- this._activations = snapshot.activations;
361
- this._deactivations = snapshot.deactivations;
362
- this._middleware = snapshot.middleware;
363
- this._moduleActivationStore = snapshot.moduleActivationStore;
364
- };
365
- Container.prototype.createChild = function (containerOptions) {
366
- var child = new Container(containerOptions || this.options);
367
- child.parent = this;
368
- return child;
369
- };
370
- Container.prototype.applyMiddleware = function () {
371
- var middlewares = [];
372
- for (var _i = 0; _i < arguments.length; _i++) {
373
- middlewares[_i] = arguments[_i];
374
- }
375
- var initial = this._middleware
376
- ? this._middleware
377
- : this._planAndResolve();
378
- this._middleware = middlewares.reduce(function (prev, curr) { return curr(prev); }, initial);
379
- };
380
- Container.prototype.applyCustomMetadataReader = function (metadataReader) {
381
- this._metadataReader = metadataReader;
382
- };
383
- Container.prototype.get = function (serviceIdentifier) {
384
- var getArgs = this._getNotAllArgs(serviceIdentifier, false);
385
- return this._getButThrowIfAsync(getArgs);
386
- };
387
- Container.prototype.getAsync = function (serviceIdentifier) {
388
- return __awaiter(this, void 0, void 0, function () {
389
- var getArgs;
390
- return __generator(this, function (_a) {
391
- getArgs = this._getNotAllArgs(serviceIdentifier, false);
392
- return [2, this._get(getArgs)];
393
- });
394
- });
395
- };
396
- Container.prototype.getTagged = function (serviceIdentifier, key, value) {
397
- var getArgs = this._getNotAllArgs(serviceIdentifier, false, key, value);
398
- return this._getButThrowIfAsync(getArgs);
399
- };
400
- Container.prototype.getTaggedAsync = function (serviceIdentifier, key, value) {
401
- return __awaiter(this, void 0, void 0, function () {
402
- var getArgs;
403
- return __generator(this, function (_a) {
404
- getArgs = this._getNotAllArgs(serviceIdentifier, false, key, value);
405
- return [2, this._get(getArgs)];
406
- });
407
- });
408
- };
409
- Container.prototype.getNamed = function (serviceIdentifier, named) {
410
- return this.getTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
411
- };
412
- Container.prototype.getNamedAsync = function (serviceIdentifier, named) {
413
- return __awaiter(this, void 0, void 0, function () {
414
- return __generator(this, function (_a) {
415
- return [2, this.getTaggedAsync(serviceIdentifier, METADATA_KEY.NAMED_TAG, named)];
416
- });
417
- });
418
- };
419
- Container.prototype.getAll = function (serviceIdentifier) {
420
- var getArgs = this._getAllArgs(serviceIdentifier);
421
- return this._getButThrowIfAsync(getArgs);
422
- };
423
- Container.prototype.getAllAsync = function (serviceIdentifier) {
424
- return __awaiter(this, void 0, void 0, function () {
425
- var getArgs;
426
- return __generator(this, function (_a) {
427
- getArgs = this._getAllArgs(serviceIdentifier);
428
- return [2, this._getAll(getArgs)];
429
- });
430
- });
431
- };
432
- Container.prototype.getAllTagged = function (serviceIdentifier, key, value) {
433
- var getArgs = this._getNotAllArgs(serviceIdentifier, true, key, value);
434
- return this._getButThrowIfAsync(getArgs);
435
- };
436
- Container.prototype.getAllTaggedAsync = function (serviceIdentifier, key, value) {
437
- return __awaiter(this, void 0, void 0, function () {
438
- var getArgs;
439
- return __generator(this, function (_a) {
440
- getArgs = this._getNotAllArgs(serviceIdentifier, true, key, value);
441
- return [2, this._getAll(getArgs)];
442
- });
443
- });
444
- };
445
- Container.prototype.getAllNamed = function (serviceIdentifier, named) {
446
- return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
447
- };
448
- Container.prototype.getAllNamedAsync = function (serviceIdentifier, named) {
449
- return __awaiter(this, void 0, void 0, function () {
450
- return __generator(this, function (_a) {
451
- return [2, this.getAllTaggedAsync(serviceIdentifier, METADATA_KEY.NAMED_TAG, named)];
452
- });
453
- });
454
- };
455
- Container.prototype.resolve = function (constructorFunction) {
456
- var isBound = this.isBound(constructorFunction);
457
- if (!isBound) {
458
- this.bind(constructorFunction).toSelf();
459
- }
460
- var resolved = this.get(constructorFunction);
461
- if (!isBound) {
462
- this.unbind(constructorFunction);
463
- }
464
- return resolved;
465
- };
466
- Container.prototype._preDestroy = function (constructor, instance) {
467
- var _a, _b;
468
- if (constructor !== undefined &&
469
- Reflect.hasMetadata(METADATA_KEY.PRE_DESTROY, constructor)) {
470
- var data = Reflect.getMetadata(METADATA_KEY.PRE_DESTROY, constructor);
471
- return (_b = (_a = instance)[data.value]) === null || _b === void 0 ? void 0 : _b.call(_a);
472
- }
473
- };
474
- Container.prototype._removeModuleHandlers = function (moduleId) {
475
- var moduleActivationsHandlers = this._moduleActivationStore.remove(moduleId);
476
- this._activations.removeIntersection(moduleActivationsHandlers.onActivations);
477
- this._deactivations.removeIntersection(moduleActivationsHandlers.onDeactivations);
478
- };
479
- Container.prototype._removeModuleBindings = function (moduleId) {
480
- return this._bindingDictionary.removeByCondition(function (binding) { return binding.moduleId === moduleId; });
481
- };
482
- Container.prototype._deactivate = function (binding, instance) {
483
- var _this = this;
484
- var constructor = instance == undefined
485
- ? undefined
486
- :
487
- Object.getPrototypeOf(instance).constructor;
488
- try {
489
- if (this._deactivations.hasKey(binding.serviceIdentifier)) {
490
- var result = this._deactivateContainer(instance, this._deactivations.get(binding.serviceIdentifier).values());
491
- if ((0, async_1.isPromise)(result)) {
492
- return this._handleDeactivationError(result.then(function () { return __awaiter(_this, void 0, void 0, function () {
493
- return __generator(this, function (_a) {
494
- return [2, this._propagateContainerDeactivationThenBindingAndPreDestroyAsync(binding, instance, constructor)];
495
- });
496
- }); }), binding.serviceIdentifier);
497
- }
498
- }
499
- var propagateDeactivationResult = this._propagateContainerDeactivationThenBindingAndPreDestroy(binding, instance, constructor);
500
- if ((0, async_1.isPromise)(propagateDeactivationResult)) {
501
- return this._handleDeactivationError(propagateDeactivationResult, binding.serviceIdentifier);
502
- }
503
- }
504
- catch (ex) {
505
- if (ex instanceof Error) {
506
- throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR((0, serialization_1.getServiceIdentifierAsString)(binding.serviceIdentifier), ex.message));
507
- }
508
- }
509
- };
510
- Container.prototype._handleDeactivationError = function (asyncResult, serviceIdentifier) {
511
- return __awaiter(this, void 0, void 0, function () {
512
- var ex_1;
513
- return __generator(this, function (_a) {
514
- switch (_a.label) {
515
- case 0:
516
- _a.trys.push([0, 2, , 3]);
517
- return [4, asyncResult];
518
- case 1:
519
- _a.sent();
520
- return [3, 3];
521
- case 2:
522
- ex_1 = _a.sent();
523
- if (ex_1 instanceof Error) {
524
- throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR((0, serialization_1.getServiceIdentifierAsString)(serviceIdentifier), ex_1.message));
525
- }
526
- return [3, 3];
527
- case 3: return [2];
528
- }
529
- });
530
- });
531
- };
532
- Container.prototype._deactivateContainer = function (instance, deactivationsIterator) {
533
- var _this = this;
534
- var deactivation = deactivationsIterator.next();
535
- while (typeof deactivation.value === 'function') {
536
- var result = deactivation.value(instance);
537
- if ((0, async_1.isPromise)(result)) {
538
- return result.then(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
539
- return [2, this._deactivateContainerAsync(instance, deactivationsIterator)];
540
- }); }); });
541
- }
542
- deactivation = deactivationsIterator.next();
543
- }
544
- };
545
- Container.prototype._deactivateContainerAsync = function (instance, deactivationsIterator) {
546
- return __awaiter(this, void 0, void 0, function () {
547
- var deactivation;
548
- return __generator(this, function (_a) {
549
- switch (_a.label) {
550
- case 0:
551
- deactivation = deactivationsIterator.next();
552
- _a.label = 1;
553
- case 1:
554
- if (!(typeof deactivation.value === 'function')) return [3, 3];
555
- return [4, deactivation.value(instance)];
556
- case 2:
557
- _a.sent();
558
- deactivation = deactivationsIterator.next();
559
- return [3, 1];
560
- case 3: return [2];
561
- }
562
- });
563
- });
564
- };
565
- Container.prototype._getContainerModuleHelpersFactory = function () {
566
- var _this = this;
567
- var setModuleId = function (bindingToSyntax, moduleId) {
568
- bindingToSyntax._binding.moduleId = moduleId;
569
- };
570
- var getBindFunction = function (moduleId) {
571
- return function (serviceIdentifier) {
572
- var bindingToSyntax = _this.bind(serviceIdentifier);
573
- setModuleId(bindingToSyntax, moduleId);
574
- return bindingToSyntax;
575
- };
576
- };
577
- var getUnbindFunction = function () { return function (serviceIdentifier) {
578
- _this.unbind(serviceIdentifier);
579
- }; };
580
- var getUnbindAsyncFunction = function () {
581
- return function (serviceIdentifier) { return __awaiter(_this, void 0, void 0, function () {
582
- return __generator(this, function (_a) {
583
- return [2, this.unbindAsync(serviceIdentifier)];
584
- });
585
- }); };
586
- };
587
- var getIsboundFunction = function () {
588
- return function (serviceIdentifier) {
589
- return _this.isBound(serviceIdentifier);
590
- };
591
- };
592
- var getRebindFunction = function (moduleId) {
593
- return function (serviceIdentifier) {
594
- var bindingToSyntax = _this.rebind(serviceIdentifier);
595
- setModuleId(bindingToSyntax, moduleId);
596
- return bindingToSyntax;
597
- };
598
- };
599
- var getOnActivationFunction = function (moduleId) {
600
- return function (serviceIdentifier, onActivation) {
601
- _this._moduleActivationStore.addActivation(moduleId, serviceIdentifier, onActivation);
602
- _this.onActivation(serviceIdentifier, onActivation);
603
- };
604
- };
605
- var getOnDeactivationFunction = function (moduleId) {
606
- return function (serviceIdentifier, onDeactivation) {
607
- _this._moduleActivationStore.addDeactivation(moduleId, serviceIdentifier, onDeactivation);
608
- _this.onDeactivation(serviceIdentifier, onDeactivation);
609
- };
610
- };
611
- return function (mId) { return ({
612
- bindFunction: getBindFunction(mId),
613
- isboundFunction: getIsboundFunction(),
614
- onActivationFunction: getOnActivationFunction(mId),
615
- onDeactivationFunction: getOnDeactivationFunction(mId),
616
- rebindFunction: getRebindFunction(mId),
617
- unbindAsyncFunction: getUnbindAsyncFunction(),
618
- unbindFunction: getUnbindFunction(),
619
- }); };
620
- };
621
- Container.prototype._getAll = function (getArgs) {
622
- return __awaiter(this, void 0, void 0, function () {
623
- return __generator(this, function (_a) {
624
- return [2, Promise.all(this._get(getArgs))];
625
- });
626
- });
627
- };
628
- Container.prototype._get = function (getArgs) {
629
- var planAndResolveArgs = __assign(__assign({}, getArgs), { contextInterceptor: function (context) { return context; }, targetType: literal_types_1.TargetTypeEnum.Variable });
630
- if (this._middleware) {
631
- var middlewareResult = this._middleware(planAndResolveArgs);
632
- if (middlewareResult === undefined || middlewareResult === null) {
633
- throw new Error(ERROR_MSGS.INVALID_MIDDLEWARE_RETURN);
634
- }
635
- return middlewareResult;
636
- }
637
- return this._planAndResolve()(planAndResolveArgs);
638
- };
639
- Container.prototype._getButThrowIfAsync = function (getArgs) {
640
- var result = this._get(getArgs);
641
- if ((0, async_1.isPromiseOrContainsPromise)(result)) {
642
- throw new Error(ERROR_MSGS.LAZY_IN_SYNC(getArgs.serviceIdentifier));
643
- }
644
- return result;
645
- };
646
- Container.prototype._getAllArgs = function (serviceIdentifier) {
647
- var getAllArgs = {
648
- avoidConstraints: true,
649
- isMultiInject: true,
650
- serviceIdentifier: serviceIdentifier,
651
- };
652
- return getAllArgs;
653
- };
654
- Container.prototype._getNotAllArgs = function (serviceIdentifier, isMultiInject, key, value) {
655
- var getNotAllArgs = {
656
- avoidConstraints: false,
657
- isMultiInject: isMultiInject,
658
- key: key,
659
- serviceIdentifier: serviceIdentifier,
660
- value: value,
661
- };
662
- return getNotAllArgs;
663
- };
664
- Container.prototype._planAndResolve = function () {
665
- var _this = this;
666
- return function (args) {
667
- var context = (0, planner_1.plan)(_this._metadataReader, _this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
668
- context = args.contextInterceptor(context);
669
- var result = (0, resolver_1.resolve)(context);
670
- return result;
671
- };
672
- };
673
- Container.prototype._deactivateIfSingleton = function (binding) {
674
- var _this = this;
675
- if (!binding.activated) {
676
- return;
677
- }
678
- if ((0, async_1.isPromise)(binding.cache)) {
679
- return binding.cache.then(function (resolved) {
680
- return _this._deactivate(binding, resolved);
681
- });
682
- }
683
- return this._deactivate(binding, binding.cache);
684
- };
685
- Container.prototype._deactivateSingletons = function (bindings) {
686
- for (var _i = 0, bindings_1 = bindings; _i < bindings_1.length; _i++) {
687
- var binding = bindings_1[_i];
688
- var result = this._deactivateIfSingleton(binding);
689
- if ((0, async_1.isPromise)(result)) {
690
- throw new Error(ERROR_MSGS.ASYNC_UNBIND_REQUIRED);
691
- }
692
- }
693
- };
694
- Container.prototype._deactivateSingletonsAsync = function (bindings) {
695
- return __awaiter(this, void 0, void 0, function () {
696
- var _this = this;
697
- return __generator(this, function (_a) {
698
- switch (_a.label) {
699
- case 0: return [4, Promise.all(bindings.map(function (b) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
700
- return [2, this._deactivateIfSingleton(b)];
701
- }); }); }))];
702
- case 1:
703
- _a.sent();
704
- return [2];
705
- }
706
- });
707
- });
708
- };
709
- Container.prototype._propagateContainerDeactivationThenBindingAndPreDestroy = function (binding, instance, constructor) {
710
- if (this.parent) {
711
- return this._deactivate.bind(this.parent)(binding, instance);
712
- }
713
- else {
714
- return this._bindingDeactivationAndPreDestroy(binding, instance, constructor);
715
- }
716
- };
717
- Container.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync = function (binding, instance, constructor) {
718
- return __awaiter(this, void 0, void 0, function () {
719
- return __generator(this, function (_a) {
720
- switch (_a.label) {
721
- case 0:
722
- if (!this.parent) return [3, 2];
723
- return [4, this._deactivate.bind(this.parent)(binding, instance)];
724
- case 1:
725
- _a.sent();
726
- return [3, 4];
727
- case 2: return [4, this._bindingDeactivationAndPreDestroyAsync(binding, instance, constructor)];
728
- case 3:
729
- _a.sent();
730
- _a.label = 4;
731
- case 4: return [2];
732
- }
733
- });
734
- });
735
- };
736
- Container.prototype._removeServiceFromDictionary = function (serviceIdentifier) {
737
- try {
738
- this._bindingDictionary.remove(serviceIdentifier);
739
- }
740
- catch (_e) {
741
- throw new Error("".concat(ERROR_MSGS.CANNOT_UNBIND, " ").concat((0, serialization_1.getServiceIdentifierAsString)(serviceIdentifier)));
742
- }
743
- };
744
- Container.prototype._bindingDeactivationAndPreDestroy = function (binding, instance, constructor) {
745
- var _this = this;
746
- if (typeof binding.onDeactivation === 'function') {
747
- var result = binding.onDeactivation(instance);
748
- if ((0, async_1.isPromise)(result)) {
749
- return result.then(function () {
750
- return _this._preDestroy(constructor, instance);
751
- });
752
- }
753
- }
754
- return this._preDestroy(constructor, instance);
755
- };
756
- Container.prototype._bindingDeactivationAndPreDestroyAsync = function (binding, instance, constructor) {
757
- return __awaiter(this, void 0, void 0, function () {
758
- return __generator(this, function (_a) {
759
- switch (_a.label) {
760
- case 0:
761
- if (!(typeof binding.onDeactivation === 'function')) return [3, 2];
762
- return [4, binding.onDeactivation(instance)];
763
- case 1:
764
- _a.sent();
765
- _a.label = 2;
766
- case 2: return [4, this._preDestroy(constructor, instance)];
767
- case 3:
768
- _a.sent();
769
- return [2];
770
- }
771
- });
772
- });
773
- };
774
- return Container;
775
- }());
776
- exports.Container = Container;