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