@illuma/core 1.0.0 → 1.2.1

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,3 +1,75 @@
1
+ /**
2
+ * Represents a constructor function type.
3
+ * @template T - The type that the constructor creates
4
+ */
5
+ type Ctor<T> = new (...args: any[]) => T;
6
+ /**
7
+ * Represents a token that can be either a NodeBase token or a constructor.
8
+ * @template T - The type that the token represents
9
+ */
10
+ type Token<T> = NodeBase<T> | Ctor<T>;
11
+ /**
12
+ * Options for configuring a NodeToken or MultiNodeToken.
13
+ * @template T - The type of value the token represents
14
+ */
15
+ interface iNodeTokenBaseOptions<T> {
16
+ /**
17
+ * Optional factory function to create instances of this token.
18
+ */
19
+ factory?: () => NoInfer<T>;
20
+ }
21
+ /**
22
+ * Provider that supplies a static value for a token.
23
+ * @template T - The type of value being provided
24
+ */
25
+ interface iNodeValueProvider<T> {
26
+ /** The token this provider is for */
27
+ provide: Token<T>;
28
+ /** The static value to provide */
29
+ value: NoInfer<T>;
30
+ }
31
+ /**
32
+ * Provider that uses a factory function to create instances.
33
+ * @template T - The type of value being provided
34
+ */
35
+ interface iNodeFactoryProvider<T> {
36
+ /** The token this provider is for */
37
+ provide: Token<T>;
38
+ /** Factory function to create the value */
39
+ factory: () => NoInfer<T>;
40
+ }
41
+ /**
42
+ * Provider that uses a class constructor to create instances.
43
+ * @template T - The type of value being provided
44
+ */
45
+ interface iNodeClassProvider<T> {
46
+ /** The token this provider is for */
47
+ provide: Token<T>;
48
+ /** The class to instantiate */
49
+ useClass: Ctor<T>;
50
+ }
51
+ /**
52
+ * Provider that creates an alias to another token.
53
+ * When this token is injected, the aliased token's value is returned instead.
54
+ * @template T - The type of value being provided
55
+ */
56
+ interface iNodeAliasProvider<T> {
57
+ /** The token this provider is for */
58
+ provide: Token<T>;
59
+ /** The token to alias to */
60
+ alias: Token<T>;
61
+ }
62
+ /**
63
+ * Union type of all possible provider configurations.
64
+ * @template T - The type of value being provided
65
+ */
66
+ type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
67
+ /**
68
+ * Union type of all values that can be provided to a container.
69
+ * @template T - The type of value being provided
70
+ */
71
+ type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
72
+
1
73
  /**
2
74
  * Base class for dependency injection tokens.
3
75
  * This class should not be instantiated directly. Use {@link NodeToken} or {@link MultiNodeToken} instead.
@@ -78,76 +150,4 @@ declare function isNodeBase<T>(specimen: unknown): specimen is NodeToken<T> | Mu
78
150
  */
79
151
  declare function extractToken<T>(provider: Token<T>, isAlias?: boolean): NodeToken<T> | MultiNodeToken<T>;
80
152
 
