inversify 5.1.1 → 6.0.2

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 (450) hide show
  1. package/.nyc_output/16b95af9-19b9-451c-8475-9a8585677128.json +1 -0
  2. package/.nyc_output/processinfo/16b95af9-19b9-451c-8475-9a8585677128.json +1 -0
  3. package/.nyc_output/processinfo/index.json +1 -1
  4. package/CHANGELOG.md +81 -32
  5. package/LICENSE +22 -22
  6. package/README.md +309 -306
  7. package/amd/annotation/decorator_utils.js +114 -60
  8. package/amd/annotation/inject.js +27 -31
  9. package/amd/annotation/inject_base.js +17 -0
  10. package/amd/annotation/injectable.js +37 -17
  11. package/amd/annotation/lazy_service_identifier.js +15 -0
  12. package/amd/annotation/multi_inject.js +27 -18
  13. package/amd/annotation/named.js +29 -18
  14. package/amd/annotation/optional.js +29 -18
  15. package/amd/annotation/post_construct.js +28 -16
  16. package/amd/annotation/pre_destroy.js +28 -0
  17. package/amd/annotation/property_event_decorator.js +17 -0
  18. package/amd/annotation/tagged.js +9 -18
  19. package/amd/annotation/target_name.js +32 -13
  20. package/amd/annotation/unmanaged.js +32 -13
  21. package/amd/bindings/binding.js +39 -38
  22. package/amd/bindings/binding_count.js +10 -12
  23. package/amd/constants/error_msgs.js +64 -68
  24. package/amd/constants/literal_types.js +28 -29
  25. package/amd/constants/metadata_keys.js +28 -28
  26. package/amd/container/container.js +719 -332
  27. package/amd/container/container_module.js +21 -22
  28. package/amd/container/container_snapshot.js +20 -18
  29. package/amd/container/lookup.js +127 -82
  30. package/amd/container/module_activation_store.js +53 -0
  31. package/amd/interfaces/interfaces.js +10 -5
  32. package/amd/inversify.js +55 -32
  33. package/amd/planning/context.js +19 -20
  34. package/amd/planning/metadata.js +41 -22
  35. package/amd/planning/metadata_reader.js +43 -24
  36. package/amd/planning/plan.js +13 -14
  37. package/amd/planning/planner.js +163 -147
  38. package/amd/planning/queryable_string.js +30 -31
  39. package/amd/planning/reflection_utils.js +157 -128
  40. package/amd/planning/request.js +26 -27
  41. package/amd/planning/target.js +101 -80
  42. package/amd/resolution/instantiation.js +211 -56
  43. package/amd/resolution/resolver.js +222 -99
  44. package/amd/scope/scope.js +93 -0
  45. package/amd/syntax/binding_in_syntax.js +24 -25
  46. package/amd/syntax/binding_in_when_on_syntax.js +75 -73
  47. package/amd/syntax/binding_on_syntax.js +20 -17
  48. package/amd/syntax/binding_to_syntax.js +105 -79
  49. package/amd/syntax/binding_when_on_syntax.js +65 -63
  50. package/amd/syntax/binding_when_syntax.js +102 -100
  51. package/amd/syntax/constraint_helpers.js +61 -42
  52. package/amd/utils/async.js +17 -0
  53. package/amd/utils/binding_utils.js +77 -18
  54. package/amd/utils/clonable.js +12 -0
  55. package/amd/utils/exceptions.js +42 -11
  56. package/amd/utils/factory_type.js +11 -0
  57. package/amd/utils/id.js +10 -11
  58. package/amd/utils/js.js +19 -0
  59. package/amd/utils/serialization.js +129 -106
  60. package/es/annotation/decorator_utils.js +88 -55
  61. package/es/annotation/inject.js +4 -30
  62. package/es/annotation/inject_base.js +14 -0
  63. package/es/annotation/injectable.js +13 -14
  64. package/es/annotation/lazy_service_identifier.js +10 -0
  65. package/es/annotation/multi_inject.js +4 -16
  66. package/es/annotation/named.js +7 -16
  67. package/es/annotation/optional.js +7 -16
  68. package/es/annotation/post_construct.js +5 -14
  69. package/es/annotation/pre_destroy.js +5 -0
  70. package/es/annotation/property_event_decorator.js +13 -0
  71. package/es/annotation/tagged.js +6 -15
  72. package/es/annotation/target_name.js +10 -11
  73. package/es/annotation/unmanaged.js +10 -11
  74. package/es/bindings/binding.js +36 -35
  75. package/es/bindings/binding_count.js +5 -7
  76. package/es/constants/error_msgs.js +52 -59
  77. package/es/constants/literal_types.js +21 -22
  78. package/es/constants/metadata_keys.js +23 -23
  79. package/es/container/container.js +707 -339
  80. package/es/container/container_module.js +17 -18
  81. package/es/container/container_snapshot.js +15 -13
  82. package/es/container/lookup.js +104 -78
  83. package/es/container/module_activation_store.js +49 -0
  84. package/es/interfaces/interfaces.js +5 -2
  85. package/es/inversify.js +25 -21
  86. package/es/planning/context.js +15 -16
  87. package/es/planning/metadata.js +17 -18
  88. package/es/planning/metadata_reader.js +19 -20
  89. package/es/planning/plan.js +8 -9
  90. package/es/planning/planner.js +147 -152
  91. package/es/planning/queryable_string.js +25 -26
  92. package/es/planning/reflection_utils.js +135 -127
  93. package/es/planning/request.js +22 -23
  94. package/es/planning/target.js +81 -79
  95. package/es/resolution/instantiation.js +190 -54
  96. package/es/resolution/resolver.js +205 -99
  97. package/es/scope/scope.js +88 -0
  98. package/es/syntax/binding_in_syntax.js +21 -22
  99. package/es/syntax/binding_in_when_on_syntax.js +73 -71
  100. package/es/syntax/binding_on_syntax.js +16 -13
  101. package/es/syntax/binding_to_syntax.js +84 -78
  102. package/es/syntax/binding_when_on_syntax.js +62 -60
  103. package/es/syntax/binding_when_syntax.js +99 -97
  104. package/es/syntax/constraint_helpers.js +35 -36
  105. package/es/utils/async.js +11 -0
  106. package/es/utils/binding_utils.js +53 -12
  107. package/es/utils/clonable.js +7 -0
  108. package/es/utils/exceptions.js +16 -6
  109. package/es/utils/factory_type.js +6 -0
  110. package/es/utils/id.js +5 -6
  111. package/es/utils/js.js +13 -0
  112. package/es/utils/serialization.js +100 -98
  113. package/es6/annotation/decorator_utils.js +109 -59
  114. package/es6/annotation/inject.js +26 -32
  115. package/es6/annotation/inject_base.js +18 -0
  116. package/es6/annotation/injectable.js +35 -17
  117. package/es6/annotation/lazy_service_identifier.js +12 -0
  118. package/es6/annotation/multi_inject.js +26 -19
  119. package/es6/annotation/named.js +29 -19
  120. package/es6/annotation/optional.js +29 -19
  121. package/es6/annotation/post_construct.js +27 -17
  122. package/es6/annotation/pre_destroy.js +27 -0
  123. package/es6/annotation/property_event_decorator.js +16 -0
  124. package/es6/annotation/tagged.js +9 -18
  125. package/es6/annotation/target_name.js +32 -14
  126. package/es6/annotation/unmanaged.js +32 -14
  127. package/es6/bindings/binding.js +38 -37
  128. package/es6/bindings/binding_count.js +8 -10
  129. package/es6/constants/error_msgs.js +53 -46
  130. package/es6/constants/literal_types.js +26 -27
  131. package/es6/constants/metadata_keys.js +26 -26
  132. package/es6/container/container.js +520 -260
  133. package/es6/container/container_module.js +18 -19
  134. package/es6/container/container_snapshot.js +15 -13
  135. package/es6/container/lookup.js +120 -79
  136. package/es6/container/module_activation_store.js +51 -0
  137. package/es6/interfaces/interfaces.js +8 -3
  138. package/es6/inversify.js +76 -49
  139. package/es6/planning/context.js +17 -18
  140. package/es6/planning/metadata.js +38 -20
  141. package/es6/planning/metadata_reader.js +38 -20
  142. package/es6/planning/plan.js +10 -11
  143. package/es6/planning/planner.js +170 -156
  144. package/es6/planning/queryable_string.js +27 -28
  145. package/es6/planning/reflection_utils.js +155 -128
  146. package/es6/planning/request.js +24 -25
  147. package/es6/planning/target.js +99 -78
  148. package/es6/resolution/instantiation.js +151 -48
  149. package/es6/resolution/resolver.js +187 -100
  150. package/es6/scope/scope.js +57 -0
  151. package/es6/syntax/binding_in_syntax.js +23 -24
  152. package/es6/syntax/binding_in_when_on_syntax.js +75 -73
  153. package/es6/syntax/binding_on_syntax.js +18 -15
  154. package/es6/syntax/binding_to_syntax.js +105 -80
  155. package/es6/syntax/binding_when_on_syntax.js +64 -62
  156. package/es6/syntax/binding_when_syntax.js +79 -77
  157. package/es6/syntax/constraint_helpers.js +58 -40
  158. package/es6/utils/async.js +15 -0
  159. package/es6/utils/binding_utils.js +68 -6
  160. package/es6/utils/clonable.js +10 -0
  161. package/es6/utils/exceptions.js +40 -10
  162. package/es6/utils/factory_type.js +9 -0
  163. package/es6/utils/id.js +8 -9
  164. package/es6/utils/js.js +16 -0
  165. package/es6/utils/serialization.js +126 -104
  166. package/lib/annotation/decorator_utils.d.ts +16 -5
  167. package/lib/annotation/decorator_utils.js +113 -60
  168. package/lib/annotation/inject.d.ts +2 -9
  169. package/lib/annotation/inject.js +26 -33
  170. package/lib/annotation/inject_base.d.ts +3 -0
  171. package/lib/annotation/inject_base.js +18 -0
  172. package/lib/annotation/injectable.d.ts +2 -2
  173. package/lib/annotation/injectable.js +35 -17
  174. package/lib/annotation/lazy_service_identifier.d.ts +7 -0
  175. package/lib/annotation/lazy_service_identifier.js +13 -0
  176. package/lib/annotation/multi_inject.d.ts +2 -3
  177. package/lib/annotation/multi_inject.js +26 -19
  178. package/lib/annotation/named.d.ts +2 -2
  179. package/lib/annotation/named.js +29 -19
  180. package/lib/annotation/optional.d.ts +2 -2
  181. package/lib/annotation/optional.js +29 -19
  182. package/lib/annotation/post_construct.d.ts +4 -2
  183. package/lib/annotation/post_construct.js +27 -17
  184. package/lib/annotation/pre_destroy.d.ts +4 -0
  185. package/lib/annotation/pre_destroy.js +27 -0
  186. package/lib/annotation/property_event_decorator.d.ts +4 -0
  187. package/lib/annotation/property_event_decorator.js +16 -0
  188. package/lib/annotation/tagged.d.ts +2 -2
  189. package/lib/annotation/tagged.js +9 -18
  190. package/lib/annotation/target_name.d.ts +3 -2
  191. package/lib/annotation/target_name.js +32 -14
  192. package/lib/annotation/unmanaged.d.ts +3 -2
  193. package/lib/annotation/unmanaged.js +32 -14
  194. package/lib/bindings/binding.d.ts +20 -19
  195. package/lib/bindings/binding.js +39 -38
  196. package/lib/bindings/binding_count.d.ts +5 -6
  197. package/lib/bindings/binding_count.js +8 -10
  198. package/lib/constants/error_msgs.d.ts +32 -27
  199. package/lib/constants/error_msgs.js +62 -66
  200. package/lib/constants/literal_types.d.ts +5 -5
  201. package/lib/constants/literal_types.js +26 -27
  202. package/lib/constants/metadata_keys.d.ts +13 -12
  203. package/lib/constants/metadata_keys.js +26 -26
  204. package/lib/container/container.d.ts +73 -39
  205. package/lib/container/container.js +729 -342
  206. package/lib/container/container_module.d.ts +11 -11
  207. package/lib/container/container_module.js +20 -21
  208. package/lib/container/container_snapshot.d.ts +10 -7
  209. package/lib/container/container_snapshot.js +18 -16
  210. package/lib/container/lookup.d.ts +16 -14
  211. package/lib/container/lookup.js +126 -81
  212. package/lib/container/module_activation_store.d.ts +10 -0
  213. package/lib/container/module_activation_store.js +52 -0
  214. package/lib/interfaces/interfaces.d.ts +284 -237
  215. package/lib/interfaces/interfaces.js +8 -3
  216. package/lib/inversify.d.ts +25 -21
  217. package/lib/inversify.js +76 -49
  218. package/lib/planning/context.d.ts +11 -11
  219. package/lib/planning/context.js +18 -19
  220. package/lib/planning/metadata.d.ts +8 -8
  221. package/lib/planning/metadata.js +39 -21
  222. package/lib/planning/metadata_reader.d.ts +6 -6
  223. package/lib/planning/metadata_reader.js +41 -23
  224. package/lib/planning/plan.d.ts +7 -7
  225. package/lib/planning/plan.js +11 -12
  226. package/lib/planning/planner.d.ts +5 -5
  227. package/lib/planning/planner.js +171 -157
  228. package/lib/planning/queryable_string.d.ts +11 -11
  229. package/lib/planning/queryable_string.js +28 -29
  230. package/lib/planning/reflection_utils.d.ts +5 -5
  231. package/lib/planning/reflection_utils.js +159 -132
  232. package/lib/planning/request.d.ts +14 -14
  233. package/lib/planning/request.js +25 -26
  234. package/lib/planning/target.d.ts +23 -21
  235. package/lib/planning/target.js +103 -82
  236. package/lib/resolution/instantiation.d.ts +3 -3
  237. package/lib/resolution/instantiation.js +212 -57
  238. package/lib/resolution/resolver.d.ts +3 -3
  239. package/lib/resolution/resolver.js +227 -102
  240. package/lib/scope/scope.d.ts +3 -0
  241. package/lib/scope/scope.js +93 -0
  242. package/lib/syntax/binding_in_syntax.d.ts +9 -9
  243. package/lib/syntax/binding_in_syntax.js +24 -25
  244. package/lib/syntax/binding_in_when_on_syntax.d.ts +29 -28
  245. package/lib/syntax/binding_in_when_on_syntax.js +76 -74
  246. package/lib/syntax/binding_on_syntax.d.ts +8 -7
  247. package/lib/syntax/binding_on_syntax.js +19 -16
  248. package/lib/syntax/binding_to_syntax.d.ts +18 -16
  249. package/lib/syntax/binding_to_syntax.js +106 -81
  250. package/lib/syntax/binding_when_on_syntax.d.ts +25 -24
  251. package/lib/syntax/binding_when_on_syntax.js +65 -63
  252. package/lib/syntax/binding_when_syntax.d.ts +21 -21
  253. package/lib/syntax/binding_when_syntax.js +102 -100
  254. package/lib/syntax/constraint_helpers.d.ts +6 -6
  255. package/lib/syntax/constraint_helpers.js +60 -42
  256. package/lib/tsconfig.tsbuildinfo +1 -719
  257. package/lib/utils/async.d.ts +3 -0
  258. package/lib/utils/async.js +15 -0
  259. package/lib/utils/binding_utils.d.ts +4 -2
  260. package/lib/utils/binding_utils.js +78 -16
  261. package/lib/utils/clonable.d.ts +3 -0
  262. package/lib/utils/clonable.js +10 -0
  263. package/lib/utils/exceptions.d.ts +2 -1
  264. package/lib/utils/exceptions.js +40 -10
  265. package/lib/utils/factory_type.d.ts +5 -0
  266. package/lib/utils/factory_type.js +9 -0
  267. package/lib/utils/id.d.ts +2 -2
  268. package/lib/utils/id.js +8 -9
  269. package/lib/utils/js.d.ts +1 -0
  270. package/lib/utils/js.js +17 -0
  271. package/lib/utils/serialization.d.ts +10 -7
  272. package/lib/utils/serialization.js +127 -105
  273. package/package.json +61 -77
  274. package/.auditignore +0 -2
  275. package/.nyc_output/4df1ad3a-a319-42b9-bb65-746cefa3318e.json +0 -1
  276. package/.nyc_output/processinfo/4df1ad3a-a319-42b9-bb65-746cefa3318e.json +0 -1
  277. package/CODE_OF_CONDUCT.md +0 -46
  278. package/amd/annotation/decorator_utils.js.map +0 -1
  279. package/amd/annotation/inject.js.map +0 -1
  280. package/amd/annotation/injectable.js.map +0 -1
  281. package/amd/annotation/multi_inject.js.map +0 -1
  282. package/amd/annotation/named.js.map +0 -1
  283. package/amd/annotation/optional.js.map +0 -1
  284. package/amd/annotation/post_construct.js.map +0 -1
  285. package/amd/annotation/tagged.js.map +0 -1
  286. package/amd/annotation/target_name.js.map +0 -1
  287. package/amd/annotation/unmanaged.js.map +0 -1
  288. package/amd/bindings/binding.js.map +0 -1
  289. package/amd/bindings/binding_count.js.map +0 -1
  290. package/amd/constants/error_msgs.js.map +0 -1
  291. package/amd/constants/literal_types.js.map +0 -1
  292. package/amd/constants/metadata_keys.js.map +0 -1
  293. package/amd/container/container.js.map +0 -1
  294. package/amd/container/container_module.js.map +0 -1
  295. package/amd/container/container_snapshot.js.map +0 -1
  296. package/amd/container/lookup.js.map +0 -1
  297. package/amd/interfaces/interfaces.js.map +0 -1
  298. package/amd/inversify.js.map +0 -1
  299. package/amd/planning/context.js.map +0 -1
  300. package/amd/planning/metadata.js.map +0 -1
  301. package/amd/planning/metadata_reader.js.map +0 -1
  302. package/amd/planning/plan.js.map +0 -1
  303. package/amd/planning/planner.js.map +0 -1
  304. package/amd/planning/queryable_string.js.map +0 -1
  305. package/amd/planning/reflection_utils.js.map +0 -1
  306. package/amd/planning/request.js.map +0 -1
  307. package/amd/planning/target.js.map +0 -1
  308. package/amd/resolution/instantiation.js.map +0 -1
  309. package/amd/resolution/resolver.js.map +0 -1
  310. package/amd/syntax/binding_in_syntax.js.map +0 -1
  311. package/amd/syntax/binding_in_when_on_syntax.js.map +0 -1
  312. package/amd/syntax/binding_on_syntax.js.map +0 -1
  313. package/amd/syntax/binding_to_syntax.js.map +0 -1
  314. package/amd/syntax/binding_when_on_syntax.js.map +0 -1
  315. package/amd/syntax/binding_when_syntax.js.map +0 -1
  316. package/amd/syntax/constraint_helpers.js.map +0 -1
  317. package/amd/utils/binding_utils.js.map +0 -1
  318. package/amd/utils/exceptions.js.map +0 -1
  319. package/amd/utils/id.js.map +0 -1
  320. package/amd/utils/serialization.js.map +0 -1
  321. package/es/annotation/decorator_utils.js.map +0 -1
  322. package/es/annotation/inject.js.map +0 -1
  323. package/es/annotation/injectable.js.map +0 -1
  324. package/es/annotation/multi_inject.js.map +0 -1
  325. package/es/annotation/named.js.map +0 -1
  326. package/es/annotation/optional.js.map +0 -1
  327. package/es/annotation/post_construct.js.map +0 -1
  328. package/es/annotation/tagged.js.map +0 -1
  329. package/es/annotation/target_name.js.map +0 -1
  330. package/es/annotation/unmanaged.js.map +0 -1
  331. package/es/bindings/binding.js.map +0 -1
  332. package/es/bindings/binding_count.js.map +0 -1
  333. package/es/constants/error_msgs.js.map +0 -1
  334. package/es/constants/literal_types.js.map +0 -1
  335. package/es/constants/metadata_keys.js.map +0 -1
  336. package/es/container/container.js.map +0 -1
  337. package/es/container/container_module.js.map +0 -1
  338. package/es/container/container_snapshot.js.map +0 -1
  339. package/es/container/lookup.js.map +0 -1
  340. package/es/interfaces/interfaces.js.map +0 -1
  341. package/es/inversify.js.map +0 -1
  342. package/es/planning/context.js.map +0 -1
  343. package/es/planning/metadata.js.map +0 -1
  344. package/es/planning/metadata_reader.js.map +0 -1
  345. package/es/planning/plan.js.map +0 -1
  346. package/es/planning/planner.js.map +0 -1
  347. package/es/planning/queryable_string.js.map +0 -1
  348. package/es/planning/reflection_utils.js.map +0 -1
  349. package/es/planning/request.js.map +0 -1
  350. package/es/planning/target.js.map +0 -1
  351. package/es/resolution/instantiation.js.map +0 -1
  352. package/es/resolution/resolver.js.map +0 -1
  353. package/es/syntax/binding_in_syntax.js.map +0 -1
  354. package/es/syntax/binding_in_when_on_syntax.js.map +0 -1
  355. package/es/syntax/binding_on_syntax.js.map +0 -1
  356. package/es/syntax/binding_to_syntax.js.map +0 -1
  357. package/es/syntax/binding_when_on_syntax.js.map +0 -1
  358. package/es/syntax/binding_when_syntax.js.map +0 -1
  359. package/es/syntax/constraint_helpers.js.map +0 -1
  360. package/es/utils/binding_utils.js.map +0 -1
  361. package/es/utils/exceptions.js.map +0 -1
  362. package/es/utils/id.js.map +0 -1
  363. package/es/utils/serialization.js.map +0 -1
  364. package/es6/annotation/decorator_utils.js.map +0 -1
  365. package/es6/annotation/inject.js.map +0 -1
  366. package/es6/annotation/injectable.js.map +0 -1
  367. package/es6/annotation/multi_inject.js.map +0 -1
  368. package/es6/annotation/named.js.map +0 -1
  369. package/es6/annotation/optional.js.map +0 -1
  370. package/es6/annotation/post_construct.js.map +0 -1
  371. package/es6/annotation/tagged.js.map +0 -1
  372. package/es6/annotation/target_name.js.map +0 -1
  373. package/es6/annotation/unmanaged.js.map +0 -1
  374. package/es6/bindings/binding.js.map +0 -1
  375. package/es6/bindings/binding_count.js.map +0 -1
  376. package/es6/constants/error_msgs.js.map +0 -1
  377. package/es6/constants/literal_types.js.map +0 -1
  378. package/es6/constants/metadata_keys.js.map +0 -1
  379. package/es6/container/container.js.map +0 -1
  380. package/es6/container/container_module.js.map +0 -1
  381. package/es6/container/container_snapshot.js.map +0 -1
  382. package/es6/container/lookup.js.map +0 -1
  383. package/es6/interfaces/interfaces.js.map +0 -1
  384. package/es6/inversify.js.map +0 -1
  385. package/es6/planning/context.js.map +0 -1
  386. package/es6/planning/metadata.js.map +0 -1
  387. package/es6/planning/metadata_reader.js.map +0 -1
  388. package/es6/planning/plan.js.map +0 -1
  389. package/es6/planning/planner.js.map +0 -1
  390. package/es6/planning/queryable_string.js.map +0 -1
  391. package/es6/planning/reflection_utils.js.map +0 -1
  392. package/es6/planning/request.js.map +0 -1
  393. package/es6/planning/target.js.map +0 -1
  394. package/es6/resolution/instantiation.js.map +0 -1
  395. package/es6/resolution/resolver.js.map +0 -1
  396. package/es6/syntax/binding_in_syntax.js.map +0 -1
  397. package/es6/syntax/binding_in_when_on_syntax.js.map +0 -1
  398. package/es6/syntax/binding_on_syntax.js.map +0 -1
  399. package/es6/syntax/binding_to_syntax.js.map +0 -1
  400. package/es6/syntax/binding_when_on_syntax.js.map +0 -1
  401. package/es6/syntax/binding_when_syntax.js.map +0 -1
  402. package/es6/syntax/constraint_helpers.js.map +0 -1
  403. package/es6/utils/binding_utils.js.map +0 -1
  404. package/es6/utils/exceptions.js.map +0 -1
  405. package/es6/utils/id.js.map +0 -1
  406. package/es6/utils/serialization.js.map +0 -1
  407. package/lib/annotation/decorator_utils.js.map +0 -1
  408. package/lib/annotation/inject.js.map +0 -1
  409. package/lib/annotation/injectable.js.map +0 -1
  410. package/lib/annotation/multi_inject.js.map +0 -1
  411. package/lib/annotation/named.js.map +0 -1
  412. package/lib/annotation/optional.js.map +0 -1
  413. package/lib/annotation/post_construct.js.map +0 -1
  414. package/lib/annotation/tagged.js.map +0 -1
  415. package/lib/annotation/target_name.js.map +0 -1
  416. package/lib/annotation/unmanaged.js.map +0 -1
  417. package/lib/bindings/binding.js.map +0 -1
  418. package/lib/bindings/binding_count.js.map +0 -1
  419. package/lib/constants/error_msgs.js.map +0 -1
  420. package/lib/constants/literal_types.js.map +0 -1
  421. package/lib/constants/metadata_keys.js.map +0 -1
  422. package/lib/container/container.js.map +0 -1
  423. package/lib/container/container_module.js.map +0 -1
  424. package/lib/container/container_snapshot.js.map +0 -1
  425. package/lib/container/lookup.js.map +0 -1
  426. package/lib/interfaces/interfaces.js.map +0 -1
  427. package/lib/inversify.js.map +0 -1
  428. package/lib/planning/context.js.map +0 -1
  429. package/lib/planning/metadata.js.map +0 -1
  430. package/lib/planning/metadata_reader.js.map +0 -1
  431. package/lib/planning/plan.js.map +0 -1
  432. package/lib/planning/planner.js.map +0 -1
  433. package/lib/planning/queryable_string.js.map +0 -1
  434. package/lib/planning/reflection_utils.js.map +0 -1
  435. package/lib/planning/request.js.map +0 -1
  436. package/lib/planning/target.js.map +0 -1
  437. package/lib/resolution/instantiation.js.map +0 -1
  438. package/lib/resolution/resolver.js.map +0 -1
  439. package/lib/syntax/binding_in_syntax.js.map +0 -1
  440. package/lib/syntax/binding_in_when_on_syntax.js.map +0 -1
  441. package/lib/syntax/binding_on_syntax.js.map +0 -1
  442. package/lib/syntax/binding_to_syntax.js.map +0 -1
  443. package/lib/syntax/binding_when_on_syntax.js.map +0 -1
  444. package/lib/syntax/binding_when_syntax.js.map +0 -1
  445. package/lib/syntax/constraint_helpers.js.map +0 -1
  446. package/lib/utils/binding_utils.js.map +0 -1
  447. package/lib/utils/exceptions.js.map +0 -1
  448. package/lib/utils/id.js.map +0 -1
  449. package/lib/utils/serialization.js.map +0 -1
  450. package/mocha.opts +0 -3
