ts-ioc-container 43.0.0 → 43.1.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.
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AliasMap = void 0;
4
4
  class AliasMap {
5
5
  aliasToKeySet = new Map();
6
- deleteKeyFromAliases(key) {
7
- for (const [depKey, aliasSet] of [...this.aliasToKeySet].filter(([, aliasSet]) => aliasSet.has(key))) {
8
- aliasSet.delete(key);
9
- if (aliasSet.size === 0) {
10
- this.aliasToKeySet.delete(depKey);
6
+ deleteAliasesByKey(key) {
7
+ for (const [alias, keySet] of this.aliasToKeySet) {
8
+ keySet.delete(key);
9
+ if (keySet.size === 0) {
10
+ this.aliasToKeySet.delete(alias);
11
11
  }
12
12
  }
13
13
  }
14
14
  findManyKeysByAlias(alias) {
15
15
  return [...(this.aliasToKeySet.get(alias) ?? [])];
16
16
  }
17
- addAliases(key, aliases) {
17
+ setAliases(key, aliases) {
18
18
  for (const alias of aliases) {
19
- const currentAliasKeys = this.aliasToKeySet.get(alias) ?? new Set();
20
- this.aliasToKeySet.set(alias, currentAliasKeys.add(key));
19
+ const dependencyKeySet = this.aliasToKeySet.get(alias) ?? new Set();
20
+ this.aliasToKeySet.set(alias, dependencyKeySet.add(key));
21
21
  }
22
22
  }
23
23
  destroy() {
@@ -4,6 +4,7 @@ exports.AutoMockedContainer = void 0;
4
4
  const MethodNotImplementedError_1 = require("../errors/MethodNotImplementedError");
5
5
  class AutoMockedContainer {
6
6
  isDisposed = false;
7
+ onInstanceCreated(instance) { }
7
8
  createScope() {
8
9
  throw new MethodNotImplementedError_1.MethodNotImplementedError();
9
10
  }
@@ -16,21 +16,34 @@ class Container {
16
16
  providers = new Map();
17
17
  aliases = new AliasMap_1.AliasMap();
18
18
  registrations = new Set();
19
- onConstruct;
20
- onDispose;
21
19
  injector;
20
+ onConstructHookList = [];
21
+ onDisposeHookList = [];
22
22
  constructor(options = {}) {
23
23
  this.injector = options.injector ?? new MetadataInjector_1.MetadataInjector();
24
24
  this.parent = options.parent ?? new EmptyContainer_1.EmptyContainer();
25
25
  this.tags = new Set(options.tags ?? []);
26
- this.onConstruct = options.onConstruct ?? (() => { });
27
- this.onDispose = options.onDispose ?? (() => { });
26
+ }
27
+ addOnConstructHook(...hooks) {
28
+ this.onConstructHookList.push(...hooks);
29
+ return this;
30
+ }
31
+ addOnDisposeHook(...hooks) {
32
+ this.onDisposeHookList.push(...hooks);
33
+ return this;
34
+ }
35
+ onInstanceCreated(instance) {
36
+ this.instances.add(instance);
37
+ // Execute onConstruct hooks
38
+ for (const onConstruct of this.onConstructHookList) {
39
+ onConstruct(instance, this);
40
+ }
28
41
  }
29
42
  register(key, provider, { aliases = [] } = {}) {
30
43
  this.validateContainer();
31
44
  this.providers.set(key, provider);
32
- this.aliases.deleteKeyFromAliases(key);
33
- this.aliases.addAliases(key, aliases);
45
+ this.aliases.deleteAliasesByKey(key);
46
+ this.aliases.setAliases(key, aliases);
34
47
  return this;
35
48
  }
36
49
  addRegistration(registration) {
@@ -44,19 +57,14 @@ class Container {
44
57
  resolve(keyOrAlias, { args = [], child = this, lazy } = {}) {
45
58
  this.validateContainer();
46
59
  if (utils_1.Is.constructor(keyOrAlias)) {
47
- return (0, utils_1.toLazyIf)(() => {
48
- const instance = this.injector.resolve(this, keyOrAlias, { args });
49
- this.instances.add(instance);
50
- this.onConstruct(instance, this);
51
- return instance;
52
- }, lazy);
60
+ return (0, utils_1.toLazyIf)(() => this.injector.resolve(this, keyOrAlias, { args }), lazy);
53
61
  }
54
62
  const provider = this.providers.get(keyOrAlias);
55
63
  return provider?.hasAccess({ invocationScope: child, providerScope: this })
56
64
  ? provider.resolve(this, { args, lazy })
57
65
  : this.parent.resolve(keyOrAlias, { args, child, lazy });
58
66
  }
59
- resolveByAlias(alias, { args = [], child = this, lazy, excludedKeys = new Set(), takeFirst = -1 } = {}) {
67
+ resolveByAlias(alias, { args = [], child = this, lazy, excludedKeys = [], takeFirst = -1 } = {}) {
60
68
  this.validateContainer();
61
69
  let left = takeFirst;
62
70
  const keys = [];
@@ -78,7 +86,7 @@ class Container {
78
86
  args,
79
87
  child,
80
88
  lazy,
81
- excludedKeys: new Set([...excludedKeys, ...keys]),
89
+ excludedKeys: [...excludedKeys, ...keys],
82
90
  });
83
91
  return [...deps, ...parentDeps];
84
92
  }
@@ -88,9 +96,9 @@ class Container {
88
96
  injector: this.injector,
89
97
  parent: this,
90
98
  tags,
91
- onDispose: this.onDispose,
92
- onConstruct: this.onConstruct,
93
- });
99
+ })
100
+ .addOnConstructHook(...this.onConstructHookList)
101
+ .addOnDisposeHook(...this.onDisposeHookList);
94
102
  scope.applyRegistrationsFrom(this);
95
103
  this.scopes.add(scope);
96
104
  return scope;
@@ -125,7 +133,13 @@ class Container {
125
133
  this.aliases.destroy();
126
134
  this.instances.clear();
127
135
  this.registrations.clear();
128
- this.onDispose(this);
136
+ // Clear hooks
137
+ this.onConstructHookList.splice(0, this.onConstructHookList.length);
138
+ // Execute onDispose hooks
139
+ while (this.onDisposeHookList.length) {
140
+ const onDispose = this.onDisposeHookList.shift();
141
+ onDispose(this);
142
+ }
129
143
  }
130
144
  /**
131
145
  * @private
@@ -7,6 +7,7 @@ class EmptyContainer {
7
7
  get isDisposed() {
8
8
  throw new MethodNotImplementedError_1.MethodNotImplementedError();
9
9
  }
10
+ onInstanceCreated(instance) { }
10
11
  getParent() {
11
12
  return undefined;
12
13
  }
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Injector = void 0;
4
4
  class Injector {
5
5
  resolve(scope, Target, options) {
6
- return this.createInstance(scope, Target, options);
6
+ const instance = this.createInstance(scope, Target, options);
7
+ scope.onInstanceCreated(instance);
8
+ return instance;
7
9
  }
8
10
  }
9
11
  exports.Injector = Injector;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConstantToken = void 0;
4
4
  const InjectionToken_1 = require("./InjectionToken");
5
+ const MethodNotImplementedError_1 = require("../errors/MethodNotImplementedError");
5
6
  class ConstantToken extends InjectionToken_1.InjectionToken {
6
7
  token;
7
8
  constructor(token) {
@@ -12,13 +13,13 @@ class ConstantToken extends InjectionToken_1.InjectionToken {
12
13
  return this.token;
13
14
  }
14
15
  args(...deps) {
15
- throw new Error('not implemented');
16
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
16
17
  }
17
18
  argsFn(getArgsFn) {
18
- throw new Error('not implemented');
19
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
19
20
  }
20
21
  lazy() {
21
- throw new Error('not implemented');
22
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
22
23
  }
23
24
  }
24
25
  exports.ConstantToken = ConstantToken;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FunctionToken = void 0;
4
4
  const InjectionToken_1 = require("./InjectionToken");
5
+ const MethodNotImplementedError_1 = require("../errors/MethodNotImplementedError");
5
6
  class FunctionToken extends InjectionToken_1.InjectionToken {
6
7
  fn;
7
8
  constructor(fn) {
@@ -12,13 +13,13 @@ class FunctionToken extends InjectionToken_1.InjectionToken {
12
13
  return this.fn(s);
13
14
  }
14
15
  args(...deps) {
15
- throw new Error('not implemented');
16
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
16
17
  }
17
18
  argsFn(getArgsFn) {
18
- throw new Error('not implemented');
19
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
19
20
  }
20
21
  lazy() {
21
- throw new Error('not implemented');
22
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
22
23
  }
23
24
  }
24
25
  exports.FunctionToken = FunctionToken;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InstanceListToken = void 0;
4
4
  const InjectionToken_1 = require("./InjectionToken");
5
+ const MethodNotImplementedError_1 = require("../errors/MethodNotImplementedError");
5
6
  class InstanceListToken extends InjectionToken_1.InjectionToken {
6
7
  predicate;
7
8
  isCascade = true;
@@ -10,13 +11,13 @@ class InstanceListToken extends InjectionToken_1.InjectionToken {
10
11
  this.predicate = predicate;
11
12
  }
12
13
  args(...deps) {
13
- throw new Error('not implemented');
14
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
14
15
  }
15
16
  argsFn(getArgsFn) {
16
- throw new Error('not implemented');
17
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
17
18
  }
18
19
  lazy() {
19
- throw new Error('not implemented');
20
+ throw new MethodNotImplementedError_1.MethodNotImplementedError('not implemented');
20
21
  }
21
22
  cascade(isTrue) {
22
23
  this.isCascade = isTrue;
@@ -1,20 +1,20 @@
1
1
  export class AliasMap {
2
2
  aliasToKeySet = new Map();
3
- deleteKeyFromAliases(key) {
4
- for (const [depKey, aliasSet] of [...this.aliasToKeySet].filter(([, aliasSet]) => aliasSet.has(key))) {
5
- aliasSet.delete(key);
6
- if (aliasSet.size === 0) {
7
- this.aliasToKeySet.delete(depKey);
3
+ deleteAliasesByKey(key) {
4
+ for (const [alias, keySet] of this.aliasToKeySet) {
5
+ keySet.delete(key);
6
+ if (keySet.size === 0) {
7
+ this.aliasToKeySet.delete(alias);
8
8
  }
9
9
  }
10
10
  }
11
11
  findManyKeysByAlias(alias) {
12
12
  return [...(this.aliasToKeySet.get(alias) ?? [])];
13
13
  }
14
- addAliases(key, aliases) {
14
+ setAliases(key, aliases) {
15
15
  for (const alias of aliases) {
16
- const currentAliasKeys = this.aliasToKeySet.get(alias) ?? new Set();
17
- this.aliasToKeySet.set(alias, currentAliasKeys.add(key));
16
+ const dependencyKeySet = this.aliasToKeySet.get(alias) ?? new Set();
17
+ this.aliasToKeySet.set(alias, dependencyKeySet.add(key));
18
18
  }
19
19
  }
20
20
  destroy() {
@@ -1,6 +1,7 @@
1
1
  import { MethodNotImplementedError } from '../errors/MethodNotImplementedError';
2
2
  export class AutoMockedContainer {
3
3
  isDisposed = false;
4
+ onInstanceCreated(instance) { }
4
5
  createScope() {
5
6
  throw new MethodNotImplementedError();
6
7
  }
@@ -13,21 +13,34 @@ export class Container {
13
13
  providers = new Map();
14
14
  aliases = new AliasMap();
15
15
  registrations = new Set();
16
- onConstruct;
17
- onDispose;
18
16
  injector;
17
+ onConstructHookList = [];
18
+ onDisposeHookList = [];
19
19
  constructor(options = {}) {
20
20
  this.injector = options.injector ?? new MetadataInjector();
21
21
  this.parent = options.parent ?? new EmptyContainer();
22
22
  this.tags = new Set(options.tags ?? []);
23
- this.onConstruct = options.onConstruct ?? (() => { });
24
- this.onDispose = options.onDispose ?? (() => { });
23
+ }
24
+ addOnConstructHook(...hooks) {
25
+ this.onConstructHookList.push(...hooks);
26
+ return this;
27
+ }
28
+ addOnDisposeHook(...hooks) {
29
+ this.onDisposeHookList.push(...hooks);
30
+ return this;
31
+ }
32
+ onInstanceCreated(instance) {
33
+ this.instances.add(instance);
34
+ // Execute onConstruct hooks
35
+ for (const onConstruct of this.onConstructHookList) {
36
+ onConstruct(instance, this);
37
+ }
25
38
  }
26
39
  register(key, provider, { aliases = [] } = {}) {
27
40
  this.validateContainer();
28
41
  this.providers.set(key, provider);
29
- this.aliases.deleteKeyFromAliases(key);
30
- this.aliases.addAliases(key, aliases);
42
+ this.aliases.deleteAliasesByKey(key);
43
+ this.aliases.setAliases(key, aliases);
31
44
  return this;
32
45
  }
33
46
  addRegistration(registration) {
@@ -41,19 +54,14 @@ export class Container {
41
54
  resolve(keyOrAlias, { args = [], child = this, lazy } = {}) {
42
55
  this.validateContainer();
43
56
  if (Is.constructor(keyOrAlias)) {
44
- return toLazyIf(() => {
45
- const instance = this.injector.resolve(this, keyOrAlias, { args });
46
- this.instances.add(instance);
47
- this.onConstruct(instance, this);
48
- return instance;
49
- }, lazy);
57
+ return toLazyIf(() => this.injector.resolve(this, keyOrAlias, { args }), lazy);
50
58
  }
51
59
  const provider = this.providers.get(keyOrAlias);
52
60
  return provider?.hasAccess({ invocationScope: child, providerScope: this })
53
61
  ? provider.resolve(this, { args, lazy })
54
62
  : this.parent.resolve(keyOrAlias, { args, child, lazy });
55
63
  }
56
- resolveByAlias(alias, { args = [], child = this, lazy, excludedKeys = new Set(), takeFirst = -1 } = {}) {
64
+ resolveByAlias(alias, { args = [], child = this, lazy, excludedKeys = [], takeFirst = -1 } = {}) {
57
65
  this.validateContainer();
58
66
  let left = takeFirst;
59
67
  const keys = [];
@@ -75,7 +83,7 @@ export class Container {
75
83
  args,
76
84
  child,
77
85
  lazy,
78
- excludedKeys: new Set([...excludedKeys, ...keys]),
86
+ excludedKeys: [...excludedKeys, ...keys],
79
87
  });
80
88
  return [...deps, ...parentDeps];
81
89
  }
@@ -85,9 +93,9 @@ export class Container {
85
93
  injector: this.injector,
86
94
  parent: this,
87
95
  tags,
88
- onDispose: this.onDispose,
89
- onConstruct: this.onConstruct,
90
- });
96
+ })
97
+ .addOnConstructHook(...this.onConstructHookList)
98
+ .addOnDisposeHook(...this.onDisposeHookList);
91
99
  scope.applyRegistrationsFrom(this);
92
100
  this.scopes.add(scope);
93
101
  return scope;
@@ -122,7 +130,13 @@ export class Container {
122
130
  this.aliases.destroy();
123
131
  this.instances.clear();
124
132
  this.registrations.clear();
125
- this.onDispose(this);
133
+ // Clear hooks
134
+ this.onConstructHookList.splice(0, this.onConstructHookList.length);
135
+ // Execute onDispose hooks
136
+ while (this.onDisposeHookList.length) {
137
+ const onDispose = this.onDisposeHookList.shift();
138
+ onDispose(this);
139
+ }
126
140
  }
127
141
  /**
128
142
  * @private
@@ -4,6 +4,7 @@ export class EmptyContainer {
4
4
  get isDisposed() {
5
5
  throw new MethodNotImplementedError();
6
6
  }
7
+ onInstanceCreated(instance) { }
7
8
  getParent() {
8
9
  return undefined;
9
10
  }
@@ -1,5 +1,7 @@
1
1
  export class Injector {
2
2
  resolve(scope, Target, options) {
3
- return this.createInstance(scope, Target, options);
3
+ const instance = this.createInstance(scope, Target, options);
4
+ scope.onInstanceCreated(instance);
5
+ return instance;
4
6
  }
5
7
  }
@@ -1,4 +1,5 @@
1
1
  import { InjectionToken } from './InjectionToken';
2
+ import { MethodNotImplementedError } from '../errors/MethodNotImplementedError';
2
3
  export class ConstantToken extends InjectionToken {
3
4
  token;
4
5
  constructor(token) {
@@ -9,12 +10,12 @@ export class ConstantToken extends InjectionToken {
9
10
  return this.token;
10
11
  }
11
12
  args(...deps) {
12
- throw new Error('not implemented');
13
+ throw new MethodNotImplementedError('not implemented');
13
14
  }
14
15
  argsFn(getArgsFn) {
15
- throw new Error('not implemented');
16
+ throw new MethodNotImplementedError('not implemented');
16
17
  }
17
18
  lazy() {
18
- throw new Error('not implemented');
19
+ throw new MethodNotImplementedError('not implemented');
19
20
  }
20
21
  }
@@ -1,4 +1,5 @@
1
1
  import { InjectionToken } from './InjectionToken';
2
+ import { MethodNotImplementedError } from '../errors/MethodNotImplementedError';
2
3
  export class FunctionToken extends InjectionToken {
3
4
  fn;
4
5
  constructor(fn) {
@@ -9,12 +10,12 @@ export class FunctionToken extends InjectionToken {
9
10
  return this.fn(s);
10
11
  }
11
12
  args(...deps) {
12
- throw new Error('not implemented');
13
+ throw new MethodNotImplementedError('not implemented');
13
14
  }
14
15
  argsFn(getArgsFn) {
15
- throw new Error('not implemented');
16
+ throw new MethodNotImplementedError('not implemented');
16
17
  }
17
18
  lazy() {
18
- throw new Error('not implemented');
19
+ throw new MethodNotImplementedError('not implemented');
19
20
  }
20
21
  }
@@ -1,4 +1,5 @@
1
1
  import { InjectionToken } from './InjectionToken';
2
+ import { MethodNotImplementedError } from '../errors/MethodNotImplementedError';
2
3
  export class InstanceListToken extends InjectionToken {
3
4
  predicate;
4
5
  isCascade = true;
@@ -7,13 +8,13 @@ export class InstanceListToken extends InjectionToken {
7
8
  this.predicate = predicate;
8
9
  }
9
10
  args(...deps) {
10
- throw new Error('not implemented');
11
+ throw new MethodNotImplementedError('not implemented');
11
12
  }
12
13
  argsFn(getArgsFn) {
13
- throw new Error('not implemented');
14
+ throw new MethodNotImplementedError('not implemented');
14
15
  }
15
16
  lazy() {
16
- throw new Error('not implemented');
17
+ throw new MethodNotImplementedError('not implemented');
17
18
  }
18
19
  cascade(isTrue) {
19
20
  this.isCascade = isTrue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-ioc-container",
3
- "version": "43.0.0",
3
+ "version": "43.1.0",
4
4
  "description": "Typescript IoC container",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -2,8 +2,8 @@ import { type DependencyKey } from './IContainer';
2
2
  export type Alias = DependencyKey;
3
3
  export declare class AliasMap {
4
4
  private readonly aliasToKeySet;
5
- deleteKeyFromAliases(key: DependencyKey): void;
5
+ deleteAliasesByKey(key: DependencyKey): void;
6
6
  findManyKeysByAlias(alias: DependencyKey): DependencyKey[];
7
- addAliases(key: DependencyKey, aliases: DependencyKey[]): void;
7
+ setAliases(key: DependencyKey, aliases: DependencyKey[]): void;
8
8
  destroy(): void;
9
9
  }
@@ -3,6 +3,7 @@ import { type IRegistration } from '../registration/IRegistration';
3
3
  import { type constructor } from '../utils';
4
4
  export declare abstract class AutoMockedContainer implements IContainer {
5
5
  isDisposed: boolean;
6
+ onInstanceCreated(instance: Instance): void;
6
7
  createScope(): IContainer;
7
8
  dispose(): void;
8
9
  register(): this;
@@ -3,6 +3,8 @@ import { type IInjector } from '../injector/IInjector';
3
3
  import { type IProvider } from '../provider/IProvider';
4
4
  import { type IRegistration } from '../registration/IRegistration';
5
5
  import { type constructor } from '../utils';
6
+ import { OnConstructHook } from '../hooks/onConstruct';
7
+ import { OnDisposeHook } from '../hooks/onDispose';
6
8
  export declare class Container implements IContainer {
7
9
  isDisposed: boolean;
8
10
  private parent;
@@ -12,16 +14,17 @@ export declare class Container implements IContainer {
12
14
  private readonly providers;
13
15
  private readonly aliases;
14
16
  private readonly registrations;
15
- private readonly onConstruct;
16
- private readonly onDispose;
17
17
  private readonly injector;
18
+ private readonly onConstructHookList;
19
+ private readonly onDisposeHookList;
18
20
  constructor(options?: {
19
21
  injector?: IInjector;
20
22
  parent?: IContainer;
21
23
  tags?: Tag[];
22
- onConstruct?: (instance: Instance, scope: IContainer) => void;
23
- onDispose?: (scope: IContainer) => void;
24
24
  });
25
+ addOnConstructHook(...hooks: OnConstructHook[]): this;
26
+ addOnDisposeHook(...hooks: OnDisposeHook[]): this;
27
+ onInstanceCreated(instance: Instance): void;
25
28
  register(key: DependencyKey, provider: IProvider, { aliases }?: RegisterOptions): this;
26
29
  addRegistration(registration: IRegistration): this;
27
30
  getRegistrations(): IRegistration[];
@@ -1,9 +1,10 @@
1
- import { type DependencyKey, type IContainer, type IContainerModule, type ResolveManyOptions, type ResolveOneOptions, type Tag } from './IContainer';
1
+ import { type DependencyKey, type IContainer, type IContainerModule, Instance, type ResolveManyOptions, type ResolveOneOptions, type Tag } from './IContainer';
2
2
  import { type IProvider } from '../provider/IProvider';
3
3
  import { type IRegistration } from '../registration/IRegistration';
4
4
  import { type constructor } from '../utils';
5
5
  export declare class EmptyContainer implements IContainer {
6
6
  get isDisposed(): boolean;
7
+ onInstanceCreated(instance: Instance): void;
7
8
  getParent(): undefined;
8
9
  getScopes(): never[];
9
10
  getInstances(): never[];
@@ -8,7 +8,7 @@ type WithChild = {
8
8
  };
9
9
  export type ResolveOneOptions = ProviderOptions & Partial<WithChild>;
10
10
  type WithExcludedKeys = {
11
- excludedKeys: Set<DependencyKey>;
11
+ excludedKeys: DependencyKey[];
12
12
  };
13
13
  type TakeFirst = {
14
14
  takeFirst: number;
@@ -47,5 +47,6 @@ export interface IContainer extends Tagged {
47
47
  getParent(): IContainer | undefined;
48
48
  getInstances(): Instance[];
49
49
  dispose(): void;
50
+ onInstanceCreated(instance: Instance): void;
50
51
  }
51
52
  export {};
@@ -1,4 +1,6 @@
1
1
  import { HookFn } from './hook';
2
2
  import { SyncHooksRunner } from './runner/SyncHooksRunner';
3
+ import type { IContainer, Instance } from '../container/IContainer';
3
4
  export declare const onConstructHooksRunner: SyncHooksRunner;
4
5
  export declare const onConstruct: (fn: HookFn) => (target: object, propertyKey: string | symbol) => void;
6
+ export type OnConstructHook = (instance: Instance, scope: IContainer) => void;
@@ -1,3 +1,5 @@
1
1
  import { SyncHooksRunner } from './runner/SyncHooksRunner';
2
+ import type { IContainer } from '../container/IContainer';
2
3
  export declare const onDisposeHooksRunner: SyncHooksRunner;
3
4
  export declare const onDispose: (target: object, propertyKey: string | symbol) => void;
5
+ export type OnDisposeHook = (scope: IContainer) => void;