Skip to content

Commit

Permalink
Merge pull request #36 from Davidhanson90/main
Browse files Browse the repository at this point in the history
Adding feature table with support status
  • Loading branch information
Davidhanson90 authored Mar 1, 2021
2 parents 3da4d1c + 461922f commit 5f0b5ae
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ typedoc.json
main/**/*
spec/**/*
.github/**/*
.dco/**/*
dco/**/*
docs/**/*

# except for ts files (required for source maps)

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.6",
"version": "0.3.7",
"description": "A small & lightweight dependency injection container for use in multiple contexts like Angular, React & node.",
"name": "@morgan-stanley/needle",
"license": "Apache-2.0",
Expand Down
89 changes: 77 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,83 @@ And you should import this module at the root of your application.
import "reflect-metadata";
```

# Feature support

| Feature | Sub-feature | Details | Status |
|------------------------|----------------------------------|----------------------------------------------------------------------------------------|--------------|
| [Decorator support](https://github.com/morganstanley/needle#creating-an-injectable-type) | | Using '@decorators' to signal behavior | Full Support |
| Optional decorators | | Supporting decorator free injection | Full Support |
| TypeScript support | | Full TypeScript support with type safety | Full Support |
| [Global configuration](https://github.com/morganstanley/needle#global-configuration) | | Ability to configure global settings in the container | Full Support |
| [Semantic Injection](https://github.com/morganstanley/needle#semantic-injection) | | Ability to respect semantic versioning in all injectable types | Full Support |
| Cache | | Caching of injectables | Full Support |
| | Cache manipulation | Ability to directly manipulate the cache | Full Support |
| | Scoping support | Caching support in scoped injectors | Full Support |
| [Metrics](https://github.com/morganstanley/needle#metrics-tracking) | | Tracking injectables in the system | Full Support |
| | Auto tracking | Zero config tracking model | Full Support |
| | Activation tracking | Tracking when a type is first constructed | Full Support |
| | Activation owners | Tracking what type is responsible for constructing an Injectable | Full Support |
| | Resolution statistics | Details of how often a type has been resolved etc | Full Support |
| | Creation cost | Cost in time to construct the Injectable | Full Support |
| | Dependency counts | Number of dependencies a given type has in its constructor | Full Support |
| | Scoping support | Are metrics tracked in scoped injectors | Full Support |
| | Metrics manipulation | Can developers manipulate the metric data | Full Support |
| [Tokenisation](https://github.com/morganstanley/needle#tokens) | | Does the DI library support tokenisation | Full Support |
| | Decorator support | Can you define tokens using '@decorators' | Full Support |
| | API support | Can you define tokens using an API | Full Support |
| | String tokens | Can I use strings as tokens | Full Support |
| | Symbol tokens | Can I use Symbols as tokens | Full Support |
| | Multiple tokens | Can I register multiple tokens for a single injectable | Full Support |
| | Token overriding | Can I override existing token registrations | Full Support |
| | Unique token enforcement | Can I enforce unqiue tokens | Full Support |
| | Scoping support | Are tokens supported in scoped injectors | Full Support |
| [Strategies](https://github.com/morganstanley/needle#strategies) | | Does the DI library support injecting multiple injectables into a given constructor | Full Support |
| | Decorator support | Can I use `@decorators` to register a strategy | Full Support |
| | API support | Can I use the API to register a strategy | Full Support |
| | String tokens | Can I register strategies using strings | Full Support |
| | Symbol tokens | Can I register strategies using Symbols | Full Support |
| | Scoping support | Are strategies supported in scoped injectors | Full Support |
| [Factories](https://github.com/morganstanley/needle#factories) | | Does the DI library support factory construction types | Full Support |
| | Decorator support | Can I use `@decorators` to resolve a factory | Full Support |
| | API support | Can I use API to resolve a factory | Full Support |
| | Scoping support | Are factories supported in scoped injectors | Full Support |
| | Auto factories | Can all types be used as Factories | Full Support |
| | Parameter profiling | Can I control constructor parameters explicitly | Full Support |
| [Lazy Injection](https://github.com/morganstanley/needle#lazy-injection) | | Does the DI library support lazy dependency injection | Full Support |
| | Decorator support | Can I use `@decorators` to register/resolve a lazy injectable | Full Support |
| | API support | Can I use the API to register/resolve a lazy injectable | Full Support |
| | Scoping support | Are lazy injectables supported in scoped injectors | Full Support |
| [Optional Injection](https://github.com/morganstanley/needle#optional-injection) | | Does the DI library support optional constructor params for injection | Full Support |
| | Decorator support | Can I use `@decorators` to resolve optional injectable | Full Support |
| | API support | Can I use the API to register/resolve a optional injectable | Full Support |
| | Scoping support | Are optional injectables supported in scoped injectors | Full Support |
| [Instance Injection](https://github.com/morganstanley/needle#register-instance) | | Does the DI library support registering instances against a type | Full Support |
| | API support | Can I use the API to register an instance of a type for injection | Full Support |
| | Scoping support | Are instances supported in scoped injectors | Full Support |
| [Value Injection](https://github.com/morganstanley/needle#register-value) | | Does the DI library allow for registering a value for injection (Non-injectable types) | Full Support |
| | Intrinsic values | Can I register intrinsic types such as Date, Regex, Number | Full Support |
| | AOT values | Can I eagerly supply the value for the value injection | Full Support |
| | JIT values | Can I compute the value at point of injection | Full Support |
| | Dynamic values | Can I recompute the value being injected on each resolution | Full Support |
| [Custom Construction](https://github.com/morganstanley/needle#external-resolution-strategies) | | Does the DI library support construction external to the library itself | Full Support |
| | Bespoke type construction | Can I create my own constructor for a given type | Full Support |
| | Global bespoke construction | Can I create a global constructor for all types | Full Support |
| | Abstract type construction | Can I create a constructor for abstract base types | Full Support |
| | Scoping support | Are custom constructors supported in scoped injectors | Full Support |
| [Hierarchical injection](https://github.com/morganstanley/needle#scoped-injection) | | Does the DI library support scoped injection contexts | Full Support |
| | String scope names | Can I use strings for scope names | Full Support |
| | Symbol scope names | Can I use Symbols for scoped names | Full Support |
| | Registration overriding | Can I override ancestral registration in my scope | Full Support |
| | Disposal | Can I destroy a scope | Full Support |
| | Scope lookup | Can I find a scope easily using its name or id. | Full Support |
| | Scope inheritance | Can scopes extend other scopes | Full Support |
| [Interception](https://github.com/morganstanley/needle#interception) | | Does the DI library support interceptors | Full Support |
| | Decorator support | Can I register interceptions using `@decorators` | Full Support |
| | API support | Can I register interceptions using the API | Full Support |
| | Before construction interception | Can I intercept a given type before its constructed | Full Support |
| | After construction interception | Can I intercept a given type after its constructed | Full Support |
| [Injection delegation](https://github.com/morganstanley/needle#external-resolution-strategy) | | Can I delegate all construction to another DI library. | Full Support |

# Injectable basics

## Decorators vs Registration API
Expand Down Expand Up @@ -598,18 +675,6 @@ If you want the value to mutate on each request, you can set `cacheSyncing` to f

**Note**: As values have no associated type upon which to decorate, you can only use the Injector API to register values.

```typescript
import { getRootInjector } from '@morgan-stanley/needle';

const vehicle = new Vehicle('Bike');

getRootInjector().registerInstance(Vehicle, vehicle);

const instance = get(Vehicle);

console.log(instance === vehicle) // True
```

# Metrics tracking

The injector tracks metrics about your injectable types during runtime. There are a range of different values captured and these are stored in the metrics provider which is accessible via the Injector type. The data is store as records and the below type shows the information captured.
Expand Down

0 comments on commit 5f0b5ae

Please sign in to comment.