inversify 4.11.1 → 5.0.5

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 (129) hide show
  1. package/.auditignore +2 -0
  2. package/.nyc_output/24cbca0e-b065-453e-9d1e-2a381e69663d.json +1 -0
  3. package/.nyc_output/processinfo/24cbca0e-b065-453e-9d1e-2a381e69663d.json +1 -0
  4. package/.nyc_output/processinfo/index.json +1 -0
  5. package/CHANGELOG.md +24 -0
  6. package/README.md +8 -8
  7. package/amd/annotation/decorator_utils.js +2 -1
  8. package/amd/annotation/inject.js +1 -0
  9. package/amd/annotation/injectable.js +1 -0
  10. package/amd/annotation/multi_inject.js +1 -0
  11. package/amd/annotation/named.js +1 -0
  12. package/amd/annotation/optional.js +1 -0
  13. package/amd/annotation/post_construct.js +1 -0
  14. package/amd/annotation/tagged.js +1 -0
  15. package/amd/annotation/target_name.js +1 -0
  16. package/amd/annotation/unmanaged.js +1 -0
  17. package/amd/bindings/binding.js +3 -2
  18. package/amd/bindings/binding_count.js +1 -0
  19. package/amd/constants/error_msgs.js +11 -2
  20. package/amd/constants/literal_types.js +1 -0
  21. package/amd/constants/metadata_keys.js +1 -0
  22. package/amd/container/container.js +40 -37
  23. package/amd/container/container_module.js +4 -3
  24. package/amd/container/container_snapshot.js +1 -0
  25. package/amd/container/lookup.js +1 -0
  26. package/amd/inversify.js +27 -26
  27. package/amd/planning/context.js +3 -2
  28. package/amd/planning/metadata.js +1 -0
  29. package/amd/planning/metadata_reader.js +1 -0
  30. package/amd/planning/plan.js +1 -0
  31. package/amd/planning/planner.js +8 -0
  32. package/amd/planning/queryable_string.js +1 -0
  33. package/amd/planning/reflection_utils.js +12 -8
  34. package/amd/planning/request.js +3 -2
  35. package/amd/planning/target.js +3 -2
  36. package/amd/resolution/instantiation.js +9 -1
  37. package/amd/resolution/resolver.js +5 -4
  38. package/amd/syntax/binding_in_syntax.js +1 -0
  39. package/amd/syntax/binding_in_when_on_syntax.js +1 -0
  40. package/amd/syntax/binding_on_syntax.js +1 -0
  41. package/amd/syntax/binding_to_syntax.js +1 -0
  42. package/amd/syntax/binding_when_on_syntax.js +1 -0
  43. package/amd/syntax/binding_when_syntax.js +1 -0
  44. package/amd/syntax/constraint_helpers.js +1 -0
  45. package/amd/utils/binding_utils.js +1 -0
  46. package/amd/utils/exceptions.js +1 -0
  47. package/amd/utils/id.js +10 -0
  48. package/amd/utils/serialization.js +1 -0
  49. package/dts/annotation/inject.d.ts +1 -1
  50. package/dts/bindings/binding.d.ts +1 -1
  51. package/dts/constants/error_msgs.d.ts +2 -2
  52. package/dts/container/container.d.ts +5 -5
  53. package/dts/container/container_module.d.ts +2 -2
  54. package/dts/container/lookup.d.ts +1 -1
  55. package/dts/interfaces/interfaces.d.ts +12 -13
  56. package/dts/inversify.d.ts +1 -1
  57. package/dts/planning/context.d.ts +1 -1
  58. package/dts/planning/reflection_utils.d.ts +3 -1
  59. package/dts/planning/request.d.ts +1 -1
  60. package/dts/planning/target.d.ts +1 -1
  61. package/dts/syntax/binding_to_syntax.d.ts +1 -3
  62. package/dts/syntax/constraint_helpers.d.ts +2 -2
  63. package/dts/utils/binding_utils.d.ts +1 -1
  64. package/dts/utils/cat.d.ts +5 -0
  65. package/dts/utils/dog.d.ts +3 -0
  66. package/dts/utils/id.d.ts +2 -0
  67. package/es/annotation/decorator_utils.js +1 -1
  68. package/es/bindings/binding.js +2 -2
  69. package/es/constants/error_msgs.js +10 -2
  70. package/es/container/container.js +39 -37
  71. package/es/container/container_module.js +3 -3
  72. package/es/inversify.js +1 -1
  73. package/es/planning/context.js +2 -2
  74. package/es/planning/planner.js +8 -1
  75. package/es/planning/reflection_utils.js +10 -9
  76. package/es/planning/request.js +2 -2
  77. package/es/planning/target.js +2 -2
  78. package/es/resolution/instantiation.js +8 -1
  79. package/es/resolution/resolver.js +4 -4
  80. package/es/utils/id.js +5 -0
  81. package/lib/annotation/decorator_utils.js +2 -1
  82. package/lib/annotation/inject.js +1 -0
  83. package/lib/annotation/injectable.js +1 -0
  84. package/lib/annotation/multi_inject.js +1 -0
  85. package/lib/annotation/named.js +1 -0
  86. package/lib/annotation/optional.js +1 -0
  87. package/lib/annotation/post_construct.js +1 -0
  88. package/lib/annotation/tagged.js +1 -0
  89. package/lib/annotation/target_name.js +1 -0
  90. package/lib/annotation/unmanaged.js +1 -0
  91. package/lib/bindings/binding.js +3 -2
  92. package/lib/bindings/binding_count.js +1 -0
  93. package/lib/constants/error_msgs.js +11 -2
  94. package/lib/constants/literal_types.js +1 -0
  95. package/lib/constants/metadata_keys.js +1 -0
  96. package/lib/container/container.js +40 -37
  97. package/lib/container/container_module.js +4 -3
  98. package/lib/container/container_snapshot.js +1 -0
  99. package/lib/container/lookup.js +1 -0
  100. package/lib/inversify.js +27 -26
  101. package/lib/planning/context.js +3 -2
  102. package/lib/planning/metadata.js +1 -0
  103. package/lib/planning/metadata_reader.js +1 -0
  104. package/lib/planning/plan.js +1 -0
  105. package/lib/planning/planner.js +8 -0
  106. package/lib/planning/queryable_string.js +1 -0
  107. package/lib/planning/reflection_utils.js +12 -8
  108. package/lib/planning/request.js +3 -2
  109. package/lib/planning/target.js +3 -2
  110. package/lib/resolution/instantiation.js +9 -1
  111. package/lib/resolution/resolver.js +5 -4
  112. package/lib/syntax/binding_in_syntax.js +1 -0
  113. package/lib/syntax/binding_in_when_on_syntax.js +1 -0
  114. package/lib/syntax/binding_on_syntax.js +1 -0
  115. package/lib/syntax/binding_to_syntax.js +1 -0
  116. package/lib/syntax/binding_when_on_syntax.js +1 -0
  117. package/lib/syntax/binding_when_syntax.js +1 -0
  118. package/lib/syntax/constraint_helpers.js +1 -0
  119. package/lib/utils/binding_utils.js +1 -0
  120. package/lib/utils/exceptions.js +1 -0
  121. package/lib/utils/id.js +8 -0
  122. package/lib/utils/serialization.js +1 -0
  123. package/mocha.opts +3 -0
  124. package/package.json +39 -33
  125. package/amd/utils/guid.js +0 -14
  126. package/appveyor.yml +0 -34
  127. package/dts/utils/guid.d.ts +0 -2
  128. package/es/utils/guid.js +0 -10
  129. package/lib/utils/guid.js +0 -12
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":85168,"argv":["/Users/dan/.nvm/versions/node/v12.18.3/bin/node","/Users/dan/jsProjects/inversify/InversifyJS/node_modules/.bin/mocha","test/annotation/inject.test.ts","test/annotation/injectable.test.ts","test/annotation/multi_inject.test.ts","test/annotation/named.test.ts","test/annotation/optional.test.ts","test/annotation/post_construct.test.ts","test/annotation/tagged.test.ts","test/annotation/target_name.test.ts","test/bindings/binding.test.ts","test/bugs/bugs.test.ts","test/bugs/issue_543.test.ts","test/bugs/issue_549.test.ts","test/bugs/issue_633.test.ts","test/bugs/issue_706.test.ts","test/constants/error_message.test.ts","test/container/container.test.ts","test/container/container_module.test.ts","test/container/lookup.test.ts","test/features/metadata_reader.test.ts","test/features/named_default.test.ts","test/features/property_injection.test.ts","test/features/provider.test.ts","test/features/request_scope.test.ts","test/features/resolve_unbinded.test.ts","test/features/transitive_bindings.test.ts","test/middleware/middleware.test.ts","test/node/error_messages.test.ts","test/node/exceptions.test.ts","test/node/performance.test.ts","test/node/proxies.test.ts","test/planning/context.test.ts","test/planning/metadata.test.ts","test/planning/plan.test.ts","test/planning/planner.test.ts","test/planning/queryable_string.test.ts","test/planning/request.test.ts","test/planning/target.test.ts","test/resolution/resolver.test.ts","test/syntax/binding_in_syntax.test.ts","test/syntax/binding_in_when_on_syntax.test.ts","test/syntax/binding_on_syntax.test.ts","test/syntax/binding_to_syntax.test.ts","test/syntax/binding_when_on_syntax.test.ts","test/syntax/binding_when_syntax.test.ts","test/syntax/constraint_helpers.test.ts","test/utils/id.test.ts","test/utils/serialization.test.ts","--reporter","spec","--retries","3","--require","node_modules/reflect-metadata/Reflect.js","--exit"],"execArgv":[],"cwd":"/Users/dan/jsProjects/inversify/InversifyJS","time":1607566191565,"ppid":85167,"coverageFilename":"/Users/dan/jsProjects/inversify/InversifyJS/.nyc_output/24cbca0e-b065-453e-9d1e-2a381e69663d.json","externalId":"","uuid":"24cbca0e-b065-453e-9d1e-2a381e69663d","files":["/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/decorator_utils.js","/Users/dan/jsProjects/inversify/InversifyJS/src/constants/error_msgs.js","/Users/dan/jsProjects/inversify/InversifyJS/src/constants/metadata_keys.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/inject.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/metadata.js","/Users/dan/jsProjects/inversify/InversifyJS/src/inversify.js","/Users/dan/jsProjects/inversify/InversifyJS/src/container/container.js","/Users/dan/jsProjects/inversify/InversifyJS/src/bindings/binding.js","/Users/dan/jsProjects/inversify/InversifyJS/src/constants/literal_types.js","/Users/dan/jsProjects/inversify/InversifyJS/src/utils/id.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/metadata_reader.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/planner.js","/Users/dan/jsProjects/inversify/InversifyJS/src/bindings/binding_count.js","/Users/dan/jsProjects/inversify/InversifyJS/src/utils/exceptions.js","/Users/dan/jsProjects/inversify/InversifyJS/src/utils/serialization.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/context.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/plan.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/reflection_utils.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/target.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/queryable_string.js","/Users/dan/jsProjects/inversify/InversifyJS/src/planning/request.js","/Users/dan/jsProjects/inversify/InversifyJS/src/resolution/resolver.js","/Users/dan/jsProjects/inversify/InversifyJS/src/resolution/instantiation.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_to_syntax.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_in_when_on_syntax.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_in_syntax.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_when_on_syntax.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_on_syntax.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_when_syntax.js","/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/constraint_helpers.js","/Users/dan/jsProjects/inversify/InversifyJS/src/container/container_snapshot.js","/Users/dan/jsProjects/inversify/InversifyJS/src/container/lookup.js","/Users/dan/jsProjects/inversify/InversifyJS/src/container/container_module.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/injectable.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/tagged.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/named.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/optional.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/unmanaged.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/multi_inject.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/target_name.js","/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/post_construct.js","/Users/dan/jsProjects/inversify/InversifyJS/src/utils/binding_utils.js"]}
@@ -0,0 +1 @@
1
+ {"processes":{"24cbca0e-b065-453e-9d1e-2a381e69663d":{"parent":null,"children":[]}},"files":{"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/decorator_utils.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/constants/error_msgs.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/constants/metadata_keys.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/inject.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/metadata.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/inversify.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/container/container.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/bindings/binding.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/constants/literal_types.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/utils/id.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/metadata_reader.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/planner.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/bindings/binding_count.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/utils/exceptions.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/utils/serialization.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/context.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/plan.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/reflection_utils.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/target.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/queryable_string.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/planning/request.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/resolution/resolver.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/resolution/instantiation.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_to_syntax.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_in_when_on_syntax.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_in_syntax.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_when_on_syntax.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_on_syntax.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/binding_when_syntax.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/syntax/constraint_helpers.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/container/container_snapshot.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/container/lookup.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/container/container_module.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/injectable.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/tagged.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/named.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/optional.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/unmanaged.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/multi_inject.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/target_name.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/annotation/post_construct.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"],"/Users/dan/jsProjects/inversify/InversifyJS/src/utils/binding_utils.js":["24cbca0e-b065-453e-9d1e-2a381e69663d"]},"externalIds":{}}
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+ All notable changes to this project from 5.0.0 forward will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+ ### Added
9
+ - Upgrade information for v4.x to v5.x
10
+
11
+ ## [5.0.1] - 2018-10-17
12
+ ### Added
13
+ - Updating constructor injection wiki document with concrete injection example #922
14
+
15
+ ### Changed
16
+ - Change GUID to incremented counter for better performance #882
17
+
18
+ ### Fixed
19
+ - fix broken compilation by adding `.toString()` so symbols serialization #893
20
+ - Fix problem with applying options on Container.resolve (fix #914) #915
21
+ - Fixed documentation issues
22
+
23
+ ## [4.14.0] - 2018-10-16
24
+ Deprecated - Replaced by 5.0.1
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
20
20
 
21
21
  ## About
22
- InversifyJS is a lightweight (4KB) inversion of control (IoC) container for TypeScript and JavaScript apps.
22
+ InversifyJS is a lightweight inversion of control (IoC) container for TypeScript and JavaScript apps.
23
23
  An IoC container uses a class constructor to identify and inject its dependencies.
24
24
  InversifyJS has a friendly API and encourages the usage of the best OOP and IoC practices.
25
25
 
@@ -54,7 +54,7 @@ InversifyJS has been developed with 4 main goals:
54
54
 
55
55
  ## Some companies using InversifyJS
56
56
 
57
- [<img src="https://avatars0.githubusercontent.com/u/6154722?s=200&v=4" width="100" />](https://opensource.microsoft.com/) [<img src="https://pbs.twimg.com/profile_images/827249559046909954/SyaBPcH8_400x400.jpg" width="100" />](http://acia.aon.com/index.php/home/) [<img src="https://avatars3.githubusercontent.com/u/114767?s=200&v=4" width="100" />](https://www.lonelyplanet.com/) [<img src="https://avatars0.githubusercontent.com/u/25283328?s=200&v=4" width="100" />](https://jincor.com/) [<img src="https://avatars1.githubusercontent.com/u/1957282?s=200&v=4" width="100" />](https://www.web-computing.de/) [<img src="https://avatars1.githubusercontent.com/u/17648048?s=200&v=4" width="100" />](https://dcos.io/) [<img src="https://avatars0.githubusercontent.com/u/16970371?s=200&v=4" width="100" />](https://typefox.io/) [<img src="https://avatars0.githubusercontent.com/u/18010308?s=200&v=4" width="100" />](https://code4.ro/) [<img src="https://user-images.githubusercontent.com/10656223/33888109-fae0852e-df43-11e7-97f6-9db543da0bde.png" width="100">](http://www.baidu.com/) [<img src="https://avatars2.githubusercontent.com/u/8085382?s=200&v=4" width="100" />](https://www.imdada.cn/) [<img src="https://avatars2.githubusercontent.com/u/17041151?s=200&v=4" width="100" />](https://www.ato.gov.au/) [<img src="https://avatars1.githubusercontent.com/u/14963540?s=200&v=4" width="100" />](https://www.kaneoh.com/) [<img src="https://avatars0.githubusercontent.com/u/26021686?s=200&v=4" width="100" />](https://particl.io/) [<img src="https://avatars2.githubusercontent.com/u/24523195?s=200&v=4" width="100" />](https://slackmap.com/) [<img src="https://avatars3.githubusercontent.com/u/16556899?s=200&v=4" width="100" />](https://www.go1.com/) [<img src="https://avatars3.githubusercontent.com/u/23475730?s=200&v=4" width="100" />](http://www.stellwagengroup.com/stellwagen-technology/) [<img src="https://avatars1.githubusercontent.com/u/15262567?s=200&v=4" width="100" />](https://www.edrlab.org/) [<img src="https://avatars1.githubusercontent.com/u/10072104?s=200&v=4" width="100" />](https://www.goodgamestudios.com/) [<img src="https://avatars2.githubusercontent.com/u/13613760?s=200&v=4" width="100" />](https://freshfox.at/) [<img src="https://avatars1.githubusercontent.com/u/864482?s=200&v=4" width="100" />](https://schubergphilis.com/)
57
+ [<img src="https://avatars0.githubusercontent.com/u/6154722?s=200&v=4" width="100" />](https://opensource.microsoft.com/)[<img src="https://avatars2.githubusercontent.com/u/69631?s=200&v=4" width="100" />](https://code.facebook.com/projects/1021334114569758/nuclide/)[<img src="https://avatars0.githubusercontent.com/u/2232217?s=200&v=4" width="100" />](https://aws.github.io/aws-amplify/)[<img src="https://avatars0.githubusercontent.com/u/1520648?s=200&v=4" width="100" />](https://www.plainconcepts.com/)[<img src="https://avatars3.githubusercontent.com/u/6962987?s=200&v=4" width="100" />](https://api.slack.com/)[<img src="https://pbs.twimg.com/profile_images/827249559046909954/SyaBPcH8_400x400.jpg" width="100" />](http://acia.aon.com/index.php/home/) [<img src="https://avatars3.githubusercontent.com/u/114767?s=200&v=4" width="100" />](https://www.lonelyplanet.com/) [<img src="https://avatars0.githubusercontent.com/u/25283328?s=200&v=4" width="100" />](https://jincor.com/) [<img src="https://avatars1.githubusercontent.com/u/1957282?s=200&v=4" width="100" />](https://www.web-computing.de/) [<img src="https://avatars1.githubusercontent.com/u/17648048?s=200&v=4" width="100" />](https://dcos.io/) [<img src="https://avatars0.githubusercontent.com/u/16970371?s=200&v=4" width="100" />](https://typefox.io/) [<img src="https://avatars0.githubusercontent.com/u/18010308?s=200&v=4" width="100" />](https://code4.ro/) [<img src="https://user-images.githubusercontent.com/10656223/33888109-fae0852e-df43-11e7-97f6-9db543da0bde.png" width="100">](http://www.baidu.com/) [<img src="https://avatars2.githubusercontent.com/u/8085382?s=200&v=4" width="100" />](https://www.imdada.cn/) [<img src="https://avatars2.githubusercontent.com/u/17041151?s=200&v=4" width="100" />](https://www.ato.gov.au/) [<img src="https://avatars1.githubusercontent.com/u/14963540?s=200&v=4" width="100" />](https://www.kaneoh.com/) [<img src="https://avatars0.githubusercontent.com/u/26021686?s=200&v=4" width="100" />](https://particl.io/) [<img src="https://avatars2.githubusercontent.com/u/24523195?s=200&v=4" width="100" />](https://slackmap.com/) [<img src="https://avatars3.githubusercontent.com/u/16556899?s=200&v=4" width="100" />](https://www.go1.com/) [<img src="https://avatars3.githubusercontent.com/u/23475730?s=200&v=4" width="100" />](http://www.stellwagengroup.com/stellwagen-technology/) [<img src="https://avatars1.githubusercontent.com/u/15262567?s=200&v=4" width="100" />](https://www.edrlab.org/) [<img src="https://avatars1.githubusercontent.com/u/10072104?s=200&v=4" width="100" />](https://www.goodgamestudios.com/) [<img src="https://avatars2.githubusercontent.com/u/13613760?s=200&v=4" width="100" />](https://freshfox.at/) [<img src="https://avatars1.githubusercontent.com/u/864482?s=200&v=4" width="100" />](https://schubergphilis.com/)
58
58
 
59
59
  ## Installation
60
60
 
@@ -92,7 +92,7 @@ InversifyJS requires a modern JavaScript engine with support for:
92
92
 
93
93
  If your environment doesn't support one of these you will need to import a shim or polyfill.
94
94
 
95
- > :warning: **The `reflect-metadata` polyfill should be imported only once in your entire application** because the Reflect object is mean to be a global singleton. More details about this can be found [here](https://github.com/inversify/InversifyJS/issues/262#issuecomment-227593844).
95
+ > :warning: **The `reflect-metadata` polyfill should be imported only once in your entire application** because the Reflect object is meant to be a global singleton. More details about this can be found [here](https://github.com/inversify/InversifyJS/issues/262#issuecomment-227593844).
96
96
 
97
97
  Check out the [Environment support and polyfills](https://github.com/inversify/InversifyJS/blob/master/wiki/environment.md)
98
98
  page in the wiki and the [Basic example](https://github.com/inversify/inversify-basic-example) to learn more.
@@ -109,21 +109,21 @@ Let's start by declaring some interfaces (abstractions).
109
109
  ```ts
110
110
  // file interfaces.ts
111
111
 
112
- interface Warrior {
112
+ export interface Warrior {
113
113
  fight(): string;
114
114
  sneak(): string;
115
115
  }
116
116
 
117
- interface Weapon {
117
+ export interface Weapon {
118
118
  hit(): string;
119
119
  }
120
120
 
121
- interface ThrowableWeapon {
121
+ export interface ThrowableWeapon {
122
122
  throw(): string;
123
123
  }
124
124
  ```
125
125
 
126
- InversifyJS need to use the type as identifiers at runtime. We use symbols as identifiers but you can also use classes and or string literals.
126
+ InversifyJS needs to use the type as identifiers at runtime. We use symbols as identifiers but you can also use classes and or string literals.
127
127
 
128
128
  ```ts
129
129
  // file types.ts
@@ -150,7 +150,7 @@ When a class has a dependency on an interface we also need to use the `@inject`
150
150
 
151
151
  import { injectable, inject } from "inversify";
152
152
  import "reflect-metadata";
153
- import { Weapon, ThrowableWeapon, Warrior } from "./interfaces"
153
+ import { Weapon, ThrowableWeapon, Warrior } from "./interfaces";
154
154
  import { TYPES } from "./types";
155
155
 
156
156
  @injectable()
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/error_msgs", "../constants/metadata_keys"], function (require, exports, ERROR_MSGS, METADATA_KEY) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.tagProperty = exports.tagParameter = exports.decorate = void 0;
4
5
  function tagParameter(annotationTarget, propertyName, parameterIndex, metadata) {
5
6
  var metadataKey = METADATA_KEY.TAGGED;
6
7
  _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex);
@@ -29,7 +30,7 @@ define(["require", "exports", "../constants/error_msgs", "../constants/metadata_
29
30
  for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) {
30
31
  var m = paramOrPropertyMetadata_1[_i];
31
32
  if (m.key === metadata.key) {
32
- throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key);
33
+ throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key.toString());
33
34
  }
34
35
  }
35
36
  }
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/error_msgs", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, error_msgs_1, METADATA_KEY, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.inject = exports.LazyServiceIdentifer = void 0;
4
5
  var LazyServiceIdentifer = (function () {
5
6
  function LazyServiceIdentifer(cb) {
6
7
  this._cb = cb;
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/error_msgs", "../constants/metadata_keys"], function (require, exports, ERRORS_MSGS, METADATA_KEY) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.injectable = void 0;
4
5
  function injectable() {
5
6
  return function (target) {
6
7
  if (Reflect.hasOwnMetadata(METADATA_KEY.PARAM_TYPES, target)) {
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, METADATA_KEY, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.multiInject = void 0;
4
5
  function multiInject(serviceIdentifier) {
5
6
  return function (target, targetKey, index) {
6
7
  var metadata = new metadata_1.Metadata(METADATA_KEY.MULTI_INJECT_TAG, serviceIdentifier);
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, METADATA_KEY, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.named = void 0;
4
5
  function named(name) {
5
6
  return function (target, targetKey, index) {
6
7
  var metadata = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, name);
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, METADATA_KEY, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.optional = void 0;
4
5
  function optional() {
5
6
  return function (target, targetKey, index) {
6
7
  var metadata = new metadata_1.Metadata(METADATA_KEY.OPTIONAL_TAG, true);
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/error_msgs", "../constants/metadata_keys", "../planning/metadata"], function (require, exports, ERRORS_MSGS, METADATA_KEY, metadata_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.postConstruct = void 0;
4
5
  function postConstruct() {
5
6
  return function (target, propertyKey, descriptor) {
6
7
  var metadata = new metadata_1.Metadata(METADATA_KEY.POST_CONSTRUCT, propertyKey);
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../planning/metadata", "./decorator_utils"], function (require, exports, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.tagged = void 0;
4
5
  function tagged(metadataKey, metadataValue) {
5
6
  return function (target, targetKey, index) {
6
7
  var metadata = new metadata_1.Metadata(metadataKey, metadataValue);
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, METADATA_KEY, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.targetName = void 0;
4
5
  function targetName(name) {
5
6
  return function (target, targetKey, index) {
6
7
  var metadata = new metadata_1.Metadata(METADATA_KEY.NAME_TAG, name);
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, METADATA_KEY, metadata_1, decorator_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.unmanaged = void 0;
4
5
  function unmanaged() {
5
6
  return function (target, targetKey, index) {
6
7
  var metadata = new metadata_1.Metadata(METADATA_KEY.UNMANAGED_TAG, true);
@@ -1,9 +1,10 @@
1
- define(["require", "exports", "../constants/literal_types", "../utils/guid"], function (require, exports, literal_types_1, guid_1) {
1
+ define(["require", "exports", "../constants/literal_types", "../utils/id"], function (require, exports, literal_types_1, id_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Binding = void 0;
4
5
  var Binding = (function () {
5
6
  function Binding(serviceIdentifier, scope) {
6
- this.guid = guid_1.guid();
7
+ this.id = id_1.id();
7
8
  this.activated = false;
8
9
  this.serviceIdentifier = serviceIdentifier;
9
10
  this.scope = scope;
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports"], function (require, exports) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.BindingCount = void 0;
4
5
  var BindingCount = {
5
6
  MultipleBindingsAvailable: 2,
6
7
  NoBindingsAvailable: 0,
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports"], function (require, exports) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.STACK_OVERFLOW = exports.CIRCULAR_DEPENDENCY_IN_FACTORY = exports.POST_CONSTRUCT_ERROR = exports.MULTIPLE_POST_CONSTRUCT_METHODS = exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = exports.ARGUMENTS_LENGTH_MISMATCH = exports.INVALID_DECORATOR_OPERATION = exports.INVALID_TO_SELF_VALUE = exports.INVALID_FUNCTION_BINDING = exports.INVALID_MIDDLEWARE_RETURN = exports.NO_MORE_SNAPSHOTS_AVAILABLE = exports.INVALID_BINDING_TYPE = exports.NOT_IMPLEMENTED = exports.CIRCULAR_DEPENDENCY = exports.UNDEFINED_INJECT_ANNOTATION = exports.MISSING_INJECT_ANNOTATION = exports.MISSING_INJECTABLE_ANNOTATION = exports.NOT_REGISTERED = exports.CANNOT_UNBIND = exports.AMBIGUOUS_MATCH = exports.KEY_NOT_FOUND = exports.NULL_ARGUMENT = exports.DUPLICATED_METADATA = exports.DUPLICATED_INJECTABLE_DECORATOR = void 0;
4
5
  exports.DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";
5
6
  exports.DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:";
6
7
  exports.NULL_ARGUMENT = "NULL argument";
@@ -25,14 +26,22 @@ define(["require", "exports"], function (require, exports) {
25
26
  "used as service identifier";
26
27
  exports.INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators " +
27
28
  "must be applied to the parameters of a class constructor or a class property.";
28
- exports.ARGUMENTS_LENGTH_MISMATCH_1 = "The number of constructor arguments in the derived class ";
29
- exports.ARGUMENTS_LENGTH_MISMATCH_2 = " must be >= than the number of constructor arguments of its base class.";
29
+ exports.ARGUMENTS_LENGTH_MISMATCH = function () {
30
+ var values = [];
31
+ for (var _i = 0; _i < arguments.length; _i++) {
32
+ values[_i] = arguments[_i];
33
+ }
34
+ return "The number of constructor arguments in the derived class " +
35
+ (values[0] + " must be >= than the number of constructor arguments of its base class.");
36
+ };
30
37
  exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = "Invalid Container constructor argument. Container options " +
31
38
  "must be an object.";
32
39
  exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = "Invalid Container option. Default scope must " +
33
40
  "be a string ('singleton' or 'transient').";
34
41
  exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = "Invalid Container option. Auto bind injectable must " +
35
42
  "be a boolean";
43
+ exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = "Invalid Container option. Skip base check must " +
44
+ "be a boolean";
36
45
  exports.MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class";
37
46
  exports.POST_CONSTRUCT_ERROR = function () {
38
47
  var values = [];
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports"], function (require, exports) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TargetTypeEnum = exports.BindingTypeEnum = exports.BindingScopeEnum = void 0;
4
5
  var BindingScopeEnum = {
5
6
  Request: "Request",
6
7
  Singleton: "Singleton",
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports"], function (require, exports) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.POST_CONSTRUCT = exports.DESIGN_PARAM_TYPES = exports.PARAM_TYPES = exports.TAGGED_PROP = exports.TAGGED = exports.MULTI_INJECT_TAG = exports.INJECT_TAG = exports.OPTIONAL_TAG = exports.UNMANAGED_TAG = exports.NAME_TAG = exports.NAMED_TAG = void 0;
4
5
  exports.NAMED_TAG = "named";
5
6
  exports.NAME_TAG = "name";
6
7
  exports.UNMANAGED_TAG = "unmanaged";
@@ -1,8 +1,9 @@
1
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -13,8 +14,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
14
  function step(op) {
14
15
  if (f) throw new TypeError("Generator is already executing.");
15
16
  while (_) try {
16
- if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
17
- if (y = 0, t) op = [0, t.value];
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
18
19
  switch (op[0]) {
19
20
  case 0: case 1: t = op; break;
20
21
  case 4: _.label++; return { value: op[1], done: false };
@@ -33,39 +34,42 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
33
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
34
35
  }
35
36
  };
36
- 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/guid", "../utils/serialization", "./container_snapshot", "./lookup"], function (require, exports, binding_1, ERROR_MSGS, literal_types_1, METADATA_KEY, metadata_reader_1, planner_1, resolver_1, binding_to_syntax_1, guid_1, serialization_1, container_snapshot_1, lookup_1) {
37
+ 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/id", "../utils/serialization", "./container_snapshot", "./lookup"], function (require, exports, binding_1, ERROR_MSGS, literal_types_1, METADATA_KEY, metadata_reader_1, planner_1, resolver_1, binding_to_syntax_1, id_1, serialization_1, container_snapshot_1, lookup_1) {
37
38
  "use strict";
38
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.Container = void 0;
39
41
  var Container = (function () {
40
42
  function Container(containerOptions) {
41
- if (containerOptions !== undefined) {
42
- if (typeof containerOptions !== "object") {
43
- throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);
44
- }
45
- else {
46
- if (containerOptions.defaultScope !== undefined &&
47
- containerOptions.defaultScope !== literal_types_1.BindingScopeEnum.Singleton &&
48
- containerOptions.defaultScope !== literal_types_1.BindingScopeEnum.Transient &&
49
- containerOptions.defaultScope !== literal_types_1.BindingScopeEnum.Request) {
50
- throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);
51
- }
52
- if (containerOptions.autoBindInjectable !== undefined &&
53
- typeof containerOptions.autoBindInjectable !== "boolean") {
54
- throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);
55
- }
56
- }
57
- this.options = {
58
- autoBindInjectable: containerOptions.autoBindInjectable,
59
- defaultScope: containerOptions.defaultScope
60
- };
43
+ var options = containerOptions || {};
44
+ if (typeof options !== "object") {
45
+ throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);
61
46
  }
62
- else {
63
- this.options = {
64
- autoBindInjectable: false,
65
- defaultScope: literal_types_1.BindingScopeEnum.Transient
66
- };
47
+ if (options.defaultScope === undefined) {
48
+ options.defaultScope = literal_types_1.BindingScopeEnum.Transient;
67
49
  }
68
- this.guid = guid_1.guid();
50
+ else if (options.defaultScope !== literal_types_1.BindingScopeEnum.Singleton &&
51
+ options.defaultScope !== literal_types_1.BindingScopeEnum.Transient &&
52
+ options.defaultScope !== literal_types_1.BindingScopeEnum.Request) {
53
+ throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);
54
+ }
55
+ if (options.autoBindInjectable === undefined) {
56
+ options.autoBindInjectable = false;
57
+ }
58
+ else if (typeof options.autoBindInjectable !== "boolean") {
59
+ throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);
60
+ }
61
+ if (options.skipBaseClassChecks === undefined) {
62
+ options.skipBaseClassChecks = false;
63
+ }
64
+ else if (typeof options.skipBaseClassChecks !== "boolean") {
65
+ throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);
66
+ }
67
+ this.options = {
68
+ autoBindInjectable: options.autoBindInjectable,
69
+ defaultScope: options.defaultScope,
70
+ skipBaseClassChecks: options.skipBaseClassChecks
71
+ };
72
+ this.id = id_1.id();
69
73
  this._bindingDictionary = new lookup_1.Lookup();
70
74
  this._snapshots = [];
71
75
  this._middleware = null;
@@ -96,7 +100,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
96
100
  var getHelpers = this._getContainerModuleHelpersFactory();
97
101
  for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) {
98
102
  var currentModule = modules_1[_a];
99
- var containerModuleHelpers = getHelpers(currentModule.guid);
103
+ var containerModuleHelpers = getHelpers(currentModule.id);
100
104
  currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
101
105
  }
102
106
  };
@@ -116,7 +120,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
116
120
  case 1:
117
121
  if (!(_a < modules_2.length)) return [3, 4];
118
122
  currentModule = modules_2[_a];
119
- containerModuleHelpers = getHelpers(currentModule.guid);
123
+ containerModuleHelpers = getHelpers(currentModule.id);
120
124
  return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)];
121
125
  case 2:
122
126
  _b.sent();
@@ -139,7 +143,7 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
139
143
  return item.moduleId === expected;
140
144
  }; };
141
145
  modules.forEach(function (module) {
142
- var condition = conditionFactory(module.guid);
146
+ var condition = conditionFactory(module.id);
143
147
  _this._bindingDictionary.removeByCondition(condition);
144
148
  });
145
149
  };
@@ -197,8 +201,8 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
197
201
  this._bindingDictionary = snapshot.bindings;
198
202
  this._middleware = snapshot.middleware;
199
203
  };
200
- Container.prototype.createChild = function () {
201
- var child = new Container();
204
+ Container.prototype.createChild = function (containerOptions) {
205
+ var child = new Container(containerOptions || this.options);
202
206
  child.parent = this;
203
207
  return child;
204
208
  };
@@ -232,9 +236,8 @@ define(["require", "exports", "../bindings/binding", "../constants/error_msgs",
232
236
  return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
233
237
  };
234
238
  Container.prototype.resolve = function (constructorFunction) {
235
- var tempContainer = new Container();
239
+ var tempContainer = this.createChild();
236
240
  tempContainer.bind(constructorFunction).toSelf();
237
- tempContainer.parent = this;
238
241
  return tempContainer.get(constructorFunction);
239
242
  };
240
243
  Container.prototype._getContainerModuleHelpersFactory = function () {
@@ -1,9 +1,10 @@
1
- define(["require", "exports", "../utils/guid"], function (require, exports, guid_1) {
1
+ define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AsyncContainerModule = exports.ContainerModule = void 0;
4
5
  var ContainerModule = (function () {
5
6
  function ContainerModule(registry) {
6
- this.guid = guid_1.guid();
7
+ this.id = id_1.id();
7
8
  this.registry = registry;
8
9
  }
9
10
  return ContainerModule;
@@ -11,7 +12,7 @@ define(["require", "exports", "../utils/guid"], function (require, exports, guid
11
12
  exports.ContainerModule = ContainerModule;
12
13
  var AsyncContainerModule = (function () {
13
14
  function AsyncContainerModule(registry) {
14
- this.guid = guid_1.guid();
15
+ this.id = id_1.id();
15
16
  this.registry = registry;
16
17
  }
17
18
  return AsyncContainerModule;
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports"], function (require, exports) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ContainerSnapshot = void 0;
4
5
  var ContainerSnapshot = (function () {
5
6
  function ContainerSnapshot() {
6
7
  }
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/error_msgs"], function (require, exports, ERROR_MSGS) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Lookup = void 0;
4
5
  var Lookup = (function () {
5
6
  function Lookup() {
6
7
  this._map = new Map();
package/amd/inversify.js CHANGED
@@ -1,30 +1,31 @@
1
- define(["require", "exports", "./constants/metadata_keys", "./container/container", "./constants/literal_types", "./container/container_module", "./annotation/injectable", "./annotation/tagged", "./annotation/named", "./annotation/inject", "./annotation/optional", "./annotation/unmanaged", "./annotation/multi_inject", "./annotation/target_name", "./annotation/post_construct", "./planning/metadata_reader", "./utils/guid", "./annotation/decorator_utils", "./syntax/constraint_helpers", "./utils/serialization", "./utils/binding_utils"], function (require, exports, keys, container_1, literal_types_1, container_module_1, injectable_1, tagged_1, named_1, inject_1, optional_1, unmanaged_1, multi_inject_1, target_name_1, post_construct_1, metadata_reader_1, guid_1, decorator_utils_1, constraint_helpers_1, serialization_1, binding_utils_1) {
1
+ define(["require", "exports", "./constants/metadata_keys", "./container/container", "./constants/literal_types", "./container/container_module", "./annotation/injectable", "./annotation/tagged", "./annotation/named", "./annotation/inject", "./annotation/optional", "./annotation/unmanaged", "./annotation/multi_inject", "./annotation/target_name", "./annotation/post_construct", "./planning/metadata_reader", "./utils/id", "./annotation/decorator_utils", "./syntax/constraint_helpers", "./utils/serialization", "./utils/binding_utils"], function (require, exports, keys, container_1, literal_types_1, container_module_1, injectable_1, tagged_1, named_1, inject_1, optional_1, unmanaged_1, multi_inject_1, target_name_1, post_construct_1, metadata_reader_1, id_1, decorator_utils_1, constraint_helpers_1, serialization_1, binding_utils_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.METADATA_KEY = void 0;
4
5
  exports.METADATA_KEY = keys;
5
- exports.Container = container_1.Container;
6
- exports.BindingScopeEnum = literal_types_1.BindingScopeEnum;
7
- exports.BindingTypeEnum = literal_types_1.BindingTypeEnum;
8
- exports.TargetTypeEnum = literal_types_1.TargetTypeEnum;
9
- exports.AsyncContainerModule = container_module_1.AsyncContainerModule;
10
- exports.ContainerModule = container_module_1.ContainerModule;
11
- exports.injectable = injectable_1.injectable;
12
- exports.tagged = tagged_1.tagged;
13
- exports.named = named_1.named;
14
- exports.inject = inject_1.inject;
15
- exports.LazyServiceIdentifer = inject_1.LazyServiceIdentifer;
16
- exports.optional = optional_1.optional;
17
- exports.unmanaged = unmanaged_1.unmanaged;
18
- exports.multiInject = multi_inject_1.multiInject;
19
- exports.targetName = target_name_1.targetName;
20
- exports.postConstruct = post_construct_1.postConstruct;
21
- exports.MetadataReader = metadata_reader_1.MetadataReader;
22
- exports.guid = guid_1.guid;
23
- exports.decorate = decorator_utils_1.decorate;
24
- exports.traverseAncerstors = constraint_helpers_1.traverseAncerstors;
25
- exports.taggedConstraint = constraint_helpers_1.taggedConstraint;
26
- exports.namedConstraint = constraint_helpers_1.namedConstraint;
27
- exports.typeConstraint = constraint_helpers_1.typeConstraint;
28
- exports.getServiceIdentifierAsString = serialization_1.getServiceIdentifierAsString;
29
- exports.multiBindToService = binding_utils_1.multiBindToService;
6
+ Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return container_1.Container; } });
7
+ Object.defineProperty(exports, "BindingScopeEnum", { enumerable: true, get: function () { return literal_types_1.BindingScopeEnum; } });
8
+ Object.defineProperty(exports, "BindingTypeEnum", { enumerable: true, get: function () { return literal_types_1.BindingTypeEnum; } });
9
+ Object.defineProperty(exports, "TargetTypeEnum", { enumerable: true, get: function () { return literal_types_1.TargetTypeEnum; } });
10
+ Object.defineProperty(exports, "AsyncContainerModule", { enumerable: true, get: function () { return container_module_1.AsyncContainerModule; } });
11
+ Object.defineProperty(exports, "ContainerModule", { enumerable: true, get: function () { return container_module_1.ContainerModule; } });
12
+ Object.defineProperty(exports, "injectable", { enumerable: true, get: function () { return injectable_1.injectable; } });
13
+ Object.defineProperty(exports, "tagged", { enumerable: true, get: function () { return tagged_1.tagged; } });
14
+ Object.defineProperty(exports, "named", { enumerable: true, get: function () { return named_1.named; } });
15
+ Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return inject_1.inject; } });
16
+ Object.defineProperty(exports, "LazyServiceIdentifer", { enumerable: true, get: function () { return inject_1.LazyServiceIdentifer; } });
17
+ Object.defineProperty(exports, "optional", { enumerable: true, get: function () { return optional_1.optional; } });
18
+ Object.defineProperty(exports, "unmanaged", { enumerable: true, get: function () { return unmanaged_1.unmanaged; } });
19
+ Object.defineProperty(exports, "multiInject", { enumerable: true, get: function () { return multi_inject_1.multiInject; } });
20
+ Object.defineProperty(exports, "targetName", { enumerable: true, get: function () { return target_name_1.targetName; } });
21
+ Object.defineProperty(exports, "postConstruct", { enumerable: true, get: function () { return post_construct_1.postConstruct; } });
22
+ Object.defineProperty(exports, "MetadataReader", { enumerable: true, get: function () { return metadata_reader_1.MetadataReader; } });
23
+ Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_1.id; } });
24
+ Object.defineProperty(exports, "decorate", { enumerable: true, get: function () { return decorator_utils_1.decorate; } });
25
+ Object.defineProperty(exports, "traverseAncerstors", { enumerable: true, get: function () { return constraint_helpers_1.traverseAncerstors; } });
26
+ Object.defineProperty(exports, "taggedConstraint", { enumerable: true, get: function () { return constraint_helpers_1.taggedConstraint; } });
27
+ Object.defineProperty(exports, "namedConstraint", { enumerable: true, get: function () { return constraint_helpers_1.namedConstraint; } });
28
+ Object.defineProperty(exports, "typeConstraint", { enumerable: true, get: function () { return constraint_helpers_1.typeConstraint; } });
29
+ Object.defineProperty(exports, "getServiceIdentifierAsString", { enumerable: true, get: function () { return serialization_1.getServiceIdentifierAsString; } });
30
+ Object.defineProperty(exports, "multiBindToService", { enumerable: true, get: function () { return binding_utils_1.multiBindToService; } });
30
31
  });
@@ -1,9 +1,10 @@
1
- define(["require", "exports", "../utils/guid"], function (require, exports, guid_1) {
1
+ define(["require", "exports", "../utils/id"], function (require, exports, id_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Context = void 0;
4
5
  var Context = (function () {
5
6
  function Context(container) {
6
- this.guid = guid_1.guid();
7
+ this.id = id_1.id();
7
8
  this.container = container;
8
9
  }
9
10
  Context.prototype.addPlan = function (plan) {
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys"], function (require, exports, METADATA_KEY) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Metadata = void 0;
4
5
  var Metadata = (function () {
5
6
  function Metadata(key, value) {
6
7
  this.key = key;
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports", "../constants/metadata_keys"], function (require, exports, METADATA_KEY) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MetadataReader = void 0;
4
5
  var MetadataReader = (function () {
5
6
  function MetadataReader() {
6
7
  }
@@ -1,6 +1,7 @@
1
1
  define(["require", "exports"], function (require, exports) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Plan = void 0;
4
5
  var Plan = (function () {
5
6
  function Plan(parentContext, rootRequest) {
6
7
  this.parentContext = parentContext;