@armscye/container 0.5.6 → 0.6.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,5 +1,6 @@
1
1
  import { NoArgument } from '@armscye/core';
2
2
  import { ProviderToken } from './provider-token';
3
+ import { Lifetime } from './lifetime';
3
4
  /**
4
5
  * Configures the `Container` to return an instance of `useClass` for a token.
5
6
  */
@@ -13,7 +14,12 @@ export interface ClassProvider {
13
14
  */
14
15
  useClass: NoArgument<any>;
15
16
  /**
16
- * Whether the created instance should be cached.
17
- */
17
+ /**
18
+ * @deprecated Use `lifetime` instead. Whether the created instance should be cached.
19
+ */
18
20
  shared?: boolean;
21
+ /**
22
+ * The lifetime of the created instance.
23
+ */
24
+ lifetime?: Lifetime;
19
25
  }
@@ -1,3 +1,4 @@
1
+ import { Lifetime } from './lifetime';
1
2
  import { ProviderToken } from './provider-token';
2
3
  /**
3
4
  * Configures the `Container` to return a value of another `useExisting` token.
@@ -12,7 +13,11 @@ export interface ExistingProvider {
12
13
  */
13
14
  useExisting: ProviderToken;
14
15
  /**
15
- * Whether the created instance should be cached.
16
+ * @deprecated Use `lifetime` instead. Whether the created instance should be cached.
16
17
  */
17
18
  shared?: boolean;
19
+ /**
20
+ * The lifetime of the created instance.
21
+ */
22
+ lifetime?: Lifetime;
18
23
  }
@@ -1,4 +1,5 @@
1
1
  import { Factory } from './factory';
2
+ import { Lifetime } from './lifetime';
2
3
  import { ProviderToken } from './provider-token';
3
4
  /**
4
5
  * Configures the `Container` to return a value by invoking a `useFactory` function.
@@ -14,7 +15,11 @@ export interface FactoryProvider {
14
15
  */
15
16
  useFactory: Factory<any>;
16
17
  /**
17
- * Whether the created instance should be cached.
18
+ * @deprecated Use `lifetime` instead. Whether the created instance should be cached.
18
19
  */
19
20
  shared?: boolean;
21
+ /**
22
+ * The lifetime of the created instance.
23
+ */
24
+ lifetime?: Lifetime;
20
25
  }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './container';
3
3
  export * from './existing-provider';
4
4
  export * from './factory-provider';
5
5
  export * from './factory';
6
+ export * from './lifetime';
6
7
  export * from './provider-token';
7
8
  export * from './provider';
8
9
  export * from './value-provider';
@@ -0,0 +1 @@
1
+ export type Lifetime = 'singleton' | 'transient';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armscye/container",
3
- "version": "0.5.6",
3
+ "version": "0.6.0",
4
4
  "description": "A collection of shared standard TypeScript definitions (@container)",
5
5
  "author": "Augustus Kamau",
6
6
  "license": "MIT",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "7bed2def7aec2263667c5b863ebc1bdc9c8802b1"
31
+ "gitHead": "664f442c05f1040b4bd50468510bf9cc71e40878"
32
32
  }