@@ -1,78 +1,84 @@
1
- import * as ERROR_MSGS from "../constants/error_msgs";
2
- import { BindingScopeEnum, BindingTypeEnum } from "../constants/literal_types";
3
- import { BindingInWhenOnSyntax } from "./binding_in_when_on_syntax";
4
- import { BindingWhenOnSyntax } from "./binding_when_on_syntax";
5
- var BindingToSyntax = (function () {
6
- function BindingToSyntax(binding) {
7
- this._binding = binding;
8
- }
9
- BindingToSyntax.prototype.to = function (constructor) {
10
- this._binding.type = BindingTypeEnum.Instance;
11
- this._binding.implementationType = constructor;
12
- return new BindingInWhenOnSyntax(this._binding);
13
- };
14
- BindingToSyntax.prototype.toSelf = function () {
15
- if (typeof this._binding.serviceIdentifier !== "function") {
16
- throw new Error("" + ERROR_MSGS.INVALID_TO_SELF_VALUE);
17
- }
18
- var self = this._binding.serviceIdentifier;
19
- return this.to(self);
20
- };
21
- BindingToSyntax.prototype.toConstantValue = function (value) {
22
- this._binding.type = BindingTypeEnum.ConstantValue;
23
- this._binding.cache = value;
24
- this._binding.dynamicValue = null;
25
- this._binding.implementationType = null;
26
- this._binding.scope = BindingScopeEnum.Singleton;
27
- return new BindingWhenOnSyntax(this._binding);
28
- };
29
- BindingToSyntax.prototype.toDynamicValue = function (func) {
30
- this._binding.type = BindingTypeEnum.DynamicValue;
31
- this._binding.cache = null;
32
- this._binding.dynamicValue = func;
33
- this._binding.implementationType = null;
34
- return new BindingInWhenOnSyntax(this._binding);
35
- };
36
- BindingToSyntax.prototype.toConstructor = function (constructor) {
37
- this._binding.type = BindingTypeEnum.Constructor;
38
- this._binding.implementationType = constructor;
39
- this._binding.scope = BindingScopeEnum.Singleton;
40
- return new BindingWhenOnSyntax(this._binding);
41
- };
42
- BindingToSyntax.prototype.toFactory = function (factory) {
43
- this._binding.type = BindingTypeEnum.Factory;
44
- this._binding.factory = factory;
45
- this._binding.scope = BindingScopeEnum.Singleton;
46
- return new BindingWhenOnSyntax(this._binding);
47
- };
48
- BindingToSyntax.prototype.toFunction = function (func) {
49
- if (typeof func !== "function") {
50
- throw new Error(ERROR_MSGS.INVALID_FUNCTION_BINDING);
51
- }
52
- var bindingWhenOnSyntax = this.toConstantValue(func);
53
- this._binding.type = BindingTypeEnum.Function;
54
- this._binding.scope = BindingScopeEnum.Singleton;
55
- return bindingWhenOnSyntax;
56
- };
57
- BindingToSyntax.prototype.toAutoFactory = function (serviceIdentifier) {
58
- this._binding.type = BindingTypeEnum.Factory;
59
- this._binding.factory = function (context) {
60
- var autofactory = function () { return context.container.get(serviceIdentifier); };
61
- return autofactory;
62
- };
63
- this._binding.scope = BindingScopeEnum.Singleton;
64
- return new BindingWhenOnSyntax(this._binding);
65
- };
66
- BindingToSyntax.prototype.toProvider = function (provider) {
67
- this._binding.type = BindingTypeEnum.Provider;
68
- this._binding.provider = provider;
69
- this._binding.scope = BindingScopeEnum.Singleton;
70
- return new BindingWhenOnSyntax(this._binding);
71
- };
72
- BindingToSyntax.prototype.toService = function (service) {
73
- this.toDynamicValue(function (context) { return context.container.get(service); });
74
- };
75
- return BindingToSyntax;
76
- }());
77
- export { BindingToSyntax };
78
- //# sourceMappingURL=binding_to_syntax.js.map
1
+ import * as ERROR_MSGS from "../constants/error_msgs";
2
+ import { BindingScopeEnum, BindingTypeEnum } from "../constants/literal_types";
3
+ import { BindingInWhenOnSyntax } from "./binding_in_when_on_syntax";
4
+ import { BindingWhenOnSyntax } from "./binding_when_on_syntax";
5
+ var BindingToSyntax = (function () {
6
+ function BindingToSyntax(binding) {
7
+ this._binding = binding;
8
+ }
9
+ BindingToSyntax.prototype.to = function (constructor) {
10
+ this._binding.type = BindingTypeEnum.Instance;
11
+ this._binding.implementationType = constructor;
12
+ return new BindingInWhenOnSyntax(this._binding);
13
+ };
14
+ BindingToSyntax.prototype.toSelf = function () {
15
+ if (typeof this._binding.serviceIdentifier !== "function") {
16
+ throw new Error("" + ERROR_MSGS.INVALID_TO_SELF_VALUE);
17
+ }
18
+ var self = this._binding.serviceIdentifier;
19
+ return this.to(self);
20
+ };
21
+ BindingToSyntax.prototype.toConstantValue = function (value) {
22
+ this._binding.type = BindingTypeEnum.ConstantValue;
23
+ this._binding.cache = value;
24
+ this._binding.dynamicValue = null;
25
+ this._binding.implementationType = null;
26
+ this._binding.scope = BindingScopeEnum.Singleton;
27
+ return new BindingWhenOnSyntax(this._binding);
28
+ };
29
+ BindingToSyntax.prototype.toDynamicValue = function (func) {
30
+ this._binding.type = BindingTypeEnum.DynamicValue;
31
+ this._binding.cache = null;
32
+ this._binding.dynamicValue = func;
33
+ this._binding.implementationType = null;
34
+ return new BindingInWhenOnSyntax(this._binding);
35
+ };
36
+ BindingToSyntax.prototype.toConstructor = function (constructor) {
37
+ this._binding.type = BindingTypeEnum.Constructor;
38
+ this._binding.implementationType = constructor;
39
+ this._binding.scope = BindingScopeEnum.Singleton;
40
+ return new BindingWhenOnSyntax(this._binding);
41
+ };
42
+ BindingToSyntax.prototype.toFactory = function (factory) {
43
+ this._binding.type = BindingTypeEnum.Factory;
44
+ this._binding.factory = factory;
45
+ this._binding.scope = BindingScopeEnum.Singleton;
46
+ return new BindingWhenOnSyntax(this._binding);
47
+ };
48
+ BindingToSyntax.prototype.toFunction = function (func) {
49
+ if (typeof func !== "function") {
50
+ throw new Error(ERROR_MSGS.INVALID_FUNCTION_BINDING);
51
+ }
52
+ var bindingWhenOnSyntax = this.toConstantValue(func);
53
+ this._binding.type = BindingTypeEnum.Function;
54
+ this._binding.scope = BindingScopeEnum.Singleton;
55
+ return bindingWhenOnSyntax;
56
+ };
57
+ BindingToSyntax.prototype.toAutoFactory = function (serviceIdentifier) {
58
+ this._binding.type = BindingTypeEnum.Factory;
59
+ this._binding.factory = function (context) {
60
+ var autofactory = function () { return context.container.get(serviceIdentifier); };
61
+ return autofactory;
62
+ };
63
+ this._binding.scope = BindingScopeEnum.Singleton;
64
+ return new BindingWhenOnSyntax(this._binding);
65
+ };
66
+ BindingToSyntax.prototype.toAutoNamedFactory = function (serviceIdentifier) {
67
+ this._binding.type = BindingTypeEnum.Factory;
68
+ this._binding.factory = function (context) {
69
+ return function (named) { return context.container.getNamed(serviceIdentifier, named); };
70
+ };
71
+ return new BindingWhenOnSyntax(this._binding);
72
+ };
73
+ BindingToSyntax.prototype.toProvider = function (provider) {
74
+ this._binding.type = BindingTypeEnum.Provider;
75
+ this._binding.provider = provider;
76
+ this._binding.scope = BindingScopeEnum.Singleton;
77
+ return new BindingWhenOnSyntax(this._binding);
78
+ };
79
+ BindingToSyntax.prototype.toService = function (service) {
80
+ this.toDynamicValue(function (context) { return context.container.get(service); });
81
+ };
82
+ return BindingToSyntax;
83
+ }());
84
+ export { BindingToSyntax };
@@ -1,60 +1,62 @@
1
- import { BindingOnSyntax } from "./binding_on_syntax";
2
- import { BindingWhenSyntax } from "./binding_when_syntax";
3
- var BindingWhenOnSyntax = (function () {
4
- function BindingWhenOnSyntax(binding) {
5
- this._binding = binding;
6
- this._bindingWhenSyntax = new BindingWhenSyntax(this._binding);
7
- this._bindingOnSyntax = new BindingOnSyntax(this._binding);
8
- }
9
- BindingWhenOnSyntax.prototype.when = function (constraint) {
10
- return this._bindingWhenSyntax.when(constraint);
11
- };
12
- BindingWhenOnSyntax.prototype.whenTargetNamed = function (name) {
13
- return this._bindingWhenSyntax.whenTargetNamed(name);
14
- };
15
- BindingWhenOnSyntax.prototype.whenTargetIsDefault = function () {
16
- return this._bindingWhenSyntax.whenTargetIsDefault();
17
- };
18
- BindingWhenOnSyntax.prototype.whenTargetTagged = function (tag, value) {
19
- return this._bindingWhenSyntax.whenTargetTagged(tag, value);
20
- };
21
- BindingWhenOnSyntax.prototype.whenInjectedInto = function (parent) {
22
- return this._bindingWhenSyntax.whenInjectedInto(parent);
23
- };
24
- BindingWhenOnSyntax.prototype.whenParentNamed = function (name) {
25
- return this._bindingWhenSyntax.whenParentNamed(name);
26
- };
27
- BindingWhenOnSyntax.prototype.whenParentTagged = function (tag, value) {
28
- return this._bindingWhenSyntax.whenParentTagged(tag, value);
29
- };
30
- BindingWhenOnSyntax.prototype.whenAnyAncestorIs = function (ancestor) {
31
- return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor);
32
- };
33
- BindingWhenOnSyntax.prototype.whenNoAncestorIs = function (ancestor) {
34
- return this._bindingWhenSyntax.whenNoAncestorIs(ancestor);
35
- };
36
- BindingWhenOnSyntax.prototype.whenAnyAncestorNamed = function (name) {
37
- return this._bindingWhenSyntax.whenAnyAncestorNamed(name);
38
- };
39
- BindingWhenOnSyntax.prototype.whenAnyAncestorTagged = function (tag, value) {
40
- return this._bindingWhenSyntax.whenAnyAncestorTagged(tag, value);
41
- };
42
- BindingWhenOnSyntax.prototype.whenNoAncestorNamed = function (name) {
43
- return this._bindingWhenSyntax.whenNoAncestorNamed(name);
44
- };
45
- BindingWhenOnSyntax.prototype.whenNoAncestorTagged = function (tag, value) {
46
- return this._bindingWhenSyntax.whenNoAncestorTagged(tag, value);
47
- };
48
- BindingWhenOnSyntax.prototype.whenAnyAncestorMatches = function (constraint) {
49
- return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint);
50
- };
51
- BindingWhenOnSyntax.prototype.whenNoAncestorMatches = function (constraint) {
52
- return this._bindingWhenSyntax.whenNoAncestorMatches(constraint);
53
- };
54
- BindingWhenOnSyntax.prototype.onActivation = function (handler) {
55
- return this._bindingOnSyntax.onActivation(handler);
56
- };
57
- return BindingWhenOnSyntax;
58
- }());
59
- export { BindingWhenOnSyntax };
60
- //# sourceMappingURL=binding_when_on_syntax.js.map
1
+ import { BindingOnSyntax } from './binding_on_syntax';
2
+ import { BindingWhenSyntax } from './binding_when_syntax';
3
+ var BindingWhenOnSyntax = (function () {
4
+ function BindingWhenOnSyntax(binding) {
5
+ this._binding = binding;
6
+ this._bindingWhenSyntax = new BindingWhenSyntax(this._binding);
7
+ this._bindingOnSyntax = new BindingOnSyntax(this._binding);
8
+ }
9
+ BindingWhenOnSyntax.prototype.when = function (constraint) {
10
+ return this._bindingWhenSyntax.when(constraint);
11
+ };
12
+ BindingWhenOnSyntax.prototype.whenTargetNamed = function (name) {
13
+ return this._bindingWhenSyntax.whenTargetNamed(name);
14
+ };
15
+ BindingWhenOnSyntax.prototype.whenTargetIsDefault = function () {
16
+ return this._bindingWhenSyntax.whenTargetIsDefault();
17
+ };
18
+ BindingWhenOnSyntax.prototype.whenTargetTagged = function (tag, value) {
19
+ return this._bindingWhenSyntax.whenTargetTagged(tag, value);
20
+ };
21
+ BindingWhenOnSyntax.prototype.whenInjectedInto = function (parent) {
22
+ return this._bindingWhenSyntax.whenInjectedInto(parent);
23
+ };
24
+ BindingWhenOnSyntax.prototype.whenParentNamed = function (name) {
25
+ return this._bindingWhenSyntax.whenParentNamed(name);
26
+ };
27
+ BindingWhenOnSyntax.prototype.whenParentTagged = function (tag, value) {
28
+ return this._bindingWhenSyntax.whenParentTagged(tag, value);
29
+ };
30
+ BindingWhenOnSyntax.prototype.whenAnyAncestorIs = function (ancestor) {
31
+ return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor);
32
+ };
33
+ BindingWhenOnSyntax.prototype.whenNoAncestorIs = function (ancestor) {
34
+ return this._bindingWhenSyntax.whenNoAncestorIs(ancestor);
35
+ };
36
+ BindingWhenOnSyntax.prototype.whenAnyAncestorNamed = function (name) {
37
+ return this._bindingWhenSyntax.whenAnyAncestorNamed(name);
38
+ };
39
+ BindingWhenOnSyntax.prototype.whenAnyAncestorTagged = function (tag, value) {
40
+ return this._bindingWhenSyntax.whenAnyAncestorTagged(tag, value);
41
+ };
42
+ BindingWhenOnSyntax.prototype.whenNoAncestorNamed = function (name) {
43
+ return this._bindingWhenSyntax.whenNoAncestorNamed(name);
44
+ };
45
+ BindingWhenOnSyntax.prototype.whenNoAncestorTagged = function (tag, value) {
46
+ return this._bindingWhenSyntax.whenNoAncestorTagged(tag, value);
47
+ };
48
+ BindingWhenOnSyntax.prototype.whenAnyAncestorMatches = function (constraint) {
49
+ return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint);
50
+ };
51
+ BindingWhenOnSyntax.prototype.whenNoAncestorMatches = function (constraint) {
52
+ return this._bindingWhenSyntax.whenNoAncestorMatches(constraint);
53
+ };
54
+ BindingWhenOnSyntax.prototype.onActivation = function (handler) {
55
+ return this._bindingOnSyntax.onActivation(handler);
56
+ };
57
+ BindingWhenOnSyntax.prototype.onDeactivation = function (handler) {
58
+ return this._bindingOnSyntax.onDeactivation(handler);
59
+ };
60
+ return BindingWhenOnSyntax;
61
+ }());
62
+ export { BindingWhenOnSyntax };
@@ -1,97 +1,99 @@
1
- import { BindingOnSyntax } from "./binding_on_syntax";
2
- import { namedConstraint, taggedConstraint, traverseAncerstors, typeConstraint } from "./constraint_helpers";
3
- var BindingWhenSyntax = (function () {
4
- function BindingWhenSyntax(binding) {
5
- this._binding = binding;
6
- }
7
- BindingWhenSyntax.prototype.when = function (constraint) {
8
- this._binding.constraint = constraint;
9
- return new BindingOnSyntax(this._binding);
10
- };
11
- BindingWhenSyntax.prototype.whenTargetNamed = function (name) {
12
- this._binding.constraint = namedConstraint(name);
13
- return new BindingOnSyntax(this._binding);
14
- };
15
- BindingWhenSyntax.prototype.whenTargetIsDefault = function () {
16
- this._binding.constraint = function (request) {
17
- var targetIsDefault = (request.target !== null) &&
18
- (!request.target.isNamed()) &&
19
- (!request.target.isTagged());
20
- return targetIsDefault;
21
- };
22
- return new BindingOnSyntax(this._binding);
23
- };
24
- BindingWhenSyntax.prototype.whenTargetTagged = function (tag, value) {
25
- this._binding.constraint = taggedConstraint(tag)(value);
26
- return new BindingOnSyntax(this._binding);
27
- };
28
- BindingWhenSyntax.prototype.whenInjectedInto = function (parent) {
29
- this._binding.constraint = function (request) {
30
- return typeConstraint(parent)(request.parentRequest);
31
- };
32
- return new BindingOnSyntax(this._binding);
33
- };
34
- BindingWhenSyntax.prototype.whenParentNamed = function (name) {
35
- this._binding.constraint = function (request) {
36
- return namedConstraint(name)(request.parentRequest);
37
- };
38
- return new BindingOnSyntax(this._binding);
39
- };
40
- BindingWhenSyntax.prototype.whenParentTagged = function (tag, value) {
41
- this._binding.constraint = function (request) {
42
- return taggedConstraint(tag)(value)(request.parentRequest);
43
- };
44
- return new BindingOnSyntax(this._binding);
45
- };
46
- BindingWhenSyntax.prototype.whenAnyAncestorIs = function (ancestor) {
47
- this._binding.constraint = function (request) {
48
- return traverseAncerstors(request, typeConstraint(ancestor));
49
- };
50
- return new BindingOnSyntax(this._binding);
51
- };
52
- BindingWhenSyntax.prototype.whenNoAncestorIs = function (ancestor) {
53
- this._binding.constraint = function (request) {
54
- return !traverseAncerstors(request, typeConstraint(ancestor));
55
- };
56
- return new BindingOnSyntax(this._binding);
57
- };
58
- BindingWhenSyntax.prototype.whenAnyAncestorNamed = function (name) {
59
- this._binding.constraint = function (request) {
60
- return traverseAncerstors(request, namedConstraint(name));
61
- };
62
- return new BindingOnSyntax(this._binding);
63
- };
64
- BindingWhenSyntax.prototype.whenNoAncestorNamed = function (name) {
65
- this._binding.constraint = function (request) {
66
- return !traverseAncerstors(request, namedConstraint(name));
67
- };
68
- return new BindingOnSyntax(this._binding);
69
- };
70
- BindingWhenSyntax.prototype.whenAnyAncestorTagged = function (tag, value) {
71
- this._binding.constraint = function (request) {
72
- return traverseAncerstors(request, taggedConstraint(tag)(value));
73
- };
74
- return new BindingOnSyntax(this._binding);
75
- };
76
- BindingWhenSyntax.prototype.whenNoAncestorTagged = function (tag, value) {
77
- this._binding.constraint = function (request) {
78
- return !traverseAncerstors(request, taggedConstraint(tag)(value));
79
- };
80
- return new BindingOnSyntax(this._binding);
81
- };
82
- BindingWhenSyntax.prototype.whenAnyAncestorMatches = function (constraint) {
83
- this._binding.constraint = function (request) {
84
- return traverseAncerstors(request, constraint);
85
- };
86
- return new BindingOnSyntax(this._binding);
87
- };
88
- BindingWhenSyntax.prototype.whenNoAncestorMatches = function (constraint) {
89
- this._binding.constraint = function (request) {
90
- return !traverseAncerstors(request, constraint);
91
- };
92
- return new BindingOnSyntax(this._binding);
93
- };
94
- return BindingWhenSyntax;
95
- }());
96
- export { BindingWhenSyntax };
97
- //# sourceMappingURL=binding_when_syntax.js.map
1
+ import { BindingOnSyntax } from './binding_on_syntax';
2
+ import { namedConstraint, taggedConstraint, traverseAncerstors, typeConstraint } from './constraint_helpers';
3
+ var BindingWhenSyntax = (function () {
4
+ function BindingWhenSyntax(binding) {
5
+ this._binding = binding;
6
+ }
7
+ BindingWhenSyntax.prototype.when = function (constraint) {
8
+ this._binding.constraint = constraint;
9
+ return new BindingOnSyntax(this._binding);
10
+ };
11
+ BindingWhenSyntax.prototype.whenTargetNamed = function (name) {
12
+ this._binding.constraint = namedConstraint(name);
13
+ return new BindingOnSyntax(this._binding);
14
+ };
15
+ BindingWhenSyntax.prototype.whenTargetIsDefault = function () {
16
+ this._binding.constraint = function (request) {
17
+ if (request === null) {
18
+ return false;
19
+ }
20
+ var targetIsDefault = (request.target !== null) &&
21
+ (!request.target.isNamed()) &&
22
+ (!request.target.isTagged());
23
+ return targetIsDefault;
24
+ };
25
+ return new BindingOnSyntax(this._binding);
26
+ };
27
+ BindingWhenSyntax.prototype.whenTargetTagged = function (tag, value) {
28
+ this._binding.constraint = taggedConstraint(tag)(value);
29
+ return new BindingOnSyntax(this._binding);
30
+ };
31
+ BindingWhenSyntax.prototype.whenInjectedInto = function (parent) {
32
+ this._binding.constraint = function (request) {
33
+ return request !== null && typeConstraint(parent)(request.parentRequest);
34
+ };
35
+ return new BindingOnSyntax(this._binding);
36
+ };
37
+ BindingWhenSyntax.prototype.whenParentNamed = function (name) {
38
+ this._binding.constraint = function (request) {
39
+ return request !== null && namedConstraint(name)(request.parentRequest);
40
+ };
41
+ return new BindingOnSyntax(this._binding);
42
+ };
43
+ BindingWhenSyntax.prototype.whenParentTagged = function (tag, value) {
44
+ this._binding.constraint = function (request) {
45
+ return request !== null && taggedConstraint(tag)(value)(request.parentRequest);
46
+ };
47
+ return new BindingOnSyntax(this._binding);
48
+ };
49
+ BindingWhenSyntax.prototype.whenAnyAncestorIs = function (ancestor) {
50
+ this._binding.constraint = function (request) {
51
+ return request !== null && traverseAncerstors(request, typeConstraint(ancestor));
52
+ };
53
+ return new BindingOnSyntax(this._binding);
54
+ };
55
+ BindingWhenSyntax.prototype.whenNoAncestorIs = function (ancestor) {
56
+ this._binding.constraint = function (request) {
57
+ return request !== null && !traverseAncerstors(request, typeConstraint(ancestor));
58
+ };
59
+ return new BindingOnSyntax(this._binding);
60
+ };
61
+ BindingWhenSyntax.prototype.whenAnyAncestorNamed = function (name) {
62
+ this._binding.constraint = function (request) {
63
+ return request !== null && traverseAncerstors(request, namedConstraint(name));
64
+ };
65
+ return new BindingOnSyntax(this._binding);
66
+ };
67
+ BindingWhenSyntax.prototype.whenNoAncestorNamed = function (name) {
68
+ this._binding.constraint = function (request) {
69
+ return request !== null && !traverseAncerstors(request, namedConstraint(name));
70
+ };
71
+ return new BindingOnSyntax(this._binding);
72
+ };
73
+ BindingWhenSyntax.prototype.whenAnyAncestorTagged = function (tag, value) {
74
+ this._binding.constraint = function (request) {
75
+ return request !== null && traverseAncerstors(request, taggedConstraint(tag)(value));
76
+ };
77
+ return new BindingOnSyntax(this._binding);
78
+ };
79
+ BindingWhenSyntax.prototype.whenNoAncestorTagged = function (tag, value) {
80
+ this._binding.constraint = function (request) {
81
+ return request !== null && !traverseAncerstors(request, taggedConstraint(tag)(value));
82
+ };
83
+ return new BindingOnSyntax(this._binding);
84
+ };
85
+ BindingWhenSyntax.prototype.whenAnyAncestorMatches = function (constraint) {
86
+ this._binding.constraint = function (request) {
87
+ return request !== null && traverseAncerstors(request, constraint);
88
+ };
89
+ return new BindingOnSyntax(this._binding);
90
+ };
91
+ BindingWhenSyntax.prototype.whenNoAncestorMatches = function (constraint) {
92
+ this._binding.constraint = function (request) {
93
+ return request !== null && !traverseAncerstors(request, constraint);
94
+ };
95
+ return new BindingOnSyntax(this._binding);
96
+ };
97
+ return BindingWhenSyntax;
98
+ }());
99
+ export { BindingWhenSyntax };
@@ -1,36 +1,35 @@
1
- import * as METADATA_KEY from "../constants/metadata_keys";
2
- import { Metadata } from "../planning/metadata";
3
- var traverseAncerstors = function (request, constraint) {
4
- var parent = request.parentRequest;
5
- if (parent !== null) {
6
- return constraint(parent) ? true : traverseAncerstors(parent, constraint);
7
- }
8
- else {
9
- return false;
10
- }
11
- };
12
- var taggedConstraint = function (key) { return function (value) {
13
- var constraint = function (request) {
14
- return request !== null && request.target !== null && request.target.matchesTag(key)(value);
15
- };
16
- constraint.metaData = new Metadata(key, value);
17
- return constraint;
18
- }; };
19
- var namedConstraint = taggedConstraint(METADATA_KEY.NAMED_TAG);
20
- var typeConstraint = function (type) { return function (request) {
21
- var binding = null;
22
- if (request !== null) {
23
- binding = request.bindings[0];
24
- if (typeof type === "string") {
25
- var serviceIdentifier = binding.serviceIdentifier;
26
- return serviceIdentifier === type;
27
- }
28
- else {
29
- var constructor = request.bindings[0].implementationType;
30
- return type === constructor;
31
- }
32
- }
33
- return false;
34
- }; };
35
- export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint };
36
- //# sourceMappingURL=constraint_helpers.js.map
1
+ import * as METADATA_KEY from '../constants/metadata_keys';
2
+ import { Metadata } from '../planning/metadata';
3
+ var traverseAncerstors = function (request, constraint) {
4
+ var parent = request.parentRequest;
5
+ if (parent !== null) {
6
+ return constraint(parent) ? true : traverseAncerstors(parent, constraint);
7
+ }
8
+ else {
9
+ return false;
10
+ }
11
+ };
12
+ var taggedConstraint = function (key) { return function (value) {
13
+ var constraint = function (request) {
14
+ return request !== null && request.target !== null && request.target.matchesTag(key)(value);
15
+ };
16
+ constraint.metaData = new Metadata(key, value);
17
+ return constraint;
18
+ }; };
19
+ var namedConstraint = taggedConstraint(METADATA_KEY.NAMED_TAG);
20
+ var typeConstraint = function (type) { return function (request) {
21
+ var binding = null;
22
+ if (request !== null) {
23
+ binding = request.bindings[0];
24
+ if (typeof type === 'string') {
25
+ var serviceIdentifier = binding.serviceIdentifier;
26
+ return serviceIdentifier === type;
27
+ }
28
+ else {
29
+ var constructor = request.bindings[0].implementationType;
30
+ return type === constructor;
31
+ }
32
+ }
33
+ return false;
34
+ }; };
35
+ export { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint };
@@ -0,0 +1,11 @@
1
+ function isPromise(object) {
2
+ var isObjectOrFunction = (typeof object === 'object' && object !== null) || typeof object === 'function';
3
+ return isObjectOrFunction && typeof object.then === "function";
4
+ }
5
+ function isPromiseOrContainsPromise(object) {
6
+ if (isPromise(object)) {
7
+ return true;
8
+ }
9
+ return Array.isArray(object) && object.some(isPromise);
10
+ }
11
+ export { isPromise, isPromiseOrContainsPromise };
@@ -1,12 +1,53 @@
1
- export var multiBindToService = function (container) {
2
- return function (service) {
3
- return function () {
4
- var types = [];
5
- for (var _i = 0; _i < arguments.length; _i++) {
6
- types[_i] = arguments[_i];
7
- }
8
- return types.forEach(function (t) { return container.bind(t).toService(service); });
9
- };
10
- };
11
- };
12
- //# sourceMappingURL=binding_utils.js.map
1
+ import { getServiceIdentifierAsString } from '../utils/serialization';
2
+ import * as ERROR_MSGS from '../constants/error_msgs';
3
+ import { BindingTypeEnum } from '../constants/literal_types';
4
+ import { FactoryType } from './factory_type';
5
+ export var multiBindToService = function (container) {
6
+ return function (service) {
7
+ return function () {
8
+ var types = [];
9
+ for (var _i = 0; _i < arguments.length; _i++) {
10
+ types[_i] = arguments[_i];
11
+ }
12
+ return types.forEach(function (t) { return container.bind(t).toService(service); });
13
+ };
14
+ };
15
+ };
16
+ export var ensureFullyBound = function (binding) {
17
+ var boundValue = null;
18
+ switch (binding.type) {
19
+ case BindingTypeEnum.ConstantValue:
20
+ case BindingTypeEnum.Function:
21
+ boundValue = binding.cache;
22
+ break;
23
+ case BindingTypeEnum.Constructor:
24
+ case BindingTypeEnum.Instance:
25
+ boundValue = binding.implementationType;
26
+ break;
27
+ case BindingTypeEnum.DynamicValue:
28
+ boundValue = binding.dynamicValue;
29
+ break;
30
+ case BindingTypeEnum.Provider:
31
+ boundValue = binding.provider;
32
+ break;
33
+ case BindingTypeEnum.Factory:
34
+ boundValue = binding.factory;
35
+ break;
36
+ }
37
+ if (boundValue === null) {
38
+ var serviceIdentifierAsString = getServiceIdentifierAsString(binding.serviceIdentifier);
39
+ throw new Error(ERROR_MSGS.INVALID_BINDING_TYPE + " " + serviceIdentifierAsString);
40
+ }
41
+ };
42
+ export var getFactoryDetails = function (binding) {
43
+ switch (binding.type) {
44
+ case BindingTypeEnum.Factory:
45
+ return { factory: binding.factory, factoryType: FactoryType.Factory };
46
+ case BindingTypeEnum.Provider:
47
+ return { factory: binding.provider, factoryType: FactoryType.Provider };
48
+ case BindingTypeEnum.DynamicValue:
49
+ return { factory: binding.dynamicValue, factoryType: FactoryType.DynamicValue };
50
+ default:
51
+ throw new Error("Unexpected factory type " + binding.type);
52
+ }
53
+ };
@@ -0,0 +1,7 @@
1
+ function isClonable(obj) {
2
+ return (typeof obj === 'object')
3
+ && (obj !== null)
4
+ && ('clone' in obj)
5
+ && typeof obj.clone === 'function';
6
+ }
7
+ export { isClonable };