@thi.ng/system 2.1.34 → 2.1.36
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.
- package/CHANGELOG.md +1 -1
- package/README.md +12 -22
- package/api.d.ts +3 -3
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/system)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -17,13 +17,11 @@ This project is part of the
|
|
|
17
17
|
- [Example system](#example-system)
|
|
18
18
|
- [System visualization](#system-visualization)
|
|
19
19
|
- [Authors](#authors)
|
|
20
|
-
- [Maintainer](#maintainer)
|
|
21
|
-
- [Contributors](#contributors)
|
|
22
20
|
- [License](#license)
|
|
23
21
|
|
|
24
22
|
## About
|
|
25
23
|
|
|
26
|
-
Minimal and explicit dependency-injection & lifecycle container for stateful app components
|
|
24
|
+
Minimal and explicit dependency-injection & lifecycle container for stateful app components
|
|
27
25
|
|
|
28
26
|
Inspired by Stuart Sierra's
|
|
29
27
|
[component](https://github.com/stuartsierra/component) framework for
|
|
@@ -51,11 +49,8 @@ ES module import:
|
|
|
51
49
|
|
|
52
50
|
For Node.js REPL:
|
|
53
51
|
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
node --experimental-repl-await
|
|
57
|
-
|
|
58
|
-
> const system = await import("@thi.ng/system");
|
|
52
|
+
```js
|
|
53
|
+
const system = await import("@thi.ng/system");
|
|
59
54
|
```
|
|
60
55
|
|
|
61
56
|
Package sizes (brotli'd, pre-treeshake): ESM: 387 bytes
|
|
@@ -91,7 +86,7 @@ interface FooSys {
|
|
|
91
86
|
// `ILifecycle` interface...
|
|
92
87
|
|
|
93
88
|
class Logger implements ILifecycle {
|
|
94
|
-
|
|
89
|
+
|
|
95
90
|
info(msg: string) {
|
|
96
91
|
console.log(`[info] ${msg}`);
|
|
97
92
|
}
|
|
@@ -100,7 +95,7 @@ class Logger implements ILifecycle {
|
|
|
100
95
|
this.info("start logger");
|
|
101
96
|
return true;
|
|
102
97
|
}
|
|
103
|
-
|
|
98
|
+
|
|
104
99
|
async stop() {
|
|
105
100
|
this.info("stop logger");
|
|
106
101
|
return true;
|
|
@@ -110,7 +105,7 @@ class Logger implements ILifecycle {
|
|
|
110
105
|
// DB requires a logger & cache
|
|
111
106
|
|
|
112
107
|
class DB implements ILifecycle {
|
|
113
|
-
|
|
108
|
+
|
|
114
109
|
constructor(protected logger: Logger, protected cache: Cache) {}
|
|
115
110
|
|
|
116
111
|
async start() {
|
|
@@ -132,7 +127,7 @@ class Cache implements ILifecycle {
|
|
|
132
127
|
this.logger.info("start cache");
|
|
133
128
|
return true;
|
|
134
129
|
}
|
|
135
|
-
|
|
130
|
+
|
|
136
131
|
async stop() {
|
|
137
132
|
this.logger.info("stop cache");
|
|
138
133
|
return true;
|
|
@@ -224,13 +219,8 @@ Resulting visualization:
|
|
|
224
219
|
|
|
225
220
|
## Authors
|
|
226
221
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
- Karsten Schmidt ([@postspectacular](https://github.com/postspectacular))
|
|
230
|
-
|
|
231
|
-
### Contributors
|
|
232
|
-
|
|
233
|
-
- Kevin Nolan ([@allforabit](https://github.com/allforabit))
|
|
222
|
+
- [Karsten Schmidt](https://thi.ng) (Main author)
|
|
223
|
+
- [Kevin Nolan](https://github.com/allforabit)
|
|
234
224
|
|
|
235
225
|
If this project contributes to an academic publication, please cite it as:
|
|
236
226
|
|
|
@@ -245,4 +235,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
245
235
|
|
|
246
236
|
## License
|
|
247
237
|
|
|
248
|
-
© 2020 - 2022 Karsten Schmidt // Apache
|
|
238
|
+
© 2020 - 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ export interface ILifecycle {
|
|
|
26
26
|
* Defines the participants of a system. Maps component names to their
|
|
27
27
|
* respective types
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export type SystemMap<T> = Record<Keys<T>, ILifecycle>;
|
|
30
30
|
/**
|
|
31
31
|
* Component initialization function.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type ComponentFactory<T extends SystemMap<T>> = Fn<T, ILifecycle>;
|
|
34
34
|
export interface SystemSpec<T extends SystemMap<T>> {
|
|
35
35
|
factory: ComponentFactory<T>;
|
|
36
36
|
deps?: Keys<T>[];
|
|
@@ -40,7 +40,7 @@ export interface SystemSpec<T extends SystemMap<T>> {
|
|
|
40
40
|
* component dependencies. The generic type arg `T` is used to infer &
|
|
41
41
|
* validate all specs.
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
43
|
+
export type SystemSpecs<T extends SystemMap<T>> = Record<Keys<T>, SystemSpec<T>>;
|
|
44
44
|
/** @internal */
|
|
45
45
|
export declare let LOGGER: ILogger;
|
|
46
46
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/system",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.36",
|
|
4
4
|
"description": "Minimal and explicit dependency-injection & lifecycle container for stateful app components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
|
+
"contributors": [
|
|
26
|
+
"Kevin Nolan (https://github.com/allforabit)"
|
|
27
|
+
],
|
|
25
28
|
"license": "Apache-2.0",
|
|
26
29
|
"scripts": {
|
|
27
30
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,17 +37,17 @@
|
|
|
34
37
|
"test": "testament test"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/dgraph": "^2.1.
|
|
39
|
-
"@thi.ng/logger": "^1.4.
|
|
40
|
+
"@thi.ng/api": "^8.6.1",
|
|
41
|
+
"@thi.ng/dgraph": "^2.1.32",
|
|
42
|
+
"@thi.ng/logger": "^1.4.5"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
|
-
"@microsoft/api-extractor": "^7.33.
|
|
43
|
-
"@thi.ng/testament": "^0.3.
|
|
45
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
46
|
+
"@thi.ng/testament": "^0.3.7",
|
|
44
47
|
"rimraf": "^3.0.2",
|
|
45
48
|
"tools": "^0.0.1",
|
|
46
|
-
"typedoc": "^0.23.
|
|
47
|
-
"typescript": "^4.
|
|
49
|
+
"typedoc": "^0.23.22",
|
|
50
|
+
"typescript": "^4.9.4"
|
|
48
51
|
},
|
|
49
52
|
"keywords": [
|
|
50
53
|
"clojure",
|
|
@@ -81,5 +84,5 @@
|
|
|
81
84
|
"thi.ng": {
|
|
82
85
|
"year": 2020
|
|
83
86
|
},
|
|
84
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
85
88
|
}
|