81
- /**
82
- * Represents a constructor function type.
83
- * @template T - The type that the constructor creates
84
- */
85
- type Ctor<T> = new (...args: any[]) => T;
86
- /**
87
- * Represents a token that can be either a NodeBase token or a constructor.
88
- * @template T - The type that the token represents
89
- */
90
- type Token<T> = NodeBase<T> | Ctor<T>;
91
- /**
92
- * Options for configuring a NodeToken or MultiNodeToken.
93
- * @template T - The type of value the token represents
94
- */
95
- interface iNodeTokenBaseOptions<T> {
96
- /**
97
- * Optional factory function to create instances of this token.
98
- */
99
- factory?: () => NoInfer<T>;
100
- }
101
- /**
102
- * Provider that supplies a static value for a token.
103
- * @template T - The type of value being provided
104
- */
105
- interface iNodeValueProvider<T> {
106
- /** The token this provider is for */
107
- provide: Token<T>;
108
- /** The static value to provide */
109
- value: NoInfer<T>;
110
- }
111
- /**
112
- * Provider that uses a factory function to create instances.
113
- * @template T - The type of value being provided
114
- */
115
- interface iNodeFactoryProvider<T> {
116
- /** The token this provider is for */
117
- provide: Token<T>;
118
- /** Factory function to create the value */
119
- factory: () => NoInfer<T>;
120
- }
121
- /**
122
- * Provider that uses a class constructor to create instances.
123
- * @template T - The type of value being provided
124
- */
125
- interface iNodeClassProvider<T> {
126
- /** The token this provider is for */
127
- provide: Token<T>;
128
- /** The class to instantiate */
129
- useClass: Ctor<T>;
130
- }
131
- /**
132
- * Provider that creates an alias to another token.
133
- * When this token is injected, the aliased token's value is returned instead.
134
- * @template T - The type of value being provided
135
- */
136
- interface iNodeAliasProvider<T> {
137
- /** The token this provider is for */
138
- provide: Token<T>;
139
- /** The token to alias to */
140
- alias: Token<T>;
141
- }
142
- /**
143
- * Union type of all possible provider configurations.
144
- * @template T - The type of value being provided
145
- */
146
- type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
147
- /**
148
- * Union type of all values that can be provided to a container.
149
- * @template T - The type of value being provided
150
- */
151
- type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
152
-
153
- export { type Ctor as C, MultiNodeToken as M, NodeBase as N, type Provider as P, type Token as T, NodeToken as a, type iNodeTokenBaseOptions as b, type iNodeValueProvider as c, type iNodeFactoryProvider as d, extractToken as e, type iNodeClassProvider as f, type iNodeAliasProvider as g, type iNodeProvider as h, isNodeBase as i };
153
+ export { type Ctor as C, MultiNodeToken as M, NodeToken as N, type Provider as P, type Token as T, NodeBase as a, type iNodeTokenBaseOptions as b, type iNodeValueProvider as c, type iNodeFactoryProvider as d, extractToken as e, type iNodeClassProvider as f, type iNodeAliasProvider as g, type iNodeProvider as h, isNodeBase as i };
@@ -1,3 +1,75 @@
1
+ /**
2
+ * Represents a constructor function type.
3
+ * @template T - The type that the constructor creates
4
+ */
5
+ type Ctor<T> = new (...args: any[]) => T;
6
+ /**
7
+ * Represents a token that can be either a NodeBase token or a constructor.
8
+ * @template T - The type that the token represents
9
+ */
10
+ type Token<T> = NodeBase<T> | Ctor<T>;
11
+ /**
12
+ * Options for configuring a NodeToken or MultiNodeToken.
13
+ * @template T - The type of value the token represents
14
+ */
15
+ interface iNodeTokenBaseOptions<T> {
16
+ /**
17
+ * Optional factory function to create instances of this token.
18
+ */
19
+ factory?: () => NoInfer<T>;
20
+ }
21
+ /**
22
+ * Provider that supplies a static value for a token.
23
+ * @template T - The type of value being provided
24
+ */
25
+ interface iNodeValueProvider<T> {
26
+ /** The token this provider is for */
27
+ provide: Token<T>;
28
+ /** The static value to provide */
29
+ value: NoInfer<T>;
30
+ }
31
+ /**
32
+ * Provider that uses a factory function to create instances.
33
+ * @template T - The type of value being provided
34
+ */
35
+ interface iNodeFactoryProvider<T> {
36
+ /** The token this provider is for */
37
+ provide: Token<T>;
38
+ /** Factory function to create the value */
39
+ factory: () => NoInfer<T>;
40
+ }
41
+ /**
42
+ * Provider that uses a class constructor to create instances.
43
+ * @template T - The type of value being provided
44
+ */
45
+ interface iNodeClassProvider<T> {
46
+ /** The token this provider is for */
47
+ provide: Token<T>;
48
+ /** The class to instantiate */
49
+ useClass: Ctor<T>;
50
+ }
51
+ /**
52
+ * Provider that creates an alias to another token.
53
+ * When this token is injected, the aliased token's value is returned instead.
54
+ * @template T - The type of value being provided
55
+ */
56
+ interface iNodeAliasProvider<T> {
57
+ /** The token this provider is for */
58
+ provide: Token<T>;
59
+ /** The token to alias to */
60
+ alias: Token<T>;
61
+ }
62
+ /**
63
+ * Union type of all possible provider configurations.
64
+ * @template T - The type of value being provided
65
+ */
66
+ type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
67
+ /**
68
+ * Union type of all values that can be provided to a container.
69
+ * @template T - The type of value being provided
70
+ */
71
+ type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
72
+
1
73
  /**
2
74
  * Base class for dependency injection tokens.
3
75
  * This class should not be instantiated directly. Use {@link NodeToken} or {@link MultiNodeToken} instead.
@@ -78,76 +150,4 @@ declare function isNodeBase<T>(specimen: unknown): specimen is NodeToken<T> | Mu
78
150
  */
