@armscye/hooks 0.6.0 → 0.7.4
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/README.md +3 -9
- package/dist/hook-provider.d.ts +1 -1
- package/dist/shutdown-hook.d.ts +3 -4
- package/dist/startup-hook.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ yarn add @armscye/hooks --dev
|
|
|
20
20
|
|
|
21
21
|
### ShutdownHook `Interface`
|
|
22
22
|
|
|
23
|
-
Interface defining
|
|
23
|
+
Interface defining method to respond to system signals (when application gets shutdown by, e.g., `SIGTERM`).
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
26
|
interface ShutdownHook {
|
|
@@ -46,9 +46,6 @@ class MyShutdownHook implements ShutdownHook {
|
|
|
46
46
|
.catch(error => console.error("Error closing database:", error));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
// Register the shutdown hook with the application
|
|
51
|
-
app.registerHook(new MyShutdownHook())
|
|
52
49
|
```
|
|
53
50
|
|
|
54
51
|
### StartupHook `Interface`
|
|
@@ -75,17 +72,14 @@ class MyStartupHook implements StartupHook {
|
|
|
75
72
|
console.log('Database connection established.');
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
// Register the startup hook with the application
|
|
80
|
-
app.registerHook(new MyStartupHook());
|
|
81
75
|
```
|
|
82
76
|
|
|
83
77
|
### HookProvider `Type`
|
|
84
78
|
|
|
85
|
-
Describes
|
|
79
|
+
Describes type structure for hooks.
|
|
86
80
|
|
|
87
81
|
```ts
|
|
88
|
-
type HookProvider
|
|
82
|
+
type HookProvider = string | symbol | object | Type<any> | Function;
|
|
89
83
|
```
|
|
90
84
|
|
|
91
85
|
## License
|
package/dist/hook-provider.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Type } from '@armscye/core';
|
|
2
|
-
export type HookProvider
|
|
2
|
+
export type HookProvider = string | symbol | object | Type<any> | Function;
|
package/dist/shutdown-hook.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* shutdown by, e.g., `SIGTERM`).
|
|
2
|
+
* Defines a hook that runs when the application is shutting down.
|
|
4
3
|
*/
|
|
5
4
|
export interface ShutdownHook {
|
|
6
5
|
/**
|
|
7
|
-
* Called
|
|
6
|
+
* Called during application shutdown.
|
|
8
7
|
*
|
|
9
|
-
* @param signal
|
|
8
|
+
* @param signal The system signal that triggered the shutdown, if available.
|
|
10
9
|
*/
|
|
11
10
|
onShutdown(signal?: string): any;
|
|
12
11
|
}
|
package/dist/startup-hook.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Defines a hook that runs during application startup.
|
|
3
3
|
*/
|
|
4
4
|
export interface StartupHook {
|
|
5
5
|
/**
|
|
6
|
-
* Called
|
|
6
|
+
* Called when the application is starting.
|
|
7
7
|
*/
|
|
8
8
|
onStartup(): any;
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armscye/hooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "A collection of shared standard TypeScript definitions (@hooks)",
|
|
5
5
|
"author": "Augustus Kamau",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"hooks"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@armscye/core": "^0.3
|
|
18
|
+
"@armscye/core": "^0.4.3"
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/armscye/armscye#readme",
|
|
21
21
|
"repository": {
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "e9a42ae673466c9a255f4ebec8750f580e9f70a6"
|
|
32
32
|
}
|