1 | import { ContainerInstance } from '../container-instance.class';
|
2 | import { Constructable } from '../types/constructable.type';
|
3 | /**
|
4 | * Used to register special "handler" which will be executed on a service class during its initialization.
|
5 | * It can be used to create custom decorators and set/replace service class properties and constructor parameters.
|
6 | */
|
7 | export interface Handler<T = unknown> {
|
8 | /**
|
9 | * Service object used to apply handler to.
|
10 | */
|
11 | object: Constructable<T>;
|
12 | /**
|
13 | * Class property name to set/replace value of.
|
14 | * Used if handler is applied on a class property.
|
15 | */
|
16 | propertyName?: string;
|
17 | /**
|
18 | * Parameter index to set/replace value of.
|
19 | * Used if handler is applied on a constructor parameter.
|
20 | */
|
21 | index?: number;
|
22 | /**
|
23 | * Factory function that produces value that will be set to class property or constructor parameter.
|
24 | * Accepts container instance which requested the value.
|
25 | */
|
26 | value: (container: ContainerInstance) => any;
|
27 | }
|