@armscye/container 0.2.0 → 0.3.0

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.
@@ -1,7 +1,7 @@
1
1
  import { NoArgument } from '@armscye/core';
2
- import { ProviderToken } from './provider-token.interface';
2
+ import { ProviderToken } from './provider-token';
3
3
  /**
4
- * Configures the `Container` to return an instance of `useClass` for a token.
4
+ * Configures the `Container` to return a value by instantiating `useClass` class.
5
5
  */
6
6
  export interface ClassProvider<T = any> {
7
7
  /**
@@ -12,4 +12,8 @@ export interface ClassProvider<T = any> {
12
12
  * Class to instantiate for the `token`.
13
13
  */
14
14
  useClass: NoArgument<T>;
15
+ /**
16
+ * Whether the created instance should be cached.
17
+ */
18
+ shared?: boolean;
15
19
  }
@@ -1,4 +1,4 @@
1
- import { ProviderToken } from './provider-token.interface';
1
+ import { ProviderToken } from './provider-token';
2
2
  /**
3
3
  * Describes the interface of a container that exposes methods to read its entries.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ProviderToken } from './provider-token.interface';
1
+ import { ProviderToken } from './provider-token';
2
2
  /**
3
3
  * Configures the `Container` to return a value of another `useExisting` token.
4
4
  */
@@ -11,4 +11,8 @@ export interface ExistingProvider<T = any> {
11
11
  * Existing `token` to return.
12
12
  */
13
13
  useExisting: T;
14
+ /**
15
+ * Whether the created instance should be cached.
16
+ */
17
+ shared?: boolean;
14
18
  }
@@ -1,5 +1,5 @@
1
- import { Factory } from './factory.interface';
2
- import { ProviderToken } from './provider-token.interface';
1
+ import { Factory } from './factory';
2
+ import { ProviderToken } from './provider-token';
3
3
  /**
4
4
  * Configures the `Container` to return a value by invoking a `useFactory` function.
5
5
  */
@@ -13,4 +13,8 @@ export interface FactoryProvider<T = any> {
13
13
  * invoked with resolved values of token`s from an instance of the container.
14
14
  */
15
15
  useFactory: Factory<T>;
16
+ /**
17
+ * Whether the created instance should be cached.
18
+ */
19
+ shared?: boolean;
16
20
  }
@@ -1,4 +1,4 @@
1
- import { Container } from './container.interface';
1
+ import { Container } from './container';
2
2
  /**
3
3
  * Represents type for a factory. A factory is a function that is able to create an object.
4
4
  * It is provided with an instance of the container in order to access required dependencies.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './class-provider.interface';
2
- export * from './container.interface';
3
- export * from './existing-provider.interface';
4
- export * from './factory-provider.interface';
5
- export * from './factory.interface';
6
- export * from './provider-token.interface';
7
- export * from './provider.interface';
8
- export * from './value-provider.interface';
1
+ export * from './class-provider';
2
+ export * from './container';
3
+ export * from './existing-provider';
4
+ export * from './factory-provider';
5
+ export * from './factory';
6
+ export * from './provider-token';
7
+ export * from './provider';
8
+ export * from './value-provider';
@@ -0,0 +1,5 @@
1
+ import { ClassProvider } from './class-provider';
2
+ import { ExistingProvider } from './existing-provider';
3
+ import { FactoryProvider } from './factory-provider';
4
+ import { ValueProvider } from './value-provider';
5
+ export type Provider<T = any> = ValueProvider<T> | ClassProvider<T> | FactoryProvider<T> | ExistingProvider<T>;
@@ -1,4 +1,4 @@
1
- import { ProviderToken } from './provider-token.interface';
1
+ import { ProviderToken } from './provider-token';
2
2
  /**
3
3
  * Configures the `Container` to return a value for a token.
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armscye/container",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A collection of shared standard TypeScript definitions",
5
5
  "author": "Augustus Kamau",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "types"
15
15
  ],
16
16
  "dependencies": {
17
- "@armscye/core": "^0.1.0"
17
+ "@armscye/core": "^0.2.0"
18
18
  },
19
19
  "homepage": "https://github.com/armscye/armscye#readme",
20
20
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "3f346ded1e7a06cf1afac1ba29a6e4f5377d4664"
30
+ "gitHead": "f2c94ab8ecb4161f6f8c82820a8bbad758d83209"
31
31
  }
@@ -1,5 +0,0 @@
1
- import { ClassProvider } from './class-provider.interface';
2
- import { ExistingProvider } from './existing-provider.interface';
3
- import { FactoryProvider } from './factory-provider.interface';
4
- import { ValueProvider } from './value-provider.interface';
5
- export type Provider<T = any> = ValueProvider<T> | ClassProvider<T> | FactoryProvider<T> | ExistingProvider<T>;