@jitar-plugins/notification 0.0.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.
- package/README.md +45 -0
- package/dist/NotificationHealthCheck.d.ts +9 -0
- package/dist/NotificationHealthCheck.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# Notification | Jitar Plugins
|
|
3
|
+
|
|
4
|
+
This package provides plugins for integrating the [The Shelf notification package](https://github.com/MaskingTechnology/theshelf/tree/main/packages/notification) in Jitar applications.
|
|
5
|
+
|
|
6
|
+
It contains a single health check for checking the file store health.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @theshelf/notification @jitar-plugins/notification
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Follow the following steps to configure and use the provided health check.
|
|
17
|
+
|
|
18
|
+
### Step 1 - Configure the health check
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// src/health/notificationHealthCheck.ts
|
|
22
|
+
|
|
23
|
+
import notificationService from '@theshelf/notification';
|
|
24
|
+
import { NotificationHealthCheck } from '@jitar-plugins/notification';
|
|
25
|
+
|
|
26
|
+
export default new NotificationHealthCheck(notificationService);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Step 2 - Activate the health check
|
|
30
|
+
|
|
31
|
+
With the health check in place, it needs to be activated by registering it to the worker / standalone service.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
/* services/some-worker.json */
|
|
35
|
+
{
|
|
36
|
+
"url": "http://example.com:3000",
|
|
37
|
+
"healthChecks": [ /* add health checks here */
|
|
38
|
+
"./health/notificationHealthCheck"
|
|
39
|
+
],
|
|
40
|
+
"worker":
|
|
41
|
+
{
|
|
42
|
+
/* service configuration */
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HealthCheck } from 'jitar';
|
|
2
|
+
import type { NotificationService } from '@theshelf/notification';
|
|
3
|
+
export default class NotificationHealthCheck implements HealthCheck {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(notificationService: NotificationService);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get timeout(): number;
|
|
8
|
+
isHealthy(): Promise<boolean>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default class NotificationHealthCheck {
|
|
2
|
+
#notificationService;
|
|
3
|
+
#name = 'notifications';
|
|
4
|
+
#timeout = 5000;
|
|
5
|
+
constructor(notificationService) {
|
|
6
|
+
this.#notificationService = notificationService;
|
|
7
|
+
}
|
|
8
|
+
get name() { return this.#name; }
|
|
9
|
+
get timeout() { return this.#timeout; }
|
|
10
|
+
async isHealthy() {
|
|
11
|
+
return this.#notificationService.connected;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NotificationHealthCheck } from './NotificationHealthCheck';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NotificationHealthCheck } from './NotificationHealthCheck';
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jitar-plugins/notification",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"clean": "rimraf dist",
|
|
9
|
+
"lint": "eslint",
|
|
10
|
+
"review": "npm run build && npm run lint",
|
|
11
|
+
"prepublishOnly": "npm run build"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"README.md",
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"exports": "./dist/index.js",
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@theshelf/notification": "^0.0.2",
|
|
21
|
+
"jitar": "^0.10.3"
|
|
22
|
+
}
|
|
23
|
+
}
|