79
151
  declare function extractToken<T>(provider: Token<T>, isAlias?: boolean): NodeToken<T> | MultiNodeToken<T>;
80
152
 
81
- /**
82
- * Represents a constructor function type.
83
- * @template T - The type that the constructor creates
84
- */
85
- type Ctor<T> = new (...args: any[]) => T;
86
- /**
87
- * Represents a token that can be either a NodeBase token or a constructor.
88
- * @template T - The type that the token represents
89
- */
90
- type Token<T> = NodeBase<T> | Ctor<T>;
91
- /**
92
- * Options for configuring a NodeToken or MultiNodeToken.
93
- * @template T - The type of value the token represents
94
- */
95
- interface iNodeTokenBaseOptions<T> {
96
- /**
97
- * Optional factory function to create instances of this token.
98
- */
99
- factory?: () => NoInfer<T>;
100
- }
101
- /**
102
- * Provider that supplies a static value for a token.
103
- * @template T - The type of value being provided
104
- */
105
- interface iNodeValueProvider<T> {
106
- /** The token this provider is for */
107
- provide: Token<T>;
108
- /** The static value to provide */
109
- value: NoInfer<T>;
110
- }
111
- /**
112
- * Provider that uses a factory function to create instances.
113
- * @template T - The type of value being provided
114
- */
115
- interface iNodeFactoryProvider<T> {
116
- /** The token this provider is for */
117
- provide: Token<T>;
118
- /** Factory function to create the value */
119
- factory: () => NoInfer<T>;
120
- }
121
- /**
122
- * Provider that uses a class constructor to create instances.
123
- * @template T - The type of value being provided
124
- */
125
- interface iNodeClassProvider<T> {
126
- /** The token this provider is for */
127
- provide: Token<T>;
128
- /** The class to instantiate */
129
- useClass: Ctor<T>;
130
- }
131
- /**
132
- * Provider that creates an alias to another token.
133
- * When this token is injected, the aliased token's value is returned instead.
134
- * @template T - The type of value being provided
135
- */
136
- interface iNodeAliasProvider<T> {
137
- /** The token this provider is for */
138
- provide: Token<T>;
139
- /** The token to alias to */
140
- alias: Token<T>;
141
- }
142
- /**
143
- * Union type of all possible provider configurations.
144
- * @template T - The type of value being provided
145
- */
146
- type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
147
- /**
148
- * Union type of all values that can be provided to a container.
149
- * @template T - The type of value being provided
150
- */
151
- type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
152
-
153
- export { type Ctor as C, MultiNodeToken as M, NodeBase as N, type Provider as P, type Token as T, NodeToken as a, type iNodeTokenBaseOptions as b, type iNodeValueProvider as c, type iNodeFactoryProvider as d, extractToken as e, type iNodeClassProvider as f, type iNodeAliasProvider as g, type iNodeProvider as h, isNodeBase as i };
153
+ export { type Ctor as C, MultiNodeToken as M, NodeToken as N, type Provider as P, type Token as T, NodeBase as a, type iNodeTokenBaseOptions as b, type iNodeValueProvider as c, type iNodeFactoryProvider as d, extractToken as e, type iNodeClassProvider as f, type iNodeAliasProvider as g, type iNodeProvider as h, isNodeBase as i };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/git-illuma/core"
8
8
  },
9
- "version": "1.0.0",
9
+ "version": "1.2.1",
10
10
  "type": "module",
11
11
  "main": "./dist/index.cjs",
12
12
  "module": "./dist/index